/* ═══════════════════════════════════════════════════════════════════
   Livor — Livre d'Or Helvétia Vaud
   Stylesheet — Book-like theme
   ═══════════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────────── */
:root {
    --burgundy:       #6B1D2A;
    --burgundy-dark:  #4A1019;
    --burgundy-light: #8B3040;
    --gold:           #C5A55A;
    --gold-light:     #D4BC7E;
    --gold-dark:      #A88B3D;
    --cream:          #FDF8F0;
    --cream-dark:     #F5EDE0;
    --ivory:          #FEFCF7;
    --brown:          #3A2520;
    --brown-light:    #5C4035;
    --text:           #2C1810;
    --text-light:     #6B5D55;
    --text-muted:     #9A8D85;
    --danger:         #A03030;
    --success:        #2D6B3F;
    --white:          #FFFFFF;

    --font-display:   'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body:      'Lora', Georgia, 'Times New Roman', serif;
    --font-ui:        'Source Sans 3', 'Segoe UI', sans-serif;

    --shadow-sm:      0 1px 3px rgba(58,37,32,0.12);
    --shadow-md:      0 4px 12px rgba(58,37,32,0.15);
    --shadow-lg:      0 8px 30px rgba(58,37,32,0.2);
    --shadow-book:    4px 4px 20px rgba(58,37,32,0.25), 0 0 60px rgba(58,37,32,0.08);

    --radius:         4px;
    --radius-lg:      8px;

    --nav-height:     56px;
}

/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--text);
    background-color: var(--cream-dark);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(107,29,42,0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(197,165,90,0.05) 0%, transparent 50%);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--burgundy);
    text-decoration: none;
}

a:hover {
    color: var(--burgundy-light);
}

button {
    cursor: pointer;
    font-family: var(--font-ui);
}

.hidden {
    display: none !important;
}

/* ── Navigation ─────────────────────────────────────────────────── */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: linear-gradient(135deg, var(--burgundy-dark) 0%, var(--burgundy) 100%);
    box-shadow: 0 2px 8px rgba(74,16,25,0.3);
    z-index: 1000;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 1rem;
}

.nav-brand {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gold) !important;
    letter-spacing: 0.02em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-brand-icon {
    font-size: 0.9rem;
    opacity: 0.8;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 1.5rem;
}

.nav-link {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255,255,255,0.8) !important;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,0.12);
}

.nav-link.active {
    background: rgba(255,255,255,0.18);
}

.nav-icon {
    font-size: 0.85rem;
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--gold);
    color: var(--burgundy-dark);
    border-radius: 10px;
    padding: 0.1rem 0.4rem;
    min-width: 18px;
    text-align: center;
    line-height: 1.3;
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-user {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.btn-logout {
    background: none;
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius);
    transition: all 0.2s;
    transform: rotate(180deg);
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}

/* ── Main Content ───────────────────────────────────────────────── */
#main-content {
    min-height: calc(100vh - var(--nav-height) - 48px);
    padding-top: var(--nav-height);
}

/* ── Footer ─────────────────────────────────────────────────────── */
.footer {
    background: var(--burgundy-dark);
    color: rgba(255,255,255,0.5);
    text-align: center;
    padding: 0.85rem 1rem;
    font-family: var(--font-ui);
    font-size: 0.8rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-sep {
    margin: 0 0.5rem;
    opacity: 0.5;
}


/* ═══════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════════ */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(107,29,42,0.06) 0%, transparent 60%),
        var(--cream-dark);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--ivory);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
    text-align: center;
    border: 1px solid rgba(197,165,90,0.2);
}

.login-crest {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--burgundy);
}

.login-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--burgundy);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    text-align: left;
}

.form-label {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 0.65rem 0;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text);
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(58,37,32,0.15);
    outline: none;
    transition: border-color 0.3s;
}

.form-input:focus {
    border-bottom-color: var(--burgundy);
}

.form-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.otp-input {
    font-size: 1.8rem;
    font-family: var(--font-ui);
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.5em;
    padding: 0.5rem;
}

.btn-primary {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--white);
    background: linear-gradient(135deg, var(--burgundy) 0%, var(--burgundy-dark) 100%);
    border: none;
    border-radius: var(--radius);
    padding: 0.75rem 1.5rem;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--burgundy-light) 0%, var(--burgundy) 100%);
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--burgundy);
    background: transparent;
    border: 1.5px solid var(--burgundy);
    border-radius: var(--radius);
    padding: 0.6rem 1.25rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--burgundy);
    color: var(--white);
}

