/* ==========================================================================
   Site-wide Base Styles
   ========================================================================== */

/* Page structure - sticky footer */
html, body { height: 100%; }
body { display: flex; flex-direction: column; }
.main-content { flex: 1 0 auto; }

/* Site-wide background */
body {
    background: #e9ecef;
}

/* Site-wide form styling */
.form-control {
    background: #fff;
    border-color: #ced4da;
    color: #212529;
}

.form-control:focus {
    background: #fff;
    border-color: #6c757d;
    box-shadow: 0 0 0 0.1rem rgba(108,117,125,0.15);
}

/* Summernote editor styling */
.note-editor.note-frame {
    border-color: #ced4da;
}

.note-editor .note-editing-area .note-editable {
    background: #fff;
    color: #212529;
}

.note-editor .note-toolbar {
    background: #e9ecef;
}

/* ==========================================================================
   Navbar Styles
   ========================================================================== */

.navbar-brand:hover {
    color: #dc3545 !important;
    transition: color 0.3s ease;
}

.navbar-brand:hover img {
    filter: brightness(0) saturate(100%) invert(27%) sepia(91%) saturate(2353%) hue-rotate(337deg) brightness(91%) contrast(95%);
    transition: filter 0.3s ease;
}

.navbar-brand img {
    transition: filter 0.3s ease;
}

.dropdown-menu .dropdown-item i {
    width: 1.25em;
    text-align: center;
}

.dropdown-item-text {
    white-space: nowrap;
}

/* ==========================================================================
   Common UI Components
   ========================================================================== */

/* Collapsible section chevron animation */
.chevron {
    display: inline-block;
    transition: transform 0.2s ease;
}
[aria-expanded="true"] .chevron {
    transform: rotate(90deg);
}

/* Vertical ID tab for list items */
.id-tab {
    min-width: 24px;
    max-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 0.25rem 0 0 0.25rem;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    font-size: 0.7rem;
    letter-spacing: 1px;
    padding: 0.5rem 0;
}

/* ==========================================================================
   Avatar Styles
   ========================================================================== */

.avatar-lg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
}

/* ==========================================================================
   Content Overflow Handling
   ========================================================================== */

