/* --- Base and Variables --- */
:root {
    /* Base Font & Sizing */
    font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color-scheme: light dark;
    font-synthesis: none;
    text-rendering: optimizeLegibility;

    /* --- Light Theme (Default) --- */
    --bg: #eff3f8;
    --bg-gradient-start: rgba(0, 120, 212, 0.1);
    --bg-gradient-end: rgba(123, 220, 181, 0.1);
    --card-bg: rgba(252, 252, 252, 0.75); /* Acrylic Effect */
    --card-border: rgba(0, 0, 0, 0.08);
    --card-shadow: rgba(0, 0, 0, 0.1);
    --text-primary: #1a1a1a;
    --text-secondary: #5c5c5c;
    --text-tertiary: #7a7a7a;
    --input-bg: rgba(255, 255, 255, 0.5);
    --input-border: #d1d1d1;
    --input-border-focus: #0078d4;
    --accent-bg: #0078d4;
    --accent-bg-hover: #106ebe;
    --accent-text: #ffffff;
    --success: #107c10;
    --error: #d83b01;
    --icon-color: #6a6a6a;
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --bg: #1f1f1f;
    --bg-gradient-start: rgba(0, 120, 212, 0.15);
    --bg-gradient-end: rgba(10, 138, 111, 0.15);
    --card-bg: rgba(40, 40, 40, 0.75); /* Acrylic Effect */
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: rgba(0, 0, 0, 0.3);
    --text-primary: #f2f2f2;
    --text-secondary: #cccccc;
    --text-tertiary: #a0a0a0;
    --input-bg: rgba(30, 30, 30, 0.5);
    --input-border: #5a5a5a;
    --input-border-focus: #60cdff;
    --accent-bg: #60cdff;
    --accent-bg-hover: #78d4ff;
    --accent-text: #1a1a1a;
    --success: #6ccb5f;
    --error: #ff7675;
    --icon-color: #a0a0a0;
}

*, *::before, *::after {
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    
    background-color: var(--bg);
    background-image: 
        /* Top layer: Gradients */
        radial-gradient(circle at top, var(--bg-gradient-start), transparent 60%),
        radial-gradient(circle at bottom, var(--bg-gradient-end), transparent 55%),
        /* Bottom layer: Custom background image */
        url('background.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed; 
}

/* --- Layout and Card --- */
.layout {
    width: min(400px, 95vw);
}

.card {
    position: relative;
    background: var(--card-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: 12px;
    border: 1px solid var(--card-border);
    padding: 24px;
    box-shadow: 0 8px 32px 0 var(--card-shadow);
}

h1 {
    margin: 0 0 0.2rem;
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--text-primary);
}

.subtitle {
    margin: 0 0 1.25rem;
    color: var(--text-secondary);
}

/* --- Theme Toggle Button --- */
#theme-toggle {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    color: var(--text-secondary);
}
#theme-toggle:hover {
    color: var(--text-primary);
    background: var(--input-bg);
}
#theme-toggle svg {
    width: 20px;
    height: 20px;
}
.moon { display: none; }
.sun { display: block; }
[data-theme="dark"] .moon { display: block; }
[data-theme="dark"] .sun { display: none; }

form {
    display: grid;
    gap: 0.9rem;
}

.field {
    display: grid;
    gap: 0.25rem;
}

.field span {
    font-weight: 600;
    font-size: 0.9rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper svg {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--icon-color);
    pointer-events: none;
}

.field input {
    width: 100%;
    height: 44px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-primary);
    padding: 0 12px 0 42px;
    font-size: 1rem;
    font-family: inherit;
}

.field input:focus {
    outline: none;
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 2px var(--input-border-focus, 0.3);
}

.field input::placeholder {
    color: var(--text-tertiary);
}

.hint {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    padding-left: 2px;
}

.primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    height: 48px;
    width: 100%;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    color: var(--accent-text);
    background: var(--accent-bg);
    text-decoration: none;
    padding: 0 1.5rem;
    transition: background-color 0.2s ease, transform 0.1s ease;
}
.primary svg {
    width: 20px;
    height: 20px;
}
.primary:hover {
    background: var(--accent-bg-hover);
}
.primary:active {
    transform: scale(0.98);
}
form > .primary {
    margin-top: 0.25rem;
}

#success-container {
    text-align: center;
}
#success-container .subtitle {
    margin-bottom: 1.5rem;
}

#status {
    margin-top: 1rem;
    min-height: 1.5rem;
    font-weight: 600;
    text-align: center;
}

.status-success {
    color: var(--success);
}

.status-error {
    color: var(--error);
}

@media (max-width: 480px) {
    body {
        align-items: flex-start;
        padding-top: 5vh;
        padding-bottom: 5vh;
    }
    .card {
        padding: 24px 20px;
    }
    h1 {
        font-size: 1.5rem;
    }
    form {
        gap: 0.8rem;
    }
}
