@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;500;600;700;800&display=swap');

:root {
    --primary:    #FF6B6B;
    --secondary:  #FFD166;
    --accent:     #06D6A0;
    --purple:     #9B5DE5;
    --blue:       #4CC9F0;
    --dark:       #2D2D44;
    --light:      #FFF9F0;
    --white:      #FFFFFF;
    --gray:       #8A8A9A;
    --card-shadow: 0 8px 30px rgba(0,0,0,0.10);
    --radius:     20px;
    --radius-sm:  12px;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: var(--light);
    color: var(--dark);
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255,107,107,0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(76,201,240,0.08) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(255,209,102,0.05) 0%, transparent 60%);
}

/* ── Typography ─────────────────────────────────── */
h1, h2, h3, .brand {
    font-family: 'Fredoka One', cursive;
    letter-spacing: 0.5px;
}

/* ── Nav ─────────────────────────────────────────── */
.navbar {
    background: var(--white);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 4px solid var(--secondary);
}

.navbar .brand {
    font-size: 1.6rem;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar .brand .emoji { font-size: 1.8rem; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 50px;
    transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    background: var(--light);
    color: var(--primary);
}

.avatar-badge {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    color: white;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    text-decoration: none;
}

/* ── Layout ──────────────────────────────────────── */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 20px;
}

.container-sm {
    max-width: 480px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* ── Cards ───────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 28px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: 1.5rem;
    color: var(--dark);
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.btn:active { transform: translateY(0); }

.btn-primary { background: linear-gradient(135deg,var(--primary),#FF8E53); color: white; }
.btn-success { background: linear-gradient(135deg,var(--accent),#00B87C); color: white; }
.btn-warning { background: linear-gradient(135deg,var(--secondary),#FFAB00); color: var(--dark); }
.btn-purple  { background: linear-gradient(135deg,var(--purple),#7B2FBE); color: white; }
.btn-blue    { background: linear-gradient(135deg,var(--blue),#4361EE); color: white; }
.btn-danger  { background: linear-gradient(135deg,#FF6B6B,#C9184A); color: white; }
.btn-ghost   { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-sm      { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg      { padding: 16px 36px; font-size: 1.1rem; }
.btn-block   { width: 100%; justify-content: center; }

/* ── Forms ───────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px 18px;
    border: 2px solid #E8E8F0;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    color: var(--dark);
    background: var(--white);
    transition: border-color 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255,107,107,0.1);
}

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 100px; }

/* ── Status badges ───────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 800;
}

.badge-pending  { background: #FFF3CD; color: #856404; }
.badge-approved { background: #D1FAE5; color: #065F46; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }
.badge-want     { background: #EDE9FE; color: #5B21B6; }
.badge-reading  { background: #DBEAFE; color: #1E40AF; }
.badge-read     { background: #D1FAE5; color: #065F46; }

/* ── Book cards ──────────────────────────────────── */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.book-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: all 0.25s;
    cursor: pointer;
    position: relative;
}

.book-card:hover {
    transform: translateY(-6px) rotate(-1deg);
    box-shadow: 0 16px 40px rgba(0,0,0,0.15);
}

.book-card .cover {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.book-card .cover-placeholder {
    width: 100%;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    background: linear-gradient(135deg, var(--secondary), #FFB347);
}

.book-card .book-info {
    padding: 14px;
}

.book-card .book-title {
    font-weight: 800;
    font-size: 0.9rem;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-card .book-author {
    color: var(--gray);
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.book-card .status-strip {
    position: absolute;
    top: 12px;
    right: 12px;
}

/* ── Hero / login page ───────────────────────────── */
.hero {
    text-align: center;
    padding: 60px 20px 40px;
}

.hero .floating-books {
    font-size: 3rem;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-12px); }
}

.hero h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.hero p {
    font-size: 1.15rem;
    color: var(--gray);
    max-width: 400px;
    margin: 0 auto 30px;
}

/* ── Login card ──────────────────────────────────── */
.login-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 36px;
    border-top: 6px solid var(--primary);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '📚';
    position: absolute;
    font-size: 8rem;
    right: -20px;
    bottom: -20px;
    opacity: 0.06;
}

/* ── Stars & progress ────────────────────────────── */
.stars { color: var(--secondary); font-size: 1.2rem; letter-spacing: 2px; }

.progress-bar {
    background: #E8E8F0;
    border-radius: 50px;
    height: 16px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 50px;
    background: linear-gradient(90deg, var(--accent), var(--blue));
    transition: width 0.6s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ── Stats row ───────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--card-shadow);
    border-bottom: 4px solid var(--primary);
}

.stat-card:nth-child(2) { border-color: var(--blue); }
.stat-card:nth-child(3) { border-color: var(--accent); }
.stat-card:nth-child(4) { border-color: var(--purple); }

.stat-card .stat-number {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: var(--dark);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--gray);
    font-weight: 700;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── Alert ───────────────────────────────────────── */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.alert-success { background: #D1FAE5; color: #065F46; border-left: 4px solid var(--accent); }
.alert-danger  { background: #FEE2E2; color: #991B1B; border-left: 4px solid var(--primary); }
.alert-info    { background: #DBEAFE; color: #1E40AF; border-left: 4px solid var(--blue); }

/* ── Table ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    background: var(--light);
    padding: 12px 16px;
    text-align: left;
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray);
    border-bottom: 2px solid #E8E8F0;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid #F0F0F8;
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFAFA; }

/* ── Modals ──────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0; visibility: hidden;
    transition: all 0.25s;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 30px 80px rgba(0,0,0,0.25);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s;
}

.modal-overlay.active .modal { transform: none; }

.modal-header {
    padding: 24px 28px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.modal-body { padding: 24px 28px; }
.modal-footer {
    padding: 0 28px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-close {
    background: none; border: none; font-size: 1.4rem;
    cursor: pointer; color: var(--gray);
    padding: 4px; line-height: 1;
}

.modal-close:hover { color: var(--dark); }

/* ── Tab navigation ──────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    background: #F0F0F8;
    padding: 6px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: none;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--gray);
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ── Admin sidebar layout ────────────────────────── */
.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 75px);
    gap: 0;
}

.admin-sidebar {
    background: var(--dark);
    padding: 24px 0;
}

.admin-sidebar .brand {
    color: white;
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    padding: 0 20px 20px;
    display: block;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 16px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover, .sidebar-link.active {
    color: white;
    background: rgba(255,255,255,0.07);
    border-left-color: var(--primary);
}

.admin-main { padding: 30px; background: var(--light); }

/* ── Book detail panel ───────────────────────────── */
.book-detail {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.book-detail img {
    width: 130px;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.book-detail .no-cover {
    width: 130px;
    height: 175px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg,var(--secondary),#FFB347);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    flex-shrink: 0;
}

/* ── Fun decorations ─────────────────────────────── */
.page-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    margin-bottom: 6px;
}

.page-subtitle {
    color: var(--gray);
    margin-bottom: 28px;
    font-weight: 600;
}

.emoji-big { font-size: 2rem; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
    .book-detail { flex-direction: column; }
    .stats-row { grid-template-columns: repeat(2,1fr); }
    .navbar { padding: 12px 16px; }
    .hero h1 { font-size: 2.2rem; }
    .book-grid { grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); }
}