.btn-gold {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--burgundy-dark);
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    border: none;
    border-radius: var(--radius);
    padding: 0.55rem 1.1rem;
    transition: all 0.2s;
}

.btn-gold:hover {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--white);
    background: var(--danger);
    border: none;
    border-radius: var(--radius);
    padding: 0.55rem 1.1rem;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #8A2020;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
}

.login-message {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    margin-top: 0.5rem;
}

.login-message.info {
    background: rgba(107,29,42,0.06);
    color: var(--burgundy);
}

.login-message.error {
    background: rgba(160,48,48,0.08);
    color: var(--danger);
}

.login-message.success {
    background: rgba(45,107,63,0.08);
    color: var(--success);
}

.login-back {
    margin-top: 0.75rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
}

.login-back a {
    color: var(--text-muted);
}

.login-back a:hover {
    color: var(--burgundy);
}


/* ═══════════════════════════════════════════════════════════════════
   BOOK VIEW — THE STAR OF THE SHOW
   ═══════════════════════════════════════════════════════════════════ */

.book-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--nav-height) - 48px);
    padding: 2rem 1rem;
}

/* The book page itself */
.book-page {
    position: relative;
    width: 100%;
    max-width: 700px;
    background: var(--ivory);
    border-radius: 2px 6px 6px 2px;
    box-shadow: var(--shadow-book);
    padding: 3rem 3rem 2.5rem 3.5rem;
    min-height: 500px;

    /* Paper texture */
    background-image:
        linear-gradient(to right, rgba(58,37,32,0.04) 0px, transparent 1px),
        linear-gradient(180deg,
            rgba(245,237,224,0.5) 0%,
            transparent 3%,
            transparent 97%,
            rgba(245,237,224,0.5) 100%
        ),
        repeating-linear-gradient(
            180deg,
            transparent 0px,
            transparent 28px,
            rgba(58,37,32,0.018) 28px,
            rgba(58,37,32,0.018) 29px
        );
    background-color: var(--ivory);

    /* Page turn animation */
    animation: pageIn 0.4s ease-out;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: perspective(800px) rotateY(-3deg) translateX(-10px);
    }
    to {
        opacity: 1;
        transform: perspective(800px) rotateY(0deg) translateX(0);
    }
}

@keyframes pageInReverse {
    from {
        opacity: 0;
        transform: perspective(800px) rotateY(3deg) translateX(10px);
    }
    to {
        opacity: 1;
        transform: perspective(800px) rotateY(0deg) translateX(0);
    }
}

.book-page.from-right {
    animation: pageIn 0.4s ease-out;
}

.book-page.from-left {
    animation: pageInReverse 0.4s ease-out;
}

/* Left edge (spine shadow) */
.book-page::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 24px;
    background: linear-gradient(
        to right,
        rgba(58,37,32,0.06) 0%,
        rgba(58,37,32,0.02) 40%,
        transparent 100%
    );
    border-radius: 2px 0 0 2px;
    pointer-events: none;
}

/* Top decorative border */
.book-page::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 40px;
    right: 24px;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent 0%,
        var(--gold) 15%,
        var(--gold) 85%,
        transparent 100%
    );
    opacity: 0.3;
}

/* Member number — large, at the top */
.book-numero {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--gold-dark);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

/* Member name — the big heading */
.book-name {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--burgundy);
    line-height: 1.2;
    margin-bottom: 0.15rem;
}

/* Drop cap decorative initial */
.book-name .initial {
    font-size: 2.6rem;
    line-height: 1;
    color: var(--burgundy-dark);
}

/* Vulgo */
.book-vulgo {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-style: italic;
    color: var(--gold-dark);
    margin-bottom: 1.25rem;
}

.book-vulgo::before {
    content: '\AB\00A0';
    opacity: 0.5;
}

.book-vulgo::after {
    content: '\00A0\BB';
    opacity: 0.5;
}

/* Separator ornament */
.book-ornament {
    text-align: center;
    margin: 1.25rem 0;
    color: var(--gold);
    font-size: 0.9rem;
    opacity: 0.5;
    letter-spacing: 0.4em;
}

/* Section of info fields */
.book-info {
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
}

.book-info .label {
    color: var(--text-light);
    font-style: italic;
}

/* Death info — subdued */
.book-info.deceased {
    color: var(--text-muted);
    font-style: italic;
}

