@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
    --bg: #09090b;
    --bg-deep: #050505;
    --surface: rgba(24, 24, 27, 0.7);
    --surface-strong: rgba(39, 39, 42, 0.85);
    --surface-dark: rgba(9, 9, 11, 0.9);
    --border: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    --text: #fafafa;
    --muted: #a1a1aa;
    --primary: #3b82f6;
    --primary-strong: #2563eb;
    --accent: #8b5cf6;
    --accent-soft: rgba(139, 92, 246, 0.2);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow-lg: 0 20px 40px -10px rgba(0,0,0,0.8);
    --shadow-md: 0 10px 20px -5px rgba(0,0,0,0.6);
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

body.theme-light {
    --bg: #f5f5f5;
    --bg-deep: #f0f0f0;
    --surface: rgba(255, 255, 255, 0.95);
    --surface-strong: rgba(255, 255, 255, 0.98);
    --surface-dark: rgba(255, 255, 255, 0.96);
    --border: rgba(15, 23, 42, 0.15);
    --border-hover: rgba(15, 23, 42, 0.25);
    --text: #1f2937;
    --muted: #6b7280;
    --shadow-lg: 0 20px 40px -10px rgba(15, 23, 42, 0.15);
    --shadow-md: 0 10px 20px -5px rgba(15, 23, 42, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg);
}

body {
    min-height: 100vh;
    background: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.12), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.12), transparent 40%),
        var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
}

body.theme-light {
    background:
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(14, 165, 233, 0.08), transparent 40%),
        var(--bg);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle 300px at var(--cursor-x, 0) var(--cursor-y, 0), 
            rgba(139, 92, 246, 0.15), 
            rgba(59, 130, 246, 0.08) 30%, 
            transparent 60%),
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 100% 100%, 60px 60px, 60px 60px;
    background-attachment: fixed, fixed, fixed;
    pointer-events: none;
    z-index: 0;
}

body.theme-light::before {
    background-image:
        radial-gradient(circle 300px at var(--cursor-x, 0) var(--cursor-y, 0), 
            rgba(59, 130, 246, 0.12), 
            rgba(14, 165, 233, 0.06) 30%, 
            transparent 60%),
        linear-gradient(rgba(15, 23, 42, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.045) 1px, transparent 1px);
    background-size: 100% 100%, 60px 60px, 60px 60px;
    background-attachment: fixed, fixed, fixed;
}

h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
    font-weight: 700;
    color: #ffffff;
}

body.theme-light h1,
body.theme-light h2,
body.theme-light h3,
body.theme-light h4 {
    color: #0f172a;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #60a5fa;
}

button, input, select, textarea {
    font-family: 'Inter', sans-serif;
}

button {
    cursor: pointer;
}

.page-shell {
    position: relative;
    z-index: 1;
}

.glass-panel {
    background: var(--surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 20px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #ffffff;
    box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.5);
}

.btn-primary:hover {
    box-shadow: 0 12px 24px -6px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #ffffff;
    box-shadow: 0 8px 20px -6px rgba(168, 85, 247, 0.5);
}

.btn-accent:hover {
    box-shadow: 0 12px 28px -6px rgba(168, 85, 247, 0.7);
    background: linear-gradient(135deg, #a855f7, #9333ea);
}

.btn-accent:active {
    box-shadow: 0 4px 12px -4px rgba(168, 85, 247, 0.6);
    transform: translateY(1px);
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-group label {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.field-group input,
.field-group select,
.field-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

body.theme-light .field-group label {
    color: #334155;
}

body.theme-light .field-group input,
body.theme-light .field-group select,
body.theme-light .field-group textarea {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(15, 23, 42, 0.16);
    color: #0f172a;
}

body.theme-light .field-group input::placeholder,
body.theme-light .field-group textarea::placeholder {
    color: #64748b;
    opacity: 1;
}

.field-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 44px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        calc(100% - 20px) calc(50% - 3px),
        calc(100% - 14px) calc(50% - 3px);
    background-size: 7px 7px, 7px 7px;
    background-repeat: no-repeat;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

body.theme-light .field-group input:focus,
body.theme-light .field-group select:focus,
body.theme-light .field-group textarea:focus {
    background: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.field-group textarea {
    resize: vertical;
    min-height: 100px;
}

.choice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choice-chip {
    position: relative;
    cursor: pointer;
}

.choice-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.choice-chip:hover span {
    border-color: var(--border-hover);
    color: var(--text);
}

.choice-chip input:checked + span {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: var(--primary);
}

.split-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.metric-card {
    padding: 20px;
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
}

.metric-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.metric-card strong {
    font-size: 1.5rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text);
    font-weight: 700;
}

.empty-state {
    padding: 32px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border);
    color: var(--muted);
    text-align: center;
    font-size: 0.95rem;
}

#error {
    color: var(--danger);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 8px;
    text-align: center;
}

@media (max-width: 980px) {
    .split-grid {
        grid-template-columns: 1fr;
    }
}

/* Custom Modal Popups */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.custom-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}
.custom-modal-box {
    background: rgba(24, 24, 27, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255,255,255,0.05);
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}
.custom-modal-overlay.show .custom-modal-box {
    transform: translateY(0) scale(1);
}
.custom-modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 12px;
    font-weight: 600;
}
.custom-modal-message {
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 32px;
}
.custom-modal-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}
.custom-modal-actions button {
    flex: 1;
    padding: 14px 0;
    font-size: 1.05rem;
}
.custom-modal-inputs {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}
.custom-modal-inputs input,
.custom-modal-inputs textarea {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: #fff;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}
.custom-modal-inputs input:focus,
.custom-modal-inputs textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    outline: none;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    transition: all 0.2s ease;
}

.password-toggle:hover {
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
}

.password-toggle.is-visible {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.16);
}

.password-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.global-theme-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1000;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(2, 6, 23, 0.78);
    color: #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.28);
    transition: all 0.2s ease;
}

.global-theme-toggle:hover {
    transform: translateY(-1px);
}

.global-theme-toggle.is-light {
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.18);
}

.global-theme-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.global-theme-toggle .icon-moon {
    display: inline;
}

.global-theme-toggle .icon-sun {
    display: none;
}

.global-theme-toggle.is-light .icon-moon {
    display: none;
}

.global-theme-toggle.is-light .icon-sun {
    display: inline;
}
