/* ========== CAD Online — Shared Theme Tokens (Modern Minimal) ========== */
/* Shared across converter.html, login.php, register.php, dashboard.php */

:root {
    /* Brand — Blue */
    --ce-primary: #2563EB;
    --ce-primary-dark: #1D4ED8;
    --ce-primary-light: #3B82F6;
    --ce-primary-glow: transparent;
    --ce-success: #16a34a;
    --ce-success-dark: #15803d;
    --ce-warning: #f59e0b;
    --ce-error: #dc2626;
    --ce-error-dark: #b91c1c;
    --ce-info: #2563EB;

    /* Fonts */
    --ce-font-heading: 'Poppins', sans-serif;
    --ce-font-body: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Backgrounds */
    --ce-bg-body: #f9fafb;
    --ce-bg-card: #ffffff;
    --ce-bg-card-glass: #ffffff;
    --ce-bg-input: #f9fafb;

    /* Text */
    --ce-text-primary: #111827;
    --ce-text-secondary: #6b7280;
    --ce-text-muted: #9ca3af;
    --ce-text-on-primary: #ffffff;
    --ce-text-success: #16a34a;
    --ce-text-error: #dc2626;

    /* Borders */
    --ce-border: #e5e7eb;
    --ce-border-light: #f3f4f6;
    --ce-border-input: #d1d5db;

    /* Shadows */
    --ce-shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --ce-shadow-md: 0 2px 8px rgba(0,0,0,0.06);
    --ce-shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
    --ce-shadow-xl: 0 8px 24px rgba(0,0,0,0.10);

    /* Glass (disabled) */
    --ce-glass-blur: none;
    --ce-glass-bg: #ffffff;

    /* Radius */
    --ce-radius-sm: 6px;
    --ce-radius-md: 8px;
    --ce-radius-lg: 12px;

    /* Transition */
    --ce-transition: 0.15s ease;

    /* Header */
    --ce-header-bg: var(--ce-primary);
}

/* ========== Dark Mode ========== */
html.dark {
    --ce-primary: #3B82F6;
    --ce-primary-dark: #2563EB;
    --ce-primary-light: #60A5FA;
    --ce-primary-glow: transparent;
    --ce-success: #22c55e;
    --ce-success-dark: #16a34a;
    --ce-error: #ef4444;
    --ce-error-dark: #dc2626;
    --ce-info: #3B82F6;

    --ce-bg-body: #09090b;
    --ce-bg-card: #18181b;
    --ce-bg-card-glass: #18181b;
    --ce-bg-input: #27272a;

    --ce-text-primary: #fafafa;
    --ce-text-secondary: #a1a1aa;
    --ce-text-muted: #71717a;
    --ce-text-success: #22c55e;
    --ce-text-error: #ef4444;

    --ce-border: #27272a;
    --ce-border-light: #18181b;
    --ce-border-input: #3f3f46;

    --ce-shadow-sm: none;
    --ce-shadow-md: 0 2px 8px rgba(0,0,0,0.3);
    --ce-shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
    --ce-shadow-xl: 0 8px 24px rgba(0,0,0,0.5);

    --ce-glass-bg: #18181b;
    --ce-header-bg: var(--ce-primary);
}

/* ========== Background: flat (no animated gradient) ========== */
body::before { display: none; }

/* ========== Utility: Card ========== */
.ce-card {
    background: var(--ce-bg-card);
    border-radius: var(--ce-radius-lg);
    box-shadow: var(--ce-shadow-md);
    border: 1px solid var(--ce-border);
    overflow: hidden;
    transition: background var(--ce-transition), box-shadow var(--ce-transition);
}

/* ========== Utility: Button ========== */
.ce-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--ce-radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--ce-transition);
    width: 100%;
}
.ce-btn-primary {
    background: var(--ce-primary);
    color: var(--ce-text-on-primary);
}
.ce-btn-primary:hover {
    background: var(--ce-primary-dark);
}

