@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

* {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ====== GLASSMORPHISM UTILITIES ====== */
.glass {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.glass-card {
    background: rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

/* ====== GRADIENT ACCENTS ====== */
.gradient-brand {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
}
.gradient-brand-subtle {
    background: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(139,92,246,0.08) 100%);
}
.gradient-text {
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.gradient-border {
    position: relative;
}
.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(139,92,246,0.1), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* ====== BUTTONS ====== */
.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);
    transform: translateY(-1px);
}
.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}
.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ====== BOOK CARDS ====== */
.book-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}
.book-card:hover {
    transform: translateY(-6px) scale(1.02);
}
.book-card .card-image {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s ease;
}
.book-card:hover .card-image {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.05);
}
.book-card .card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 40%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
}
.book-card:hover .card-overlay {
    opacity: 1;
}
.book-thumbnail {
    aspect-ratio: 2 / 3;
    object-fit: cover;
    width: 100%;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.book-card:hover .book-thumbnail {
    transform: scale(1.05);
}

/* ====== PROGRESS BAR ====== */
.progress-bar {
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
}
.progress-bar.completed {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

/* ====== TOASTS ====== */
.toast-enter { animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.toast-exit { animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards; }
@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}

/* ====== STAR RATING ====== */
.star-rating .star {
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 1.5rem;
}
.star-rating .star:hover { transform: scale(1.2); }
.star-rating .star.active { color: #f59e0b; }
.star-rating:hover .star { color: #374151; }
.star-rating .star:hover,
.star-rating .star:hover ~ .star { color: #374151; }
.star-rating:hover .star:hover,
.star-rating:hover .star:hover ~ .star { color: #374151; }

/* Reverse sibling hover for left-to-right fill */
.star-rating { direction: rtl; display: inline-flex; }
.star-rating .star { direction: ltr; }

/* ====== DRAG & DROP ====== */
.drop-zone {
    transition: all 0.3s ease;
    border: 2px dashed rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.015);
}
.drop-zone:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.03);
}
.drop-zone.drag-over {
    border-color: rgba(99, 102, 241, 0.6);
    background: rgba(99, 102, 241, 0.06);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.1);
}

/* ====== MODALS ====== */
.modal-backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.modal-content {
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes modalIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* ====== ANIMATIONS ====== */
.fade-in { animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.stagger-in { opacity: 0; animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* ====== INPUTS ====== */
.input-field {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    outline: none;
    width: 100%;
}
.input-field::placeholder { color: rgba(255,255,255,0.25); }
.input-field:hover { border-color: rgba(255,255,255,0.15); }
.input-field:focus {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

/* ====== STAT CARD ====== */
.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 100px; height: 100px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.15;
    transition: opacity 0.3s ease;
}
.stat-card:hover::before { opacity: 0.25; }
.stat-card:hover { border-color: rgba(255,255,255,0.1); transform: translateY(-2px); }
.stat-card.blue::before { background: #6366f1; }
.stat-card.green::before { background: #22c55e; }
.stat-card.purple::before { background: #a855f7; }
.stat-card.rose::before { background: #f43f5e; }

/* ====== SECTION HEADERS ====== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.section-header a {
    font-size: 0.8125rem;
    color: rgba(129, 140, 248, 0.8);
    transition: color 0.2s;
}
.section-header a:hover { color: #818cf8; }

/* ====== ANIMATED BG (auth pages) ====== */
.auth-bg {
    background: #09090b;
    position: relative;
    overflow: hidden;
}
.auth-bg::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    top: -200px; right: -200px;
    background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
    animation: authGlow 8s ease-in-out infinite alternate;
}
.auth-bg::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    bottom: -150px; left: -150px;
    background: radial-gradient(circle, rgba(139,92,246,0.1) 0%, transparent 70%);
    animation: authGlow 10s ease-in-out infinite alternate-reverse;
}
@keyframes authGlow {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(30px, -20px) scale(1.1); }
}

/* ====== NAV GLASS ====== */
.nav-glass {
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ====== MISC ====== */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.text-balance { text-wrap: balance; }

/* Light mode overrides */
html:not(.dark) .glass { background: rgba(255,255,255,0.7); border-color: rgba(0,0,0,0.06); }
html:not(.dark) .glass-card { background: rgba(255,255,255,0.6); border-color: rgba(0,0,0,0.06); }
html:not(.dark) .nav-glass { background: rgba(255,255,255,0.85); border-bottom-color: rgba(0,0,0,0.06); }
html:not(.dark) .input-field { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.1); color: #111; }
html:not(.dark) .input-field::placeholder { color: rgba(0,0,0,0.35); }
html:not(.dark) .input-field:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
html:not(.dark) .stat-card { background: rgba(255,255,255,0.8); border-color: rgba(0,0,0,0.06); }
html:not(.dark) .drop-zone { border-color: rgba(0,0,0,0.12); background: rgba(0,0,0,0.015); }
html:not(.dark) .book-card .card-image { box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
