/* assets/css/theme.css - Design System for CodeAssist 2.0 */

:root, :root[data-theme='light'] {
    /* Colors - Light Theme */
    --bg: #f0eeff;
    --bg2: #e8e2ff;
    --bg3: #ddd5ff;
    --bg-card: rgba(255, 255, 255, 0.78);
    --bg-input: #f5f3ff;
    --bg-nav: rgba(240, 238, 255, 0.82);
    
    --t0: #0f0a2e;
    --t1: #4a4570;
    --t2: #8b88b0;
    --border: rgba(99, 102, 241, 0.10);
    
    --sh-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --sh-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --sh-lg: 0 20px 25px -5px rgba(0,0,0,0.06), 0 10px 10px -5px rgba(0,0,0,0.02);
}

:root[data-theme='dark'] {
    /* Colors - Dark Theme */
    --bg: #05050c;
    --bg2: #0c0c18;
    --bg3: #121220;
    --bg-card: #13131f;
    --bg-input: #1a1a2e;
    --bg-nav: rgba(5, 5, 12, 0.88);
    
    --t0: #f0efff;
    --t1: #9896c0;
    --t2: #5a5880;
    --border: rgba(99, 102, 241, 0.15); /* Slightly darker border for contrast on dark bg */
    
    --sh-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --sh-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --sh-lg: 0 20px 25px -5px rgba(0,0,0,0.5);
}

:root {
    /* Accent Palette */
    --blue: #4361ee;
    --purple: #7c3aed;
    --indigo: #6366f1;
    --green: #059669;
    --teal: #0891b2;
    --orange: #ea580c;
    --red: #dc2626;
    
    /* Gradients */
    --g1: linear-gradient(135deg, var(--blue), var(--purple));
    --g2: linear-gradient(135deg, #f093fb, #f5576c);
    --g3: linear-gradient(135deg, #43e97b, #38f9d7);
    
    /* Constants constraints */
    --code-bg: #0d1117;
    --code-text: #a5d6ff;
    
    /* Transitions & Radii */
    --spring: cubic-bezier(.34, 1.56, .64, 1);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --r-sm: 6px;
    --r-md: 9px;
    --r-lg: 18px;
    --r-xl: 24px;
}

/* ================== BASE RESETS ================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg);
    color: var(--t1);
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    line-height: 1.75;
    transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ================== TYPOGRAPHY ================== */
h1, h2, h3, h4, h5, h6, .logo {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--t0);
    margin-bottom: 0.5em;
    font-weight: 800;
}
h1 { font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -0.03em; line-height: 1.1; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -0.022em; line-height: 1.2; }
h3 { font-size: 1.125rem; font-weight: 700; }
a { color: var(--blue); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--indigo); }
p { font-size: 0.9375rem; margin-bottom: 1.25em; }
small { font-size: 0.8125rem; font-weight: 500; }
label { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--t1); margin-bottom: 6px; display: block; }
code, pre, .mono { font-family: 'JetBrains Mono', monospace; font-size: 11px; line-height: 1.85; }

/* ================== COMPONENTS ================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* CARDS - Glassmorphism */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
    padding: 24px;
    transition: all 0.4s var(--spring);
    position: relative;
    overflow: hidden;
}
.card:hover {
    transform: translateY(-6px) scale(1.015);
    box-shadow: var(--sh-lg);
    border-color: rgba(67, 97, 238, 0.3);
}

/* BUTTONS */
.btn-p, .btn-o, .btn-ghost, .btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    transition: all 0.3s var(--ease);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    gap: 8px;
    border: none;
    outline: none;
}
.btn-p {
    background: var(--g1);
    background-size: 200% auto;
    color: white;
    padding: 9px 20px;
    border-radius: var(--r-md);
    box-shadow: 0 4px 16px rgba(67,97,238,.3);
}
.btn-p:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67,97,238,.4);
    background-position: right center;
    color: white;
}
.btn-o {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    color: var(--t0);
    padding: 8px 19px;
    border-radius: var(--r-md);
}
.btn-o:hover {
    border-color: var(--blue);
    background: rgba(67,97,238,.05);
    transform: translateY(-1px);
    color: var(--blue);
}
.btn-ghost {
    background: transparent;
    color: var(--t1);
    padding: 8px 16px;
    border-radius: var(--r-md);
}
.btn-ghost:hover {
    background: var(--bg-input);
    color: var(--t0);
}
.btn-danger {
    background: rgba(220,38,38,.1);
    border: 1px solid var(--red);
    color: var(--red);
    padding: 8px 16px;
    border-radius: var(--r-md);
}

