/* ========== CSS VARIABLES ========== */
:root {
    /* Dark Theme Colors */
    --bg-gradient-start: #1a1a1a;
    --bg-gradient-mid: #2d2d2d;
    --bg-gradient-end: #1a1a1a;
    --container-bg: rgba(26, 26, 26, 0.95);
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-tertiary: #606060;
    --label-color: #e0e0e0;
    --input-bg: rgba(0, 0, 0, 0.3);
    --input-bg-focus: rgba(0, 0, 0, 0.5);
    --input-border: rgba(255, 255, 255, 0.15);
    --border-color: rgba(255, 255, 255, 0.1);
    --popup-bg: #1a1a1a;
    --popup-close-bg: rgba(255, 255, 255, 0.1);
    --popup-close-bg-hover: rgba(255, 255, 255, 0.2);
    --popup-close-color: #a0a0a0;
    --accent-color: #5d4af5;
    --accent-color-hover: #7d6bf7;
    --accent-color-dark: #4a38c4;
    --radial-accent-1: rgba(93, 74, 245, 0.08);
    --radial-accent-2: rgba(93, 74, 245, 0.05);
}

[data-theme="light"] {
    /* Light Theme Colors */
    --bg-gradient-start: #f5f5f5;
    --bg-gradient-mid: #ffffff;
    --bg-gradient-end: #f5f5f5;
    --container-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #0a0a0a;
    --text-secondary: #606060;
    --text-tertiary: #a0a0a0;
    --label-color: #2d2d2d;
    --input-bg: rgba(255, 255, 255, 0.8);
    --input-bg-focus: rgba(255, 255, 255, 1);
    --input-border: rgba(0, 0, 0, 0.15);
    --border-color: rgba(0, 0, 0, 0.1);
    --popup-bg: #ffffff;
    --popup-close-bg: rgba(0, 0, 0, 0.05);
    --popup-close-bg-hover: rgba(0, 0, 0, 0.1);
    --popup-close-color: #606060;
    --accent-color: #5d4af5;
    --accent-color-hover: #4a38c4;
    --accent-color-dark: #3a2a9f;
    --radial-accent-1: rgba(93, 74, 245, 0.06);
    --radial-accent-2: rgba(93, 74, 245, 0.03);
}

/* ========== BASE STYLES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-primary);
    position: relative;
    transition: background 0.3s ease, color 0.3s ease;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, var(--radial-accent-1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, var(--radial-accent-2) 0%, transparent 50%);
    pointer-events: none;
    transition: background 0.3s ease;
}

/* ========== LOGIN CONTAINER ========== */
.login-container {
    background: var(--container-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 60px 50px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 100px var(--radial-accent-2);
    position: relative;
    z-index: 1;
    transition: background 0.3s ease, border 0.3s ease, box-shadow 0.3s ease;
}

.logo-container {
    text-align: center;
    margin-bottom: 48px;
}

.logo {
    max-width: 240px;
    height: auto;
    transition: opacity 0.3s ease;
}

.form-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    text-align: center;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
}

.form-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 40px;
    font-weight: 400;
    transition: all 0.3s ease;
    user-select: none;
}

.form-subtitle:hover {
    color: var(--accent-color);
}

/* ========== FORM STYLES ========== */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--label-color);
    letter-spacing: 0.2px;
    transition: color 0.3s ease;
}

.form-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
    transition: color 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.form-input.error ~ .form-hint {
    opacity: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--input-bg-focus);
    box-shadow: 0 0 0 3px rgba(93, 74, 245, 0.1);
}

.form-input::placeholder {
    color: var(--text-tertiary);
    transition: color 0.3s ease;
}

.form-input.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.form-input.error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-message {
    display: none;
    color: #ef4444;
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
}

.error-message.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-login {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-dark) 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 32px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    position: relative;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--accent-color-hover) 0%, var(--accent-color-dark) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(93, 74, 245, 0.3);
}

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

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading state for button */
.btn-login.loading {
    color: transparent;
    pointer-events: none;
}

.btn-login.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

.forgot-password {
    text-align: center;
    margin-top: 24px;
}

.forgot-password-link {
    color: #5d4af5;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-block;
    line-height: 1.5;
}

.forgot-password-link:hover {
    color: #7d6bf7;
    text-decoration: none;
}

/* ========== POPUP STYLES ========== */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.popup-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.popup-content {
    background: var(--popup-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 480px;
    position: relative;
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
    transition: background 0.3s ease, border 0.3s ease;
}

.popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--popup-close-bg);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: var(--popup-close-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: 300;
}

.popup-close:hover {
    background: var(--popup-close-bg-hover);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.popup-icon {
    text-align: center;
    margin-bottom: 24px;
    font-size: 48px;
}

.popup-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
}

.popup-message {
    font-size: 16px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 32px;
    transition: color 0.3s ease;
}

.btn-popup {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-dark) 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
}

.btn-popup:hover {
    background: linear-gradient(135deg, var(--accent-color-hover) 0%, var(--accent-color-dark) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(93, 74, 245, 0.3);
}

.popup-input-group {
    margin-bottom: 24px;
}

.popup-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
}

.popup-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--input-bg-focus);
    box-shadow: 0 0 0 3px rgba(93, 74, 245, 0.1);
}

.popup-input::placeholder {
    color: var(--text-tertiary);
    transition: color 0.3s ease;
}

.popup-input.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.popup-input.error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== THEME TOGGLE ========== */
.theme-toggle-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
}

.theme-toggle {
    position: relative;
    width: 70px;
    height: 36px;
    background: #3a3a3a;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.theme-toggle:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.theme-toggle.light {
    background: #e8e8e8;
}

.theme-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 30px;
    height: 30px;
    background: #ffffff;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle.light .theme-toggle-slider {
    transform: translateX(34px);
}

.theme-icon {
    width: 18px;
    height: 18px;
    transition: opacity 0.3s ease;
}

.theme-icon svg {
    width: 100%;
    height: 100%;
    stroke: #3a3a3a;
    fill: #3a3a3a;
    stroke-width: 0;
}

.theme-icon svg line {
    stroke: #3a3a3a;
    fill: none;
}

.theme-icon svg circle {
    fill: #3a3a3a;
    stroke: none;
}

.theme-icon svg path {
    fill: #3a3a3a;
    stroke: none;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 540px) {
    .login-container {
        padding: 40px 30px;
    }

    .form-title {
        font-size: 24px;
    }

    .popup-content {
        padding: 36px 28px;
    }

    .logo {
        max-width: 200px;
    }

    .theme-toggle-container {
        top: 16px;
        right: 16px;
    }

    .theme-toggle {
        width: 60px;
        height: 30px;
    }

    .theme-toggle-slider {
        width: 24px;
        height: 24px;
    }

    .theme-icon {
        width: 14px;
        height: 14px;
    }

    .theme-toggle.light .theme-toggle-slider {
        transform: translateX(30px);
    }
}

