/* =========================================================
   CIRCLE SIMULATOR - LAYOUT SYSTEM
   Premium Educational Background & Layout
   Holographic Geometry Aesthetic
   ========================================================= */

/* === BACKGROUND SYSTEM === */
.app-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
        linear-gradient(135deg, #F8FAFC 0%, #F5F7FF 40%, #EEF4FF 100%);
    overflow: hidden;
}

.app-background::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -5%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 60%);
    pointer-events: none;
    animation: background-float 12s ease-in-out infinite;
}

.app-background::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -5%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.05) 0%, transparent 60%);
    pointer-events: none;
    animation: background-float 14s ease-in-out infinite reverse;
}

/* Geometry Decorations - Educational Math Theme */
.geo-dot-grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--neutral-300) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0.2;
    pointer-events: none;
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}

/* Geometric Circles - Holographic Rings */
.geo-circle {
    position: absolute;
    border-radius: 50%;
    border: 2px dashed var(--neutral-300);
    pointer-events: none;
    opacity: 0.12;
}

.geo-circle-1 {
    width: 380px;
    height: 380px;
    top: 5%;
    left: 3%;
    border-color: rgba(59, 130, 246, 0.25);
    animation: rotate-slow 40s linear infinite;
}

.geo-circle-2 {
    width: 280px;
    height: 280px;
    bottom: 10%;
    right: 5%;
    border-color: rgba(139, 92, 246, 0.2);
    animation: rotate-slow 50s linear infinite reverse;
}

.geo-circle-3 {
    width: 200px;
    height: 200px;
    top: 45%;
    left: 55%;
    transform: translate(-50%, -50%);
    border-color: rgba(99, 102, 241, 0.18);
    animation: rotate-slow 30s linear infinite;
}

/* Concentric holographic rings */
.geo-circle-rings {
    position: absolute;
    width: 300px;
    height: 300px;
    top: 20%;
    right: 8%;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.1;
    border: 2px solid rgba(59, 130, 246, 0.3);
    box-shadow:
        0 0 0 40px rgba(59, 130, 246, 0.04),
        0 0 0 80px rgba(99, 102, 241, 0.03),
        0 0 0 120px rgba(139, 92, 246, 0.02);
    animation: rotate-slow 60s linear infinite;
}

/* Formula decorations */
.geo-symbol {
    position: absolute;
    font-size: 2.5rem;
    font-weight: var(--font-bold);
    pointer-events: none;
    font-family: var(--font-mono);
    opacity: 0.08;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.geo-symbol-1 {
    top: 12%;
    right: 30%;
    color: var(--primary-500);
    animation: float 6s ease-in-out infinite;
}

.geo-symbol-2 {
    bottom: 20%;
    left: 25%;
    color: var(--accent-500);
    animation: float 7s ease-in-out infinite reverse;
}

.geo-symbol-3 {
    top: 50%;
    right: 45%;
    color: var(--secondary-500);
    animation: float 5s ease-in-out infinite;
}

/* Radius line decoration */
.geo-radius {
    position: absolute;
    top: 8%;
    left: 12%;
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.2), transparent);
    transform: rotate(-30deg);
    pointer-events: none;
    opacity: 0.5;
}

.geo-radius::after {
    content: 'r';
    position: absolute;
    right: -20px;
    top: -12px;
    font-family: var(--font-mono);
    font-size: 1.25rem;
    color: rgba(59, 130, 246, 0.3);
}

/* Arc decorations */
.geo-arc {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 3px dashed rgba(59, 130, 246, 0.06);
    border-radius: 50%;
    border-bottom-color: transparent;
    border-left-color: transparent;
    pointer-events: none;
}

.geo-arc-1 {
    top: 15%;
    right: 15%;
    transform: rotate(45deg);
    border-color: rgba(139, 92, 246, 0.08);
    border-bottom-color: transparent;
    border-left-color: transparent;
    animation: rotate-slow 50s linear infinite;
}

/* === CONTAINER === */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-narrow {
    max-width: var(--container-narrow);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* === FLOATING GLASS NAVIGATION === */
.top-nav {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: var(--container-max);
    z-index: 100;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-3xl);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.08);
    transition: all var(--transition-base);
}

.top-nav.scrolled {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 12px 40px rgba(31, 38, 135, 0.12);
}

.top-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 var(--space-5);
}

.top-nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
    font-family: var(--font-display);
    color: var(--neutral-900);
    letter-spacing: 0.01em;
    transition: color var(--transition-fast);
}

.top-nav-logo:hover {
    color: var(--primary);
}

.top-nav-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--text-lg);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.top-nav-logo-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.3) 50%, transparent 60%);
    animation: shimmer 3s ease-in-out infinite;
}

