/* ==========================================================================
   ZerothGen Research Portal - brand.css
   Small overrides & additions on top of templatemo-glass-admin-style.css
   ========================================================================== */

/* ---- Status badge: Rejected (template ships completed/pending/processing) ---- */
.status-badge.rejected {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
}
.status-badge.rejected::before { background: #ef4444; }

/* ---- Alerts (flash messages) ---- */
.app-alert {
    padding: 14px 18px;
    border-radius: 14px;
    margin: 0 28px 18px;
    font-size: 0.95rem;
    border: 1px solid;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}
.app-alert-success {
    color: var(--emerald-light);
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
}
.app-alert-error {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
}

/* ---- Forms: align select & textarea with .form-input ---- */
select.form-input,
textarea.form-input {
    width: 100%;
    color: inherit;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 13px 16px;
    font: inherit;
    outline: none;
    transition: border-color 0.2s;
}
select.form-input:focus,
textarea.form-input:focus { border-color: var(--emerald-light); }
select.form-input option { color: #111; }
body[data-theme="light"] select.form-input option { color: #111; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 22px;
}
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }

.form-hint { font-size: 0.8rem; opacity: 0.65; margin-top: 6px; }

/* ---- Dynamic author rows ---- */
.author-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}
.author-row .form-input { flex: 1; }
.author-row input[name="author_emails[]"] { flex: 1.2; min-width: 180px; }
.author-field { position: relative; flex: 1; }
.author-field .form-input { width: 100%; }
.author-suggest {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--glass-bg, #1e2430);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.15));
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-height: 260px;
    overflow-y: auto;
}
.author-suggest-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 0.9rem;
}
.author-suggest-item:hover { background: var(--glass-hover, rgba(255, 255, 255, 0.08)); }
.author-suggest-item span:last-child { opacity: 0.6; font-size: 0.8rem; }
.author-remove {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}
.author-add-btn {
    border: 1px dashed var(--glass-border);
    background: var(--glass-hover);
    color: inherit;
    border-radius: 12px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* ---- Page action bar (top-right button) ---- */
.page-actions { display: flex; gap: 10px; }

/* ---- Paper detail ---- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.detail-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 16px 18px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.detail-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.65;
    margin-bottom: 6px;
}
.detail-value { font-weight: 600; word-break: break-word; }
.detail-value a { color: var(--emerald-light); }

/* ---- History / timeline ---- */
.history-list { display: flex; flex-direction: column; gap: 0; }
.history-item {
    display: flex;
    gap: 14px;
    position: relative;
    padding-bottom: 18px;
}
.history-item:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 20px;
    bottom: 2px;
    width: 2px;
    background: var(--glass-border);
}
.history-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald-light), var(--gold));
    flex-shrink: 0;
    margin-top: 3px;
}
.history-dot.rejected { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.history-content { flex: 1; }
.history-title { font-weight: 600; }
.history-meta { font-size: 0.8rem; opacity: 0.65; margin-top: 2px; }

/* ---- Authors chips ---- */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--glass-hover);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.85rem;
}
.chip.matched { border-color: rgba(16, 185, 129, 0.5); color: var(--emerald-light); }
.chip-unmatched { font-size: 0.68rem; opacity: 0.7; }

/* ---- Danger / subtle buttons ---- */
.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.28); }
.btn-ghost {
    background: transparent;
    color: inherit;
    border: 1px solid var(--glass-border);
}
.btn-ghost:hover { background: var(--glass-hover); }

/* ---- Role badges (users table) ---- */
.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    border: 1px solid var(--glass-border);
    background: var(--glass-hover);
}
.role-badge.admin { color: var(--gold-light); border-color: rgba(212, 165, 116, 0.5); }
.role-badge.subadmin { color: var(--emerald-light); border-color: rgba(16, 185, 129, 0.5); }
.role-badge.researcher { opacity: 0.85; }

/* ---- Status pill for accounts ---- */
.status-pill { font-size: 0.78rem; }
.status-pill.inactive { color: #fca5a5; }

/* ---- Inline icon actions ---- */
.action-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--emerald-light);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    font-family: inherit;
}
.action-link:hover { background: var(--glass-hover); }
.action-link.danger { color: #fca5a5; }

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    opacity: 0.75;
}
.empty-state .empty-icon { font-size: 2.4rem; margin-bottom: 10px; }

/* ---- Delete request reason box ---- */
.reason-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 10px 0;
    font-size: 0.92rem;
}

