/* ==========================================================================
   iStudy12 Pure Apple Cupertino Design System (Light & Dark Mode)
   ========================================================================== */

:root {
    --apple-bg: #ffffff;
    --apple-page-bg: #f5f5f7;
    --apple-card: #ffffff;
    --apple-card-alt: #fbfbfd;
    --apple-pill: #f2f2f7;
    --apple-pill-hover: #e5e5ea;
    --apple-border: rgba(0, 0, 0, 0.08);
    --apple-border-strong: rgba(0, 0, 0, 0.14);
    --apple-text: #1d1d1f;
    --apple-subtext: #6e6e73;
    --apple-blue: #0071e3;
    --apple-blue-hover: #0077ed;
    --apple-nav-bg: rgba(255, 255, 255, 0.84);
    --apple-mint-tint: #eefaf6;
    --apple-blue-tint: #eef6ff;
    --apple-shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.04);
    --apple-shadow-md: 0 12px 32px rgba(0, 0, 0, 0.08);
    color-scheme: light;
}

html.dark {
    --apple-bg: #000000;
    --apple-page-bg: #03050a;
    --apple-card: #141720;
    --apple-card-alt: #1c1f2b;
    --apple-pill: #1f2433;
    --apple-pill-hover: #2a3044;
    --apple-border: rgba(255, 255, 255, 0.10);
    --apple-border-strong: rgba(255, 255, 255, 0.18);
    --apple-text: #f5f5f7;
    --apple-subtext: #a1a1aa;
    --apple-blue: #2aa0ff;
    --apple-blue-hover: #47b0ff;
    --apple-nav-bg: rgba(10, 13, 22, 0.82);
    --apple-mint-tint: rgba(16, 185, 129, 0.06);
    --apple-blue-tint: rgba(42, 160, 255, 0.07);
    --apple-shadow-sm: 0 2px 14px rgba(0, 0, 0, 0.35);
    --apple-shadow-md: 0 16px 40px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', system-ui, sans-serif;
    background-color: var(--apple-bg);
    color: var(--apple-text);
    transition: background-color 0.25s ease, color 0.25s ease;
}

.apple-surface {
    background-color: var(--apple-card);
    border-color: var(--apple-border);
    box-shadow: var(--apple-shadow-sm);
}

.apple-page-surface {
    background-color: var(--apple-page-bg);
}

.glass-nav {
    background: var(--apple-nav-bg) !important;
    backdrop-filter: saturate(180%) blur(20px) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px) !important;
    border-color: var(--apple-border) !important;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Custom Sleek Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 140, 0.28);
    border-radius: 9999px;
}

/* Marquee Animation for PG-Style Feature Strip */
@keyframes lp-marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.lp-marquee-track {
    display: flex;
    width: max-content;
    animation: lp-marquee 32s linear infinite;
}
.lp-marquee-track:hover {
    animation-play-state: paused;
}

/* ==========================================================================
   Universal Seamless Dark Mode Adaptation for Existing Apple UI Pages
   ========================================================================== */
html.dark body {
    background-color: #03050a !important;
    color: #f5f5f7 !important;
}

html.dark .bg-white:not(.keep-light),
html.dark .bg-\[\#ffffff\],
html.dark .bg-\[\#fbfbfd\],
html.dark .bg-apple-card {
    background-color: #141720 !important;
    color: #f5f5f7;
}

html.dark .bg-\[\#F8FAFC\],
html.dark .bg-\[\#f8fafc\],
html.dark .bg-\[\#f5f5f7\],
html.dark .bg-slate-50,
html.dark .bg-slate-50\/80,
html.dark .bg-slate-50\/60,
html.dark .bg-gray-50 {
    background-color: #0b0e16 !important;
}

html.dark .bg-apple-gray,
html.dark .bg-apple-gray\/60,
html.dark .bg-apple-gray\/40,
html.dark .bg-apple-gray\/30,
html.dark .bg-apple-gray\/20,
html.dark .bg-slate-100,
html.dark .bg-slate-200\/60 {
    background-color: #1d2230 !important;
}

html.dark .text-apple-text,
html.dark .text-gray-900,
html.dark .text-slate-900,
html.dark .text-slate-800 {
    color: #f5f5f7 !important;
}

html.dark .text-apple-subtext,
html.dark .text-slate-700,
html.dark .text-slate-600,
html.dark .text-slate-500,
html.dark .text-gray-600,
html.dark .text-gray-500 {
    color: #a1a1aa !important;
}

/* Preserve white text on colored/dark gradient backgrounds */
html.dark .bg-gradient-to-r,
html.dark .bg-gradient-to-br,
html.dark .bg-\[\#0b2e46\] {
    color: #ffffff;
}
html.dark .bg-gradient-to-r .text-white,
html.dark .bg-gradient-to-br .text-white {
    color: #ffffff !important;
}

/* Crisp Hairline Borders in Dark Mode */
html.dark .border-black\/5,
html.dark .border-black\/\[0\.05\],
html.dark .border-black\/\[0\.06\],
html.dark .border-black\/\[0\.08\],
html.dark .border-black\/10,
html.dark .border-black\/15,
html.dark .border-slate-200,
html.dark .border-gray-200 {
    border-color: rgba(255, 255, 255, 0.11) !important;
}

html.dark .divide-black\/5 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-black\/10 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]) {
    border-color: rgba(255, 255, 255, 0.09) !important;
}

/* Dark Mode Form Inputs & Selects */
html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
html.dark select,
html.dark textarea {
    background-color: #191e2b !important;
    color: #f5f5f7 !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
}
html.dark input::placeholder,
html.dark textarea::placeholder {
    color: #71717a !important;
}

/* Tinted Badges & Soft Pills in Dark Mode */
html.dark .bg-blue-50,
html.dark .bg-sky-50 {
    background-color: rgba(42, 160, 255, 0.15) !important;
}
html.dark .bg-emerald-50 {
    background-color: rgba(16, 185, 129, 0.15) !important;
}
html.dark .bg-amber-50 {
    background-color: rgba(245, 158, 11, 0.15) !important;
}
html.dark .bg-rose-50 {
    background-color: rgba(244, 63, 94, 0.15) !important;
}
html.dark .bg-purple-50,
html.dark .bg-purple-50\/50 {
    background-color: rgba(168, 85, 247, 0.15) !important;
}
html.dark .text-sky-600,
html.dark .text-sky-700,
html.dark .text-apple-blue {
    color: #38bdf8 !important;
}
html.dark .text-emerald-700,
html.dark .text-emerald-600 {
    color: #34d399 !important;
}
html.dark .text-amber-700,
html.dark .text-amber-800 {
    color: #fbbf24 !important;
}
html.dark .text-rose-600,
html.dark .text-rose-700,
html.dark .text-rose-800 {
    color: #fb7185 !important;
}
html.dark .text-purple-700,
html.dark .text-purple-950 {
    color: #c084fc !important;
}

/* Hover States in Dark Mode */
html.dark .hover\:bg-apple-gray:hover,
html.dark .hover\:bg-slate-50:hover,
html.dark .hover\:bg-slate-100:hover,
html.dark .hover\:bg-black\/10:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

/* Tables in Dark Mode */
html.dark table thead tr {
    background-color: #1a1f2c !important;
}
html.dark table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
}