.top-nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.top-nav-link {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    font-family: var(--font-primary);
    color: var(--neutral-600);
    transition: all var(--transition-fast);
    position: relative;
}

.top-nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 60%;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: transform var(--transition-base);
}

.top-nav-link:hover {
    color: var(--neutral-900);
}

.top-nav-link:hover::after {
    transform: translateX(-50%) scaleX(1);
}

.top-nav-link.active {
    color: var(--primary-600);
    background: var(--primary-50);
}

.top-nav-link.active::after {
    transform: translateX(-50%) scaleX(1);
}

.top-nav-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Mobile Menu Toggle */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    color: var(--neutral-600);
    font-size: 1.25rem;
    transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--neutral-100);
}

/* Sidebar Collapse Toggle Button (Desktop) */
.sidebar-toggle-btn {
    display: flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    color: var(--neutral-500);
    font-size: 0.8rem;
    background: transparent;
    border: 1px solid var(--neutral-200);
    transition: all var(--transition-fast);
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: var(--neutral-100);
    color: var(--neutral-900);
    border-color: var(--primary-300);
}

.sidebar-toggle-icon {
    display: inline-block;
    transition: transform var(--transition-base);
    font-size: 0.7rem;
    line-height: 1;
}

.dark .sidebar-toggle-btn {
    color: #94A3B8;
    border-color: rgba(255, 255, 255, 0.12);
}

.dark .sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #F1F5F9;
    border-color: rgba(96, 165, 250, 0.4);
}

/* === SIDEBAR NAVIGATION === */
.sidebar {
    position: fixed;
    top: 84px;
    left: 16px;
    bottom: 16px;
    width: 260px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-2xl);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.08);
    z-index: 50;
    overflow-y: auto;
    padding: var(--space-4);
    transition: transform var(--transition-base), background var(--transition-base);
}

.sidebar-section {
    margin-bottom: var(--space-6);
}

.sidebar-label {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--neutral-400);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    font-family: var(--font-primary);
    color: var(--neutral-600);
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
}

.sidebar-item:hover {
    background: var(--neutral-100);
    color: var(--neutral-900);
    transform: translateX(2px);
}

.sidebar-item.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sidebar-item.active:hover {
    color: white;
}

.sidebar-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-base);
}

.sidebar-item-badge {
    margin-left: auto;
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--primary-100);
    color: var(--primary-700);
}

/* === MAIN CONTENT === */
.main-content {
    margin-left: 292px;
    margin-top: 84px;
    min-height: calc(100vh - 84px);
    padding: var(--space-8);
    transition: margin-left var(--transition-base);
}

.main-content.full {
    margin-left: 0;
}

/* === SIDEBAR COLLAPSED STATE === */
body.sidebar-collapsed .sidebar {
    transform: translateX(calc(-100% - 32px));
    opacity: 0;
    pointer-events: none;
}

body.sidebar-collapsed .main-content {
    margin-left: 16px;
}

body.sidebar-collapsed .sidebar-toggle-icon {
    transform: rotate(180deg);
}

/* === PAGE HEADER === */
.page-header {
    margin-bottom: var(--space-8);
    animation: fadeInUp 0.4s ease;
}

.page-header h1 {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    font-family: var(--font-display);
    color: var(--neutral-900);
    margin-bottom: var(--space-2);
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 8px rgba(59, 130, 246, 0.1));
}

.page-header p {
    font-size: var(--text-base);
    color: var(--neutral-500);
    max-width: 600px;
}

/* === HERO SECTION === */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-8);
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-12);
    max-width: var(--container-max);
    width: 100%;
}

/* Holographic Portal Illustration */
.hero-illustration {
    flex-shrink: 0;
    width: 220px;
    height: 320px;
    position: relative;
    animation: float 4s ease-in-out infinite;
}

/* Portal background - holographic rings */
.hero-illustration::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140%;
    height: 140%;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
        radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
        radial-gradient(circle, rgba(139, 92, 246, 0.06) 0%, transparent 70%);
    pointer-events: none;
    filter: blur(2px);
    z-index: 1;
    animation: portal-breathe 5s ease-in-out infinite;
}

/* Glowing rings */
.hero-illustration::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.15);
    box-shadow:
        0 0 0 20px rgba(59, 130, 246, 0.04),
        0 0 0 40px rgba(99, 102, 241, 0.03),
        0 0 0 60px rgba(139, 92, 246, 0.02),
        0 0 40px rgba(59, 130, 246, 0.15);
    pointer-events: none;
    z-index: 1;
    animation: rotate-slow 30s linear infinite;
}