/* Prevent long content from overflowing cards */
.list-group-item .flex-grow-1,
.card-body .flex-grow-1 {
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.list-group-item .flex-grow-1 a,
.card-body .flex-grow-1 a {
    word-break: break-all;
}

.list-group-item pre,
.card-body pre {
    overflow-wrap: break-word;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* ==========================================================================
   User-Generated Content (Summernote output)
   ========================================================================== */

/* Tables */
.user-content table,
.description table,
.card-body table,
.list-group-item table {
    border-collapse: collapse;
    width: auto;
    margin: 0.5rem 0;
    font-size: 0.9em;
}

.user-content table th,
.user-content table td,
.description table th,
.description table td,
.card-body table th,
.card-body table td,
.list-group-item table th,
.list-group-item table td {
    border: 1px solid #dee2e6;
    padding: 0.4rem 0.6rem;
    text-align: left;
}

.user-content table th,
.description table th,
.card-body table th,
.list-group-item table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.user-content table tr:nth-child(even),
.description table tr:nth-child(even),
.card-body table tr:nth-child(even),
.list-group-item table tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* ==========================================================================
   Homepage Styles
   ========================================================================== */

.section-card {
    margin-bottom: 1rem;
}

.section-card .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.step-row {
    display: flex;
    align-items: flex-start;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f1f1f1;
}

.step-row:last-child {
    border-bottom: none;
}

.step-num {
    width: 22px;
    height: 22px;
    background-color: #6c757d;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    flex-shrink: 0;
    margin-right: 0.75rem;
}

.step-content strong {
    display: block;
    margin-bottom: 0.15rem;
}

.flow-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.flow-item {
    text-align: center;
    flex: 1;
}

.flow-item i {
    font-size: 1.1rem;
    color: #6c757d;
    display: block;
    margin-bottom: 0.4rem;
}

.flow-item strong {
    display: block;
    font-size: 0.85rem;
}

.flow-item small {
    color: #6c757d;
    font-size: 0.75rem;
}

.flow-arrow {
    color: #adb5bd;
    font-size: 1rem;
    flex-shrink: 0;
    padding: 0 0.4rem;
}

.access-level {
    display: flex;
    align-items: center;
    margin-bottom: 0.4rem;
}

.access-level .badge {
    width: 70px;
    text-align: center;
    margin-right: 0.6rem;
    font-size: 0.75rem;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.feature-item i {
    width: 18px;
    color: #6c757d;
    margin-right: 0.6rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.use-case-item {
    padding: 0.4rem 0;
    border-bottom: 1px solid #f5f5f5;
}

.use-case-item:last-child {
    border-bottom: none;
}

/* ==========================================================================
   Activity Feed
   ========================================================================== */

.feed-item {
    border-left: 4px solid #dee2e6;
    transition: all 0.15s ease;
}

.feed-item:hover {
    background-color: #f8f9fa;
    border-left-color: #6c757d;
}

.feed-item.type-story {
    border-left-color: #28a745;
}

.feed-item.type-event {
    border-left-color: #007bff;
}

.feed-item.type-url,
.feed-item.type-log,
.feed-item.type-email,
.feed-item.type-photo,
.feed-item.type-statement {
    border-left-color: #ffc107;
}

.feed-item.type-publication {
    border-left-color: #6f42c1;
}

.feed-item.unpublished {
    background-color: #e9ecef;
    color: #6c757d;
    font-style: italic;
    text-decoration: line-through;
}

.feed-item.unpublished a {
    color: #6c757d;
    text-decoration: line-through;
}

.feed-item.unpublished .badge {
    background-color: #6c757d !important;
    text-decoration: line-through;
}

.type-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
}

/* ==========================================================================
   Observations Page
   ========================================================================== */

.obs-type-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

#paste_zone,
#drop_zone {
    border: 2px dashed #bbb;
    border-radius: 5px;
    padding: 25px;
    text-align: center;
    font-size: 20px;
    height: 3em;
    background-color: #f8f8f8;
    cursor: pointer;
}

#paste_zone:focus {
    outline: 2px solid #007bff;
    background-color: #e9ecef;
}

/* ==========================================================================
   Inbox / Messages
   ========================================================================== */

.folder-list .list-group-item {
    cursor: pointer;
    border-left: 4px solid transparent;
    transition: all 0.15s ease;
}

.folder-list .list-group-item.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
    border-left: 4px solid #0056b3;
    font-weight: bold;
}

.folder-list .list-group-item.active .badge {
    background-color: #fff;
    color: #007bff;
}

.folder-list .list-group-item:hover:not(.active) {
    background-color: #e9ecef;
    border-left: 4px solid #6c757d;
}

.message-unread {
    background-color: #e3f2fd;
    font-weight: bold;
}

.message-row:hover {
    background-color: #f5f5f5;
}

.message-list {
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.thread-message {
    border-left: 3px solid #dee2e6;
    padding-left: 15px;
    margin-bottom: 15px;
}

.thread-message.current {
    border-left-color: #007bff;
    background-color: #f8f9fa;
}

.thread-message.sent-by-me {
    border-left-color: #28a745;
}

/* ==========================================================================
   Auth Pages (Login, Register, Password Reset, Email Verified)
   ========================================================================== */

/* Common auth page background container */
.auth-bg,
.login-bg,
.register-bg,
.reset-bg,
.verified-bg,
.success-bg {
    flex: 1;
}

/* Common auth card styling */
.auth-card,
.login-card,
.register-card,
.reset-card,
.verified-card,
.success-card {
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Common auth header styling */
.auth-header,
.login-header,
.register-header,
.reset-header,
.verified-header,
.success-header {
    border-bottom: 1px solid #495057;
}

/* ==========================================================================
   Browse/Attach Pages
   ========================================================================== */

/* Invert colors for attached observations */
.obs-attached {
    filter: invert(1);
}

.obs-attached img {
    filter: invert(1); /* Double invert to show images correctly */
}

/* ==========================================================================
   Admin Pages (User/Group Management)
   ========================================================================== */

.action-btn {
    min-width: 100px;
}

.access-btn {
    width: 80px;
}

.access-btn.active {
    box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
}