/* ---- Misc helpers ---- */
.muted { opacity: 0.65; font-size: 0.85rem; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }

/* Keep dense tables readable over glass */
.data-table td, .data-table th { padding: 13px 18px; }

/* ==========================================================================
   Phase 14 additions
   ========================================================================== */

/* ---- Dropdowns: match glass theme (dark list, not white) ---- */
select.form-input option {
    background: #171c2b;
    color: #e2e8f0;
    padding: 8px 12px;
}
body[data-theme="light"] select.form-input option {
    background: #ffffff;
    color: #0f172a;
}
select.form-input:disabled { opacity: 0.6; }

/* ---- Info alert (flash) ---- */
.app-alert-info {
    color: var(--emerald-light);
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.4);
}

/* ---- Custom file input (glass style) ---- */
.file-input::-webkit-file-upload-button {
    background: var(--glass-hover);
    color: inherit;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 14px;
    margin-right: 12px;
    font-family: inherit;
    cursor: pointer;
}
.file-input::-webkit-file-upload-button:hover { border-color: var(--emerald-light); }
.file-input::file-selector-button {
    background: var(--glass-hover);
    color: inherit;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 14px;
    margin-right: 12px;
    font-family: inherit;
    cursor: pointer;
}

/* ---- Toggle switch (activate / deactivate) ---- */
.toggle-switch { display: inline-flex; align-items: center; cursor: pointer; margin-right: 8px; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    background: var(--glass-border);
    border-radius: 999px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--emerald-light); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ---- Notification bell + dropdown ---- */
.notif-wrap { position: relative; }
.notif-wrap .notif-dot {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    font-size: 0.7rem;
    line-height: 18px;
    text-align: center;
    padding: 0 5px;
}
.notif-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 320px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    display: none;
    z-index: 60;
}
.notif-dropdown.open { display: block; }
.notif-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
}
.notif-mark { font-size: 0.8rem; color: var(--emerald-light); background: none; border: none; cursor: pointer; padding: 0; }
.notif-mark:hover { text-decoration: underline; }
.notif-actions { display: inline-flex; align-items: center; gap: 10px; }
.notif-item {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
    text-decoration: none;
    color: inherit;
}
.notif-item:hover { background: var(--glass-hover); }
.notif-item.unread { background: rgba(16, 185, 129, 0.08); border-left: 3px solid var(--emerald-light); }
.notif-title { font-size: 0.9rem; font-weight: 500; }
.notif-meta { font-size: 0.75rem; opacity: 0.65; margin-top: 2px; }
.notif-empty { padding: 20px 16px; text-align: center; opacity: 0.7; }
.notif-footer {
    display: block;
    text-align: center;
    padding: 12px 16px;
    color: var(--emerald-light);
    text-decoration: none;
    font-size: 0.9rem;
}

/* ---- Pagination ---- */
.pagination { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 18px 0; }

/* ---- Messages ---- */
tr.msg-unread td { font-weight: 600; }
.unread-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--emerald-light);
    margin-right: 8px;
    vertical-align: middle;
}
.recipient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 6px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 16px;
    max-height: 220px;
    overflow-y: auto;
}
.checkbox-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.92rem; }
.checkbox-label input[type="checkbox"] { accent-color: var(--emerald-light); width: 16px; height: 16px; }

/* ==========================================================================
   Phase 16 - Responsive hardening
   Grid/flex items default to min-width:auto, which forces a glass-card wider
   than the viewport when it holds a wide table (clipped by body overflow-x).
   Allowing them to shrink moves the scrolling back inside .table-wrapper.
   ========================================================================== */
.main-content { min-width: 0; max-width: 100%; }
.content-grid, .stats-grid, .bottom-grid, .detail-grid, .form-grid { min-width: 0; }
.content-grid > *, .stats-grid > *, .bottom-grid > * { min-width: 0; }
.glass-card { max-width: 100%; }
.glass-card-overflow { overflow: visible; }
.table-wrapper { max-width: 100%; }
.card-header { flex-wrap: wrap; gap: 10px; }
.card-actions { flex-wrap: wrap; }
.flex-between { flex-wrap: wrap; }

/* Tables: keep them compact so fewer columns need horizontal scrolling. */
@media (max-width: 1200px) {
    .data-table th, .data-table td { padding: 10px 12px; }
    .data-table td { white-space: normal; }
    .table-user { flex-wrap: wrap; }
}

