/* =====================================================================
   Bharatiya Vidyacharcha — Main Stylesheet
   Uses TailwindCSS Play CDN + Custom CSS
   ===================================================================== */

/* ── Root Variables ─────────────────────────────────────────────────── */
:root {
    --color-primary: #6B1E1E;
    --color-secondary: #C17F24;
    --color-accent: #E8873A;
    --color-cream: #FDF6EC;
    --color-border: #D4A96A;
    --font-display: 'Cinzel Decorative', serif;
    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 0.75rem;
    --shadow-glow: 0 0 30px -5px rgba(193, 127, 36, 0.4);
}

/* ── Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background-color: var(--color-cream); }

img { max-width: 100%; height: auto; }

/* ── Typography ─────────────────────────────────────────────────────── */
.font-display { font-family: var(--font-display); }
.font-heading  { font-family: var(--font-heading); }

/* ── Animations ─────────────────────────────────────────────────────── */
@keyframes spin-slow        { from { transform: rotate(0deg); }   to { transform: rotate(360deg); } }
@keyframes spin-slow-reverse{ from { transform: rotate(0deg); }   to { transform: rotate(-360deg); } }
@keyframes slide-in-right   { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fade-in-up       { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulse-glow       { 0%,100% { box-shadow: 0 0 0 0 rgba(193,127,36,0); } 50% { box-shadow: 0 0 20px 4px rgba(193,127,36,0.25); } }

.animate-spin-slow         { animation: spin-slow 40s linear infinite; }
.animate-spin-slow-reverse { animation: spin-slow-reverse 35s linear infinite; }
.animate-slide-in-right    { animation: slide-in-right 0.4s ease-out both; }
.animate-fade-in-up        { animation: fade-in-up 0.5s ease-out both; }
.animate-pulse-glow        { animation: pulse-glow 2s ease-in-out infinite; }

/* ── Custom Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: #f5e8d0; }
::-webkit-scrollbar-thumb  { background: #C17F24; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #6B1E1E; }

/* ── Selection ──────────────────────────────────────────────────────── */
::selection { background: rgba(193,127,36,0.25); color: #3c1515; }

/* ── Utility Classes ────────────────────────────────────────────────── */
.container { max-width: 1280px; margin-left: auto; margin-right: auto; }
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: var(--color-primary); color: #fde68a;
    padding: 0.625rem 1.25rem; border-radius: var(--radius);
    font-size: 0.875rem; font-weight: 600;
    transition: all var(--transition); border: none; cursor: pointer;
}
.btn-primary:hover { background: #5a1919; box-shadow: var(--shadow-glow); }

.btn-primary-lg {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: #f59e0b; color: var(--color-primary);
    padding: 0.875rem 2rem; border-radius: 1rem;
    font-size: 1rem; font-weight: 700;
    transition: all var(--transition); border: none; cursor: pointer;
    box-shadow: 0 4px 20px rgba(245,158,11,0.3);
}
.btn-primary-lg:hover { background: #fbbf24; transform: translateY(-2px); }

.btn-ghost-lg {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: rgba(255,255,255,0.1); color: white;
    padding: 0.875rem 2rem; border-radius: 1rem;
    font-size: 1rem; font-weight: 600;
    transition: all var(--transition);
    border: 2px solid rgba(255,255,255,0.3); cursor: pointer;
}
.btn-ghost-lg:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.5); }

.btn-outline-primary {
    display: inline-flex; align-items: center; gap: 0.5rem;
    border: 2px solid var(--color-primary); color: var(--color-primary);
    padding: 0.75rem 1.75rem; border-radius: var(--radius);
    font-size: 0.875rem; font-weight: 600;
    transition: all var(--transition); background: transparent; cursor: pointer;
}
.btn-outline-primary:hover { background: var(--color-primary); color: #fde68a; }

.btn-amber-outline {
    display: inline-flex; align-items: center; gap: 0.5rem;
    border: 2px solid rgba(245,158,11,0.4); color: #fcd34d;
    padding: 0.75rem 1.75rem; border-radius: var(--radius);
    font-size: 0.875rem; font-weight: 600;
    transition: all var(--transition); background: transparent; cursor: pointer;
}
.btn-amber-outline:hover { border-color: #fbbf24; color: white; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge-featured  { display: inline-flex; align-items: center; background: rgba(107,30,30,0.9); color: #fde68a; font-size: 0.6rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 99px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.badge-bestseller{ display: inline-flex; align-items: center; background: rgba(180,83,9,0.9); color: white; font-size: 0.6rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 99px; }
.badge-new       { display: inline-flex; align-items: center; background: rgba(5,150,105,0.9); color: white; font-size: 0.6rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 99px; }
.badge-discount  { display: inline-flex; align-items: center; background: rgba(220,38,38,0.9); color: white; font-size: 0.6rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 99px; }

/* ── Form Inputs ─────────────────────────────────────────────────────── */
.form-input, .form-select, .form-textarea {
    display: block; width: 100%;
    padding: 0.5rem 0.75rem; border-radius: var(--radius);
    border: 1.5px solid #e5c987;
    background: white; color: #2c1810;
    font-size: 0.875rem; font-family: var(--font-body);
    transition: all var(--transition); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(107,30,30,0.1);
}
.form-input::placeholder { color: #a9927d; }
.form-label { display: block; font-size: 0.8125rem; font-weight: 600; color: #3c1515; margin-bottom: 0.35rem; }
.form-error { color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem; }

/* ── Cards ───────────────────────────────────────────────────────────── */
.card { background: white; border: 1px solid #fde68a33; border-radius: 1rem; overflow: hidden; }
.card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid #fef3c7; background: linear-gradient(to right, #fffbeb, white); }

/* ── Pagination ──────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 2rem; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2.5rem; height: 2.5rem; border-radius: 0.5rem;
    font-size: 0.875rem; font-weight: 500; transition: all var(--transition);
    border: 1.5px solid #e5c987; color: #5c3317;
}
.pagination a:hover { background: var(--color-primary); color: #fde68a; border-color: var(--color-primary); }
.pagination .active { background: var(--color-primary); color: #fde68a; border-color: var(--color-primary); font-weight: 700; }
.pagination .disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ── Toast / Alert ───────────────────────────────────────────────────── */
.toast { position: fixed; top: 5rem; right: 1rem; z-index: 9999; max-width: 22rem; width: calc(100% - 2rem); }

/* ── Table ───────────────────────────────────────────────────────────── */
.table-bvc { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-bvc th {
    background: linear-gradient(to right, #7f1d1d, #92400e);
    color: #fde68a; font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.875rem 1rem; text-align: left;
}
.table-bvc th:first-child { border-radius: 0.75rem 0 0 0; }
.table-bvc th:last-child  { border-radius: 0 0.75rem 0 0; }
.table-bvc td { padding: 0.875rem 1rem; font-size: 0.875rem; border-bottom: 1px solid #fef3c7; }
.table-bvc tr:last-child td { border-bottom: none; }
.table-bvc tr:hover td { background: #fffbeb; }
.table-bvc tr:last-child td:first-child { border-radius: 0 0 0 0.75rem; }
.table-bvc tr:last-child td:last-child  { border-radius: 0 0 0.75rem 0; }

/* ── Status Pills ─────────────────────────────────────────────────────── */
.pill-pending   { background: #fef3c7; color: #92400e; }
.pill-active, .pill-confirmed, .pill-published, .pill-delivered { background: #d1fae5; color: #065f46; }
.pill-inactive, .pill-cancelled, .pill-draft { background: #fee2e2; color: #7f1d1d; }
.pill-processing, .pill-in_progress { background: #dbeafe; color: #1e3a8a; }
.pill-shipped   { background: #ede9fe; color: #3730a3; }
.pill-paid      { background: #d1fae5; color: #065f46; }
.pill-unpaid    { background: #fee2e2; color: #7f1d1d; }
.status-pill    { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.2rem 0.625rem; border-radius: 99px; font-size: 0.7rem; font-weight: 600; white-space: nowrap; }

/* ── Quiz ────────────────────────────────────────────────────────────── */
.quiz-option { display: flex; align-items: flex-start; gap: 0.75rem; padding: 1rem; border: 2px solid #e5c987; border-radius: var(--radius); cursor: pointer; transition: all var(--transition); }
.quiz-option:hover { border-color: var(--color-primary); background: #fdf2f2; }
.quiz-option.selected { border-color: var(--color-primary); background: #fdf2f2; }
.quiz-option.correct  { border-color: #059669; background: #d1fae5; }
.quiz-option.wrong    { border-color: #dc2626; background: #fee2e2; }
.quiz-timer { font-variant-numeric: tabular-nums; font-family: 'Courier New', monospace; }
.quiz-timer.danger { color: #dc2626; animation: pulse-glow 1s ease-in-out infinite; }

/* ── Dashboard Sidebar ───────────────────────────────────────────────── */
.sidebar-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem; border-radius: 0.625rem;
    font-size: 0.875rem; font-weight: 500; color: #5c3317;
    transition: all var(--transition);
}
.sidebar-link:hover, .sidebar-link.active {
    background: var(--color-primary); color: #fde68a;
}
.sidebar-link .icon-wrap { width: 1.25rem; text-align: center; }

/* ── Admin Panel ─────────────────────────────────────────────────────── */
.admin-sidebar { width: 260px; flex-shrink: 0; background: linear-gradient(160deg, #1a0a00 0%, #2d1000 50%, #1a0a00 100%); }
.admin-nav-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 1.25rem; font-size: 0.8125rem; font-weight: 500;
    color: rgba(253,230,138,0.65); border-radius: 0.5rem; margin: 0 0.5rem;
    transition: all 0.2s;
}
.admin-nav-link:hover { background: rgba(255,255,255,0.08); color: #fde68a; }
.admin-nav-link.active { background: rgba(193,127,36,0.2); color: #fde68a; border-left: 3px solid #C17F24; }
.admin-nav-group { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(253,230,138,0.3); padding: 1rem 1.75rem 0.4rem; }

.admin-content { flex: 1; min-height: 100vh; background: #f5e8d0; }
.admin-card { background: white; border-radius: 1rem; border: 1px solid #fef3c7; box-shadow: 0 1px 6px rgba(107,30,30,0.06); }
.admin-card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid #fef3c7; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.admin-card-body { padding: 1.5rem; }

.stat-card { background: white; border-radius: 1rem; border: 1px solid #fef3c7; padding: 1.25rem 1.5rem; display: flex; align-items: center; gap: 1rem; box-shadow: 0 1px 6px rgba(107,30,30,0.06); }
.stat-card .stat-icon { width: 3rem; height: 3rem; border-radius: 0.75rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1.25rem; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 800; font-family: var(--font-heading); color: var(--color-primary); line-height: 1; }
.stat-card .stat-label { font-size: 0.75rem; color: #6b5b4e; font-weight: 500; margin-top: 0.2rem; }

/* ── Responsive Overrides ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-sidebar { display: none; }
    .admin-sidebar.open { display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: 240px; }
}

/* ── Print Invoice ───────────────────────────────────────────────────── */
@media print {
    header, footer, nav, .no-print { display: none !important; }
    body { background: white; font-size: 12px; }
    .container { max-width: 100%; }
}