.book-info.deceased .label {
    color: var(--text-muted);
}

/* Antecedents */
.book-antecedents {
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 0.6rem;
}

/* Volee badge */
.book-volee {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--burgundy);
    background: rgba(107,29,42,0.06);
    border: 1px solid rgba(107,29,42,0.12);
    border-radius: 3px;
    padding: 0.15rem 0.6rem;
    margin-bottom: 1rem;
    letter-spacing: 0.04em;
}

/* Cursus — the main text block */
.book-cursus {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text);
    margin: 1rem 0;
    text-align: justify;
    hyphens: auto;
    white-space: pre-line;
}

.book-cursus::first-line {
    font-variant: small-caps;
}

/* Extra fields below cursus */
.book-extras {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(197,165,90,0.2);
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.5rem;
}

.book-extra-item {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.book-extra-item .elabel {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* Remarques */
.book-remarques {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(197,165,90,0.06);
    border-left: 3px solid var(--gold);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.88rem;
    font-style: italic;
    color: var(--text-light);
}

.book-remarques::before {
    content: 'Note : ';
    font-weight: 600;
    font-style: normal;
    color: var(--gold-dark);
}

/* Edit button on book page */
.book-edit-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid rgba(58,37,32,0.12);
    border-radius: var(--radius);
    padding: 0.3rem 0.65rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.book-edit-btn:hover {
    color: var(--burgundy);
    border-color: var(--burgundy);
    background: rgba(107,29,42,0.04);
}

/* ── Navigation Arrows ──────────────────────────────────────────── */
.book-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dotted rgba(197,165,90,0.25);
}

.book-nav-arrow {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--burgundy);
    background: none;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    opacity: 0.7;
}

.book-nav-arrow:hover {
    opacity: 1;
    background: rgba(107,29,42,0.05);
}

.book-nav-arrow:disabled {
    opacity: 0.25;
    cursor: default;
    background: none;
}

.book-nav-arrow .arrow {
    font-size: 1.4rem;
    line-height: 1;
}

.book-nav-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.book-nav-input {
    width: 60px;
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text);
    background: transparent;
    border: none;
    border-bottom: 1.5px solid rgba(58,37,32,0.15);
    padding: 0.2rem;
    outline: none;
}

.book-nav-input:focus {
    border-bottom-color: var(--burgundy);
}

.book-nav-total {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── Search Overlay ─────────────────────────────────────────────── */
.search-toggle {
    position: absolute;
    top: 1.25rem;
    right: 6rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid rgba(58,37,32,0.12);
    border-radius: var(--radius);
    padding: 0.3rem 0.65rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.search-toggle:hover {
    color: var(--burgundy);
    border-color: var(--burgundy);
    background: rgba(107,29,42,0.04);
}

.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(58,37,32,0.6);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.search-box {
    width: 90%;
    max-width: 500px;
    background: var(--ivory);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(58,37,32,0.08);
}

.search-input-icon {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.search-input {
    flex: 1;
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: var(--text);
    background: transparent;
    border: none;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-close {
    font-size: 0.9rem;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.3rem;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(58,37,32,0.04);
}

.search-result-item:hover {
    background: rgba(107,29,42,0.04);
}

.search-result-num {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gold-dark);
    min-width: 40px;
}

.search-result-name {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--burgundy);
}

.search-result-detail {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
}

.search-no-results {
    padding: 2rem;
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text-muted);
}


/* ═══════════════════════════════════════════════════════════════════
   MEMBER LIST VIEW
   ═══════════════════════════════════════════════════════════════════ */

.list-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.list-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--burgundy);
}

.list-search {
    flex: 1;
    max-width: 300px;
    min-width: 200px;
}

.list-search input {
    width: 100%;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text);
    background: var(--ivory);
    border: 1.5px solid rgba(58,37,32,0.12);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    outline: none;
    transition: border-color 0.2s;
}

.list-search input:focus {
    border-color: var(--burgundy);
}

.list-actions {
    display: flex;
    gap: 0.5rem;
}

/* Table styling */
.member-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--ivory);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.member-table thead {
    background: var(--burgundy);
    color: var(--white);
}