/* Drop the forced minimum table width on small screens; the wrapper scrolls. */
@media (max-width: 768px) {
    .data-table { min-width: 0; }
    .main-content { padding: 16px; }
    .stats-grid, .content-grid, .bottom-grid { gap: 16px; }
    .page-title { font-size: 20px; }
    .search-box, .search-input { min-width: 0 !important; width: 100% !important; }
    .navbar { gap: 12px; }
    .author-row { flex-wrap: wrap; }
    .author-row input[name="author_emails[]"] { min-width: 100%; }
}

/* ==========================================================================
   Phase 17 - Email-style messaging
   ========================================================================== */

/* Compact email list rows (less vertical gap between emails). */
.email-table th, .email-table td { padding: 7px 14px; }
.email-table td:first-child { white-space: nowrap; }
.inline-form { display: inline; }
.link-danger { color: #fca5a5; }
.link-danger:hover { color: #ef4444; }

/* Recipient picker (To / CC) with typeahead suggestions. */
.recipient-picker {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 6px 8px;
}
.recipient-picker .form-input {
    flex: 1;
    min-width: 180px;
    border: none;
    background: transparent;
    padding: 8px 6px;
}
.recipient-picker .form-input:focus { border: none; box-shadow: none; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.email-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--emerald-light, #6ee7b7);
    white-space: nowrap;
}
.chip-remove {
    background: none;
    border: none;
    color: inherit;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
.chip-remove:hover { color: #ef4444; }
.recipient-suggest {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--glass-card, rgba(255, 255, 255, 0.06));
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    backdrop-filter: blur(16px);
    max-height: 240px;
    overflow-y: auto;
}
.recipient-suggest-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 14px;
    cursor: pointer;
}
.recipient-suggest-item:hover { background: var(--glass-hover, rgba(255, 255, 255, 0.08)); }
.recipient-suggest-item span:last-child { opacity: 0.6; font-size: 0.8rem; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.92rem; }
.checkbox-inline input[type="checkbox"] { accent-color: var(--emerald-light); width: 16px; height: 16px; }

/* Email detail header meta. */
.email-meta { font-size: 0.9rem; }

/* ==========================================================================
   Phase 17b - Responsive research-paper list + mobile back button
   ========================================================================== */

/* On small screens the papers table becomes a stacked card list so every
   column stays visible (no clipped/overflowing content). */
@media (max-width: 768px) {
    .table-wrapper { overflow: visible; }
    table.data-table.responsive-cards,
    table.data-table.responsive-cards tbody,
    table.data-table.responsive-cards tr,
    table.data-table.responsive-cards td {
        display: block;
        width: 100%;
        min-width: 0;
    }
    table.data-table.responsive-cards { border-collapse: separate; border-spacing: 0; }
    table.data-table.responsive-cards thead { display: none; }
    table.data-table.responsive-cards tr {
        border: 1px solid var(--glass-border);
        border-radius: 14px;
        margin: 0 0 12px;
        padding: 12px 14px;
        background: var(--glass-bg);
    }
    table.data-table.responsive-cards td {
        border: none;
        padding: 6px 0;
        display: flex;
        gap: 10px;
        align-items: flex-start;
        white-space: normal;
    }
    table.data-table.responsive-cards td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        opacity: 0.6;
        min-width: 88px;
        flex-shrink: 0;
        padding-top: 3px;
    }
    table.data-table.responsive-cards td[data-label="Actions"] .flex { flex-wrap: wrap; }
    table.data-table.responsive-cards td[data-label="Actions"] { align-items: flex-start; }

    /* Paper filters stack full-width for usability. */
    .glass-card .flex[action] .search-box,
    .glass-card .flex[action] select.form-input {
        width: 100% !important;
        max-width: none !important;
    }
}

/* Notification bell is now a direct link (no dropdown). */
a.nav-btn { text-decoration: none; }

/* Back button in the main page header (goes to the previous page). */
.navbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.navbar-left .page-title { margin: 0; min-width: 0; }
.back-btn { flex-shrink: 0; }
@media (max-width: 768px) {
    .navbar-left { gap: 10px; }
    .back-btn { width: 40px; height: 40px; }
}

/* ZerothGen logo image (replaces the letter "Z" badge). */
img.logo {
    display: block;
    height: 28px;
    width: auto;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
    padding: 0;
}
[data-theme="light"] img.logo {
    content: url("logo.png");
}
img.login-logo {
    display: block;
    width: 66px;
    height: auto;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
    padding: 0;
    margin: 0 auto 18px;
}
[data-theme="light"] img.login-logo {
    content: url("logo.png");
}