/* INPUTS */
input, textarea, select {
    width: 100%;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 16px;
    color: var(--t0);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    transition: all 0.2s ease;
    outline: none;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

/* ================== NAVBAR ================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 62px;
    background: var(--bg-nav);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
    transition: all 0.3s ease;
}
.navbar.scrolled {
    box-shadow: var(--sh-md);
}
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-icon {
    width: 34px;
    height: 34px;
    background: var(--g1);
    background-size: 200% auto;
    border-radius: var(--r-md);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(67,97,238,0.3);
    transition: all 0.4s var(--spring);
}
.logo:hover .logo-icon {
    transform: rotate(-8deg) scale(1.1);
    background-position: right center;
}
.logo-text {
    font-size: 20px;
    letter-spacing: -0.5px;
    color: var(--t0);
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}
.nav-links > a:not(.btn-p):not(.btn-ghost) {
    font-size: 13px;
    font-weight: 500;
    color: var(--t1);
    position: relative;
    padding: 6px 10px;
    border-radius: 6px;
}
.nav-links > a:not(.btn-p):not(.btn-ghost)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--blue);
    transform: scaleX(0);
    transition: transform 0.3s var(--ease);
}
.nav-links > a:not(.btn-p):not(.btn-ghost):hover {
    color: var(--blue);
    background: rgba(67,97,238,0.05);
}
.nav-links > a:not(.btn-p):not(.btn-ghost):hover::after {
    transform: scaleX(1);
}

/* User Dropdown */
.theme-toggle, .user-menu-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--t1);
    transition: all 0.2s ease;
}
.theme-toggle:hover, .user-menu-btn:hover {
    color: var(--blue);
    border-color: var(--blue);
}
.user-menu-wrapper {
    position: relative;
}
.nav-avatar, .nav-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.nav-avatar-placeholder {
    background: var(--g1);
    color: white;
    font-weight: bold;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
}
.settings-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 220px;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-lg);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transform-origin: top right;
    transition: all 0.2s var(--ease);
    z-index: 101;
}
.settings-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}
.dropdown-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}
.dropdown-header span {
    font-size: 11px;
    color: var(--t2);
    margin-top: 2px;
}
.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--t1);
    font-size: 13px;
    transition: background 0.2s;
}
.dropdown-item:hover {
    background: var(--bg-input);
    color: var(--blue);
}
.dropdown-item.danger:hover {
    color: var(--red);
    background: rgba(220,38,38,0.05);
}

/* Menu Toggle (Mobile) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--t0);
    cursor: pointer;
}

/* ================== FOOTER ================== */
.footer {
    background: #0a0818;
    color: #9896c0;
    padding: 60px 0 20px;
    margin-top: auto;
}
.footer h3 { color: white; margin-bottom: 20px; }
.footer .logo-text { color: white; }
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}
.footer-col a {
    display: block;
    color: #9896c0;
    margin-bottom: 12px;
    font-size: 14px;
}
.footer-col a:hover { color: var(--blue); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 13px;
}

/* ================== ANIMATIONS (17 Keyframes as requested) ================== */
@keyframes fadeUp {
    0% { opacity: 0; transform: translateY(28px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}
@keyframes floatSlow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}
@keyframes floatR {
    0%, 100% { transform: translateY(0) rotate(2deg); }
    50% { transform: translateY(-15px) rotate(-1deg); }
}
@keyframes morph {
    0%, 100% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
    34% { border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%; }
    67% { border-radius: 100% 60% 60% 100% / 100% 100% 60% 60%; }
}
@keyframes gradMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes textGrad {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.4; }
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes particle {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}
@keyframes orbRotate {
    to { transform: rotate(360deg); }
}
@keyframes borderPulse {
    0%, 100% { border-color: rgba(99, 102, 241, 0.1); }
    50% { border-color: rgba(99, 102, 241, 0.5); }
}
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
@keyframes bgShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes glow {
    0%, 100% { box-shadow: 0 0 15px rgba(124, 58, 237, 0.4); }
    50% { box-shadow: 0 0 35px rgba(124, 58, 237, 0.7); }
}

/* Observer utility classes */
.reveal { opacity: 0; transform: translateY(28px); transition: all 0.8s var(--ease); }
.reveal.vis { opacity: 1; transform: translateY(0); }

/* ================== RESPONSIVE ================== */
@media (max-width: 900px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .nav-links > a:not(.btn-p):not(.btn-ghost):not(.theme-toggle) { display: none; }
    .menu-toggle { display: block; }
}
@media (max-width: 600px) {
    .footer-grid { grid-template-columns: 1fr; gap: 24px; text-align: center; }
}