.member-table th {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.65rem 0.75rem;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.member-table th:hover {
    background: var(--burgundy-light);
}

.member-table th .sort-arrow {
    opacity: 0.5;
    margin-left: 0.25rem;
}

.member-table th.sorted .sort-arrow {
    opacity: 1;
}

.member-table td {
    font-family: var(--font-ui);
    font-size: 0.88rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(58,37,32,0.06);
    color: var(--text);
}

.member-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.member-table tbody tr:hover {
    background: rgba(107,29,42,0.03);
}

.member-table tbody tr.deceased-row {
    color: var(--text-muted);
}

.member-table .col-num {
    font-weight: 600;
    color: var(--gold-dark);
    width: 60px;
}

.member-table .col-name {
    font-family: var(--font-display);
    font-weight: 500;
    color: var(--burgundy);
}

.member-table .col-vulgo {
    font-style: italic;
    color: var(--text-light);
}

.list-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.list-pagination button {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--burgundy);
    background: var(--ivory);
    border: 1px solid rgba(107,29,42,0.2);
    border-radius: var(--radius);
    padding: 0.35rem 0.65rem;
    transition: all 0.15s;
}

.list-pagination button:hover:not(:disabled) {
    background: var(--burgundy);
    color: var(--white);
}

.list-pagination button:disabled {
    opacity: 0.3;
    cursor: default;
}


/* ═══════════════════════════════════════════════════════════════════
   EDIT FORM
   ═══════════════════════════════════════════════════════════════════ */

.edit-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.edit-card {
    background: var(--ivory);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
}

.edit-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--burgundy);
    margin-bottom: 0.25rem;
}

.edit-subtitle {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.edit-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.edit-field {
    display: flex;
    flex-direction: column;
}

.edit-field.full-width {
    grid-column: 1 / -1;
}

.edit-field label {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 0.3rem;
}

.edit-field input,
.edit-field textarea,
.edit-field select {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text);
    background: transparent;
    border: none;
    border-bottom: 1.5px solid rgba(58,37,32,0.12);
    padding: 0.45rem 0;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

.edit-field input:focus,
.edit-field textarea:focus {
    border-bottom-color: var(--burgundy);
}

.edit-field textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
    border: 1.5px solid rgba(58,37,32,0.12);
    border-radius: var(--radius);
    padding: 0.5rem;
}

.edit-field textarea:focus {
    border-color: var(--burgundy);
}

.edit-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

.edit-feedback {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.edit-feedback.success {
    background: rgba(45,107,63,0.08);
    color: var(--success);
    border: 1px solid rgba(45,107,63,0.15);
}

.edit-feedback.error {
    background: rgba(160,48,48,0.08);
    color: var(--danger);
    border: 1px solid rgba(160,48,48,0.15);
}


/* ═══════════════════════════════════════════════════════════════════
   ADMIN PANELS
   ═══════════════════════════════════════════════════════════════════ */

.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.admin-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--burgundy);
    margin-bottom: 1.5rem;
}

/* Tab bar */
.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid rgba(58,37,32,0.1);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.admin-tab {
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    padding: 0.65rem 1.1rem;
    position: relative;
    white-space: nowrap;
    transition: color 0.2s;
}

.admin-tab:hover {
    color: var(--text);
}

.admin-tab.active {
    color: var(--burgundy);
    font-weight: 600;
}

.admin-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--burgundy);
}

.admin-panel {
    background: var(--ivory);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.admin-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.admin-panel-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--brown);
}

/* Change requests */
.change-card {
    background: var(--white);
    border: 1px solid rgba(58,37,32,0.08);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.change-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.change-member {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--burgundy);
}