.hero-illustration img {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 12px 24px rgba(59, 130, 246, 0.15));
}

.hero-illustration.right {
    animation-delay: 1.5s;
}

/* Right portal repositioning:
   The right character sits higher within its image than the left one,
   so the shared center-anchored portal (top:50%) rendered detached from
   it. Re-anchor the right portal so it sits behind/under the right
   character's body and stays horizontally centered on it.
   A percentage top keeps it proportional across every breakpoint. */
.hero-illustration.right::before,
.hero-illustration.right::after {
    top: 40%;
    left: 50%;
}

.hero-center {
    text-align: center;
    flex: 1;
    max-width: 600px;
}

.hero-center h1 {
    font-size: var(--text-5xl);
    font-weight: var(--font-bold);
    font-family: var(--font-display);
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-4);
    line-height: 1.1;
    letter-spacing: -0.01em;
    filter: drop-shadow(0 4px 16px rgba(59, 130, 246, 0.15));
}

.hero-center p {
    font-size: var(--text-lg);
    color: var(--neutral-500);
    margin-bottom: var(--space-8);
    line-height: 1.6;
}

.hero-center .btn-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
}

/* === STATS GRID === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--card);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    text-align: center;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.stat-card:hover {
    background: var(--glass-bg-strong);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto var(--space-3);
    background: var(--primary-50);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    color: var(--primary-600);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.stat-card-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    font-family: var(--font-display);
    color: var(--neutral-900);
    margin-bottom: var(--space-1);
}

.stat-card-label {
    font-size: var(--text-sm);
    color: var(--neutral-500);
}

/* === SECTION === */
.section {
    margin-bottom: var(--space-12);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.section-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    font-family: var(--font-display);
    color: var(--neutral-900);
}

.section-subtitle {
    font-size: var(--text-sm);
    color: var(--neutral-500);
    margin-top: var(--space-1);
}

/* === FOOTER === */
.footer {
    text-align: center;
    padding: var(--space-8);
    color: var(--neutral-400);
    font-size: var(--text-sm);
    font-family: var(--font-primary);
}

/* === DARK MODE BACKGROUND === */
.dark .app-background {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
}

.dark .geo-dot-grid {
    background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    opacity: 0.15;
}

