/* ============================================
   Library Management System - Stylesheet
   Theme: Dark editorial / library aesthetic
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
    --bg: #0f0e0d;
    --surface: #1a1917;
    --surface2: #242220;
    --border: #2e2c29;
    --text: #e8e4de;
    --text-muted: #8a8278;
    --accent: #c9a84c;
    --accent-dim: rgba(201,168,76,0.12);
    --green: #4ade80;
    --red: #f87171;
    --radius: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- Typography ---- */
h1, h2, h3 { font-family: 'Playfair Display', serif; font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

/* ---- Layout ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.page-wrap { padding: 40px 0 80px; }

/* ---- Navbar ---- */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    position: sticky; top: 0; z-index: 100;
}
.navbar-inner {
    max-width: 1100px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    height: 60px;
}
.navbar-brand {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem; color: var(--accent);
    text-decoration: none; letter-spacing: 0.02em;
}
.navbar-brand span { color: var(--text-muted); font-size: 0.8rem; margin-left: 6px; font-family: 'DM Sans', sans-serif; }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a {
    color: var(--text-muted); text-decoration: none;
    padding: 6px 14px; border-radius: var(--radius);
    font-size: 0.9rem; transition: all 0.2s;
}
.nav-links a:hover { color: var(--text); background: var(--surface2); }
.nav-links a.active { color: var(--accent); }
.nav-badge {
    background: var(--accent); color: #000;
    font-size: 0.7rem; font-weight: 600;
    padding: 2px 7px; border-radius: 20px;
    margin-left: 4px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif; font-size: 0.88rem; font-weight: 500;
    cursor: pointer; border: none; text-decoration: none;
    transition: all 0.18s; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #d4aa50; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(201,168,76,0.3); }
.btn-danger { background: rgba(248,113,113,0.15); color: var(--red); border: 1px solid rgba(248,113,113,0.3); }
.btn-danger:hover { background: rgba(248,113,113,0.25); }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; }
.btn-full { width: 100%; justify-content: center; }

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

/* ---- Book Grid ---- */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 24px;
}
.book-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.book-cover {
    height: 140px; display: flex; align-items: center; justify-content: center;
    font-family: 'Playfair Display', serif; font-size: 0.85rem;
    color: rgba(0,0,0,0.7); padding: 16px; text-align: center;
    font-weight: 700; line-height: 1.3;
}
.book-info { padding: 14px; }
.book-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-author { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 10px; }
.book-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.badge {
    font-size: 0.72rem; font-weight: 600; padding: 3px 8px;
    border-radius: 20px; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-available { background: rgba(74,222,128,0.15); color: var(--green); }
.badge-unavailable { background: rgba(248,113,113,0.15); color: var(--red); }
.badge-genre { background: var(--accent-dim); color: var(--accent); }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.form-control {
    width: 100%; background: var(--surface2);
    border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); padding: 10px 14px;
    font-family: 'DM Sans', sans-serif; font-size: 0.9rem;
    transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
.form-control option { background: var(--surface2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--surface2); color: var(--text-muted); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 16px; text-align: left; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.88rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ---- Stats Row ---- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.stat-value { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 700; color: var(--accent); }

/* ---- Auth Pages ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-box { width: 100%; max-width: 420px; }
.auth-title { font-size: 1.8rem; margin-bottom: 6px; }
.auth-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 32px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 0.88rem; color: var(--text-muted); }
.auth-switch a { color: var(--accent); text-decoration: none; }

/* ---- Flash Messages ---- */
.flash-msg {
    padding: 12px 18px; border-radius: var(--radius);
    color: #000; font-weight: 500; font-size: 0.88rem;
    margin-bottom: 20px;
}

/* ---- Page Header ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 1.6rem; }
.page-subtitle { color: var(--text-muted); font-size: 0.88rem; margin-top: 2px; font-family: 'DM Sans', sans-serif; }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ---- Divider ---- */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .books-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    h1 { font-size: 1.5rem; }
}