.change-meta {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.change-diff {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.change-diff-col {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    padding: 0.65rem;
    border-radius: var(--radius);
}

.change-diff-col.old {
    background: rgba(160,48,48,0.05);
    border: 1px solid rgba(160,48,48,0.12);
}

.change-diff-col.new {
    background: rgba(45,107,63,0.05);
    border: 1px solid rgba(45,107,63,0.12);
}

.change-diff-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

.change-diff-field {
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.change-diff-value {
    color: var(--text);
    white-space: pre-line;
    word-break: break-word;
}

.change-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Admin tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 2px solid rgba(58,37,32,0.08);
}

.admin-table td {
    font-family: var(--font-ui);
    font-size: 0.88rem;
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid rgba(58,37,32,0.05);
    color: var(--text);
}

.admin-table tbody tr:hover {
    background: rgba(107,29,42,0.02);
}

.role-badge {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

.role-badge.editor {
    background: rgba(107,29,42,0.1);
    color: var(--burgundy);
}

.role-badge.member {
    background: rgba(197,165,90,0.15);
    color: var(--gold-dark);
}

.role-badge.reader {
    background: rgba(58,37,32,0.06);
    color: var(--text-light);
}

/* Add user form inline */
.add-user-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 1rem;
    background: rgba(58,37,32,0.02);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.add-user-form .form-group {
    flex: 1;
    min-width: 140px;
}

.add-user-form .form-group label {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.2rem;
}

.add-user-form .form-group input,
.add-user-form .form-group select {
    width: 100%;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text);
    background: var(--white);
    border: 1px solid rgba(58,37,32,0.12);
    border-radius: var(--radius);
    padding: 0.4rem 0.5rem;
    outline: none;
}

.add-user-form .form-group input:focus,
.add-user-form .form-group select:focus {
    border-color: var(--burgundy);
}

/* Audit log */
.audit-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.audit-filters select,
.audit-filters input {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text);
    background: var(--white);
    border: 1px solid rgba(58,37,32,0.12);
    border-radius: var(--radius);
    padding: 0.4rem 0.5rem;
    outline: none;
}

/* Backups */
.backup-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0;
    border-bottom: 1px solid rgba(58,37,32,0.05);
    font-family: var(--font-ui);
    font-size: 0.88rem;
}

.backup-date {
    color: var(--text);
    font-weight: 500;
}

.backup-size {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Email panel */
.email-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.email-stats {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}


/* ═══════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════ */

/* Loading spinner */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    gap: 0.75rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(107,29,42,0.15);
    border-top-color: var(--burgundy);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 5000;
    animation: slideUp 0.3s ease;
    max-width: 400px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast.success {
    background: var(--success);
    color: var(--white);
}

.toast.error {
    background: var(--danger);
    color: var(--white);
}

.toast.info {
    background: var(--burgundy);
    color: var(--white);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

.empty-state-text {
    font-family: var(--font-ui);
    font-size: 0.95rem;
}


/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .nav-inner {
        padding: 0 0.75rem;
    }

    .nav-brand {
        font-size: 1.05rem;
    }

    .nav-links {
        margin-left: 0.5rem;
        gap: 0;
    }

    .nav-link {
        font-size: 0.8rem;
        padding: 0.35rem 0.5rem;
    }

    .nav-link .nav-icon {
        display: none;
    }

    .nav-user {
        display: none;
    }

    .book-page {
        padding: 2rem 1.5rem 2rem 2rem;
        margin: 0 0.25rem;
        min-height: auto;
    }

    .book-name {
        font-size: 1.5rem;
    }

    .book-vulgo {
        font-size: 1rem;
    }

    .book-cursus {
        font-size: 0.9rem;
        text-align: left;
    }

    .book-edit-btn {
        top: 0.75rem;
        right: 0.75rem;
        font-size: 0.75rem;
    }

    .search-toggle {
        top: 0.75rem;
        right: 4rem;
        font-size: 0.75rem;
    }

    .edit-row {
        grid-template-columns: 1fr;
    }

    .change-diff {
        grid-template-columns: 1fr;
    }

    .list-header {
        flex-direction: column;
        align-items: stretch;
    }

    .list-search {
        max-width: 100%;
    }

    .member-table {
        font-size: 0.82rem;
    }

    .member-table th,
    .member-table td {
        padding: 0.45rem 0.5rem;
    }

    .admin-tabs {
        gap: 0;
    }

    .admin-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.82rem;
    }

    .add-user-form {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .book-container {
        padding: 1rem 0.25rem;
    }

    .book-page {
        padding: 1.5rem 1rem 1.5rem 1.5rem;
        border-radius: 0;
    }

    .book-page::before {
        width: 12px;
    }

    .book-name {
        font-size: 1.3rem;
    }

    .book-extras {
        flex-direction: column;
        gap: 0.25rem;
    }

    .book-nav-arrow span:not(.arrow) {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   Export Panel
   ═══════════════════════════════════════════════════════════════════ */

.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.export-card {
    background: #fff;
    border: 1px solid #e0d5c5;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.export-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(107, 29, 42, 0.1);
}

.export-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.export-card h3 {
    font-family: 'Playfair Display', Georgia, serif;
    color: #6B1D2A;
    margin: 0 0 0.5rem;
    font-size: 1.3rem;
}

.export-card p {
    color: #666;
    font-size: 0.9rem;
    margin: 0 0 1.5rem;
    line-height: 1.4;
}

.export-card .btn-primary {
    display: inline-block;
    width: auto;
    padding: 0.6rem 1.5rem;
}