.dark .geo-circle {
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .geo-circle-rings {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow:
        0 0 0 40px rgba(59, 130, 246, 0.05),
        0 0 0 80px rgba(99, 102, 241, 0.04),
        0 0 0 120px rgba(139, 92, 246, 0.03);
}

.dark .geo-symbol {
    color: rgba(255, 255, 255, 0.15);
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

/* Dark Mode Hero Gradient */
.dark .hero-center h1 {
    background: var(--gradient-text-light);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === DARK MODE OVERRIDES === */
.dark .top-nav {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.dark .top-nav.scrolled {
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.dark .top-nav-logo {
    color: #F1F5F9;
}

.dark .top-nav-logo-icon {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.dark .top-nav-link {
    color: #94A3B8;
}

.dark .top-nav-link:hover {
    color: #F1F5F9;
    background: rgba(255, 255, 255, 0.06);
}

.dark .top-nav-link.active {
    color: #60A5FA;
    background: rgba(59, 130, 246, 0.15);
}

.dark .mobile-menu-btn {
    color: #94A3B8;
}

.dark .mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Dark Mode Sidebar */
.dark .sidebar {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.dark .sidebar-item {
    color: #94A3B8;
}

.dark .sidebar-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #F1F5F9;
}

.dark .sidebar-item.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Dark Mode Hero */
.dark .hero-section {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
}

.dark .hero-center p {
    color: #94A3B8;
}

.dark .hero-illustration::before {
    background:
        radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
        radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
}

.dark .hero-illustration::after {
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow:
        0 0 0 20px rgba(59, 130, 246, 0.06),
        0 0 0 40px rgba(99, 102, 241, 0.05),
        0 0 0 60px rgba(139, 92, 246, 0.04),
        0 0 40px rgba(59, 130, 246, 0.2);
}

/* Dark Mode Stats Grid */
.dark .stat-card {
    background: rgba(30, 41, 59, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dark .stat-card:hover {
    background: rgba(30, 41, 59, 0.85);
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.15);
}

.dark .stat-card-value {
    color: #F1F5F9;
}

.dark .stat-card-label {
    color: #94A3B8;
}

.dark .stat-card-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #60A5FA;
}

/* Dark Mode Section Titles */
.dark .section-title {
    color: #F1F5F9;
}

.dark .section-subtitle {
    color: #94A3B8;
}

.dark .page-header h1 {
    background: var(--gradient-text-light);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Dark mode text safety for inline-style elements with neutral tokens */
.dark [style*="var(--neutral-900)"],
.dark [style*="var(--neutral-800)"],
.dark [style*="var(--neutral-700)"],
.dark [style*="var(--neutral-600)"],
.dark [style*="var(--neutral-500)"] {
    color: #F1F5F9 !important;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .hero-content {
        gap: var(--space-8);
    }
    
    .hero-illustration {
        width: 180px;
        height: 260px;
    }
    
    .hero-center h1 {
        font-size: var(--text-4xl);
    }
}

@media (max-width: 768px) {
    .top-nav {
        top: 8px;
        width: calc(100% - 16px);
    }
    
    .sidebar {
        transform: translateX(-120%);
        top: 76px;
        left: 8px;
        bottom: 8px;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        margin-top: 76px;
        padding: var(--space-4);
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .sidebar-toggle-btn {
        display: none;
    }
    
    .top-nav-links {
        display: none;
    }
    
    .hero-content {
        flex-direction: column;
        gap: var(--space-6);
    }
    
    .hero-illustration {
        width: 140px;
        height: 200px;
    }
    
    .hero-center h1 {
        font-size: var(--text-3xl);
    }
    
    .hero-center p {
        font-size: var(--text-base);
    }
    
    .hero-center .btn-group {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Mobile: collapsed state should not hide sidebar (uses slide-in instead) */
    body.sidebar-collapsed .sidebar {
        transform: translateX(-120%);
        opacity: 1;
        pointer-events: auto;
    }
    
    body.sidebar-collapsed .main-content {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-illustration {
        width: 120px;
        height: 160px;
    }
    
    .top-nav-inner {
        height: 56px;
    }
}
/* =========================================================
   CIRCLE RESPONSIVE AUDIT FIX (frontend-only, CSS presentation)
   Preserves design/colors/typography; only adapts layout.
   - Sidebar drawer overlay + backdrop on mobile
   - Prevents horizontal overflow from nav/grids/cards
   - Keeps desktop layout unchanged
   ========================================================= */

/* Safety: never allow page-level horizontal scroll from decor */
html, body {
    max-width: 100%;
    overflow-x: clip;
}

.main-content,
.container,
.page-header,
.section {
    min-width: 0;
}

img, svg, video, canvas {
    max-width: 100%;
}
img { height: auto; }

/* Sidebar must overlay content on mobile, not push it */
@media (max-width: 768px) {
    .top-nav { z-index: 250; }
    .sidebar { z-index: 240; }
    .sidebar.open {
        box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    }
    /* Clickable backdrop while drawer is open (no JS/HTML change) */
    body:has(.sidebar.open)::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.38);
        z-index: 235;
    }
    body:has(.sidebar.open) { overflow: hidden; }

    /* Top bar: keep logo + actions on one line without overflow */
    .top-nav-inner { gap: 8px; }
    .top-nav-logo span {
        max-width: 34vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .top-nav-user span {
        display: none;
    }
    .top-nav-user .btn {
        white-space: nowrap;
    }
}

/* Tablet: sidebar takes less width, content keeps breathing room */
@media (min-width: 769px) and (max-width: 1100px) {
    .sidebar { width: 210px; }
    body:not(.sidebar-collapsed) .main-content { margin-left: 210px; }
}

/* Auth cards use inline padding:40px — reduce only on small phones */
@media (max-width: 480px) {
    div[style*="min-height: 100vh"] { padding: 16px !important; }
    div[style*="min-height: 100vh"] > .card-glass {
        padding: 24px 18px !important;
    }
    .top-nav-logo span { max-width: 40vw; }
    .page-header h1 { font-size: 1.55rem; }
    .section-title { font-size: 1.05rem; }
    .hero-center h1 { font-size: 1.7rem; }
    .container { padding-left: var(--space-4); padding-right: var(--space-4); }
    .main-content { padding: var(--space-4); }
}

/* Very small phones */
@media (max-width: 400px) {
    .main-content { padding: 12px; }
    .container { padding-left: 12px; padding-right: 12px; }
    .stat-card { padding: var(--space-4); }
    .stat-card-value { font-size: 1.4rem; }
    .btn-lg { padding: 12px 20px; font-size: 0.9rem; }
    .sidebar { width: min(260px, calc(100vw - 32px)); }
}

/* Landscape phones: keep header/sidebar compact so content is visible */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-content { flex-direction: row; gap: var(--space-4); }
    .hero-illustration { width: 100px; height: 140px; }
    .hero-center h1 { font-size: 1.5rem; }
    .sidebar { top: 64px; }
    .main-content { margin-top: 64px; }
}