/* ========== Utility: Input ========== */
.ce-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--ce-border-input);
    border-radius: var(--ce-radius-sm);
    font-size: 1rem;
    background: var(--ce-bg-input);
    color: var(--ce-text-primary);
    transition: all var(--ce-transition);
}
.ce-input:focus {
    outline: none;
    border-color: var(--ce-primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
.ce-input.invalid {
    border-color: var(--ce-error);
}

/* ========== Unified Aliases (Round 33) ========== */
/* Allow both --ce-* and short --primary/--bg-card naming */
:root {
    --primary: var(--ce-primary);
    --primary-dark: var(--ce-primary-dark);
    --bg-card: var(--ce-bg-card);
    --bg-body: var(--ce-bg-body);
    --bg-input: var(--ce-bg-input);
    --text-primary: var(--ce-text-primary);
    --text-secondary: var(--ce-text-secondary);
    --text-muted: var(--ce-text-muted);
    --border: var(--ce-border);
    --border-input: var(--ce-border-input);
    --success: var(--ce-success);
    --error: var(--ce-error);
    --warning: var(--ce-warning);
    --radius-sm: var(--ce-radius-sm);
    --radius-md: var(--ce-radius-md);
    --radius-lg: var(--ce-radius-lg);
    --shadow-sm: var(--ce-shadow-sm);
    --shadow-md: var(--ce-shadow-md);
    --shadow-lg: var(--ce-shadow-lg);
}

/* ========== Tablet Breakpoint (Round 33) ========== */
@media (max-width: 768px) {
    .ce-hide-mobile { display: none !important; }
    .ce-show-mobile { display: block !important; }
}
@media (min-width: 769px) {
    .ce-show-mobile { display: none !important; }
}

/* ========== Accessibility (Round 33) ========== */
.skip-to-main {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--ce-primary);
    color: white;
    padding: 8px 16px;
    z-index: 10000;
    font-size: 0.9rem;
    text-decoration: none;
    border-radius: 0 0 var(--ce-radius-sm) 0;
    transition: top 0.2s;
}
.skip-to-main:focus {
    top: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--ce-primary);
    outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========== Mobile Hamburger Menu (Round 33) ========== */
.hamburger-btn {
    display: none;
    background: var(--ce-bg-input);
    border: 1px solid var(--ce-border);
    color: var(--ce-text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--ce-radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all var(--ce-transition);
}
.hamburger-btn:hover { background: var(--ce-primary); color: white; }
.hamburger-btn svg { width: 22px; height: 22px; }

@media (max-width: 768px) {
    .hamburger-btn { display: flex; }
    .mobile-nav-collapsible { display: none; }
    .mobile-nav-collapsible.open { display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--ce-bg-card); border-bottom: 1px solid var(--ce-border); box-shadow: var(--ce-shadow-lg); z-index: 999; padding: 12px; gap: 4px; }
    .mobile-nav-collapsible.open a { padding: 10px 16px; border-radius: var(--ce-radius-sm); }
    .mobile-nav-collapsible.open a:hover { background: var(--ce-bg-input); }
}

/* ========== Language Toggle (Round 33) ========== */
.lang-toggle {
    display: flex;
    gap: 2px;
    background: var(--ce-bg-input);
    border-radius: var(--ce-radius-sm);
    border: 1px solid var(--ce-border);
    overflow: hidden;
}
.lang-btn {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    background: transparent;
    border: none;
    color: var(--ce-text-muted);
    cursor: pointer;
    transition: all var(--ce-transition);
}
.lang-btn.active {
    background: var(--ce-primary);
    color: white;
}
.lang-btn:hover:not(.active) {
    color: var(--ce-text-primary);
}

/* ========== Plan Badges ========== */
.plan-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--ce-font-heading);
    letter-spacing: 0.3px;
}
.plan-badge-free {
    background: var(--ce-bg-input, #e2e8f0);
    color: var(--ce-text-secondary, #475569);
}
.plan-badge-pro {
    background: #dbeafe;
    color: #1d4ed8;
}
.plan-badge-business {
    background: #fef3c7;
    color: #92400e;
}
.dark .plan-badge-free {
    background: #334155;
    color: #94a3b8;
}
.dark .plan-badge-pro {
    background: #1e3a5f;
    color: #60a5fa;
}
.dark .plan-badge-business {
    background: #422006;
    color: #fbbf24;
}

/* Upgrade banner */
.upgrade-banner {
    background: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--ce-radius-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.upgrade-banner a {
    background: #fff;
    color: #2563EB;
    padding: 6px 16px;
    border-radius: var(--ce-radius-sm);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
}
.upgrade-banner a:hover {
    background: #fecdd3;
}

/* Feature locked overlay */
.feature-locked {
    position: relative;
    opacity: 0.5;
    pointer-events: none;
}
.feature-locked::after {
    content: '\1F512';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
}

/* ========== Reduced Motion (Round 39) ========== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
