/* CSS Variables for theming */
:root {
    /* Light theme variables */
    --primary: #1a73e8;
    --primary-dark: #1765cc;
    --secondary: #34a853;
    --accent: #fbbc05;
    --danger: #ea4335;
    --light-bg: #f8f9fa;
    --dark-bg: #202124;
    --card-bg: #ffffff;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --shadow: rgba(0, 0, 0, 0.1);
    --theme-toggle-color: #1a73e8;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
}

/* Dark theme variables */
[data-theme="dark"] {
    --primary: #8ab4f8;
    --primary-dark: #a8c7fa;
    --secondary: #81c995;
    --accent: #fdd663;
    --danger: #f28b82;
    --light-bg: #202124;
    --dark-bg: #292a2d;
    --card-bg: #292a2d;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --border: #5f6368;
    --shadow: rgba(0, 0, 0, 0.3);
    --theme-toggle-color: #8ab4f8;
    --success: #81c995;
    --warning: #fdd663;
    --error: #f28b82;
}

/* Global styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1.5;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 10px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--text-secondary) var(--border);
}

/* Login container */
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px var(--shadow);
    animation: slideUp 0.6s ease-out;
    margin: 20px 0;
    position: relative;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header styles */
.login-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    background: transparent;
    border: none;
    color: var(--theme-toggle-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 10;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--border);
    transform: scale(1.1);
}

.logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Step indicator */
.step-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.step {
    display: flex;
    align-items: center;
}

.step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.step.active .step-number {
    background: var(--primary);
    color: white;
}

.step.completed .step-number {
    background: var(--success);
    color: white;
}

.step-line {
    width: 60px;
    height: 2px;
    background: var(--border);
    margin: 0 10px;
}

.step.completed + .step .step-line {
    background: var(--success);
}

/* Form styles */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.input-wrapper {
    position: relative;
}

.form-input {
    width: 100%;
    padding: 14px 16px 14px 45px;
    background: var(--light-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
    background: var(--card-bg);
    transform: translateY(-2px);
}

.form-input::placeholder {
    color: var(--text-secondary);
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
    font-size: 16px;
    z-index: 2;
}

/* Code input styles */
.code-input-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.code-input {
    width: 50px;
    height: 50px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--light-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.code-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
    background: var(--card-bg);
}

.code-input.error {
    border-color: var(--error);
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Password visibility toggle */
.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 2;
}

.password-toggle:hover {
    color: var(--primary);
}

/* Password strength meter */
.password-strength {
    margin-top: 8px;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.password-strength-text {
    font-size: 12px;
    margin-top: 5px;
    color: var(--text-secondary);
    text-align: right;
}

/* Password requirements */
.password-requirements {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.requirement {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.requirement i {
    margin-right: 8px;
    font-size: 14px;
}

.requirement.valid i {
    color: var(--success);
}

.requirement.invalid i {
    color: var(--accent);
}

/* Password match indicator */
.password-match {
    display: none;
    margin-top: 8px;
    font-size: 12px;
}

.password-match i {
    margin-right: 5px;
}

.password-match.valid i {
    color: var(--success);
}

.password-match.invalid i {
    color: var(--error);
}

/* Form options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 14px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    background: var(--light-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
}

.custom-checkbox i {
    color: white;
    font-size: 12px;
    display: none;
}

.custom-checkbox.checked i {
    display: block;
}

.checkbox-wrapper input {
    display: none;
}

.checkbox-wrapper label {
    color: var(--text-primary);
    cursor: pointer;
    margin: 0;
}

.forgot-password {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.forgot-password:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Reset instructions */
.reset-instructions {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Button styles */
.login-button {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.3);
    margin-bottom: 1.5rem;
    font-family: inherit;
}

.login-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(26, 115, 232, 0.4);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    background: var(--text-secondary);
    color: var(--card-bg);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Resend code link */
.resend-code {
    text-align: center;
    margin-top: 1rem;
    font-size: 14px;
    color: var(--text-secondary);
}

.resend-code a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.resend-code a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.resend-code a:disabled {
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Signup link */
.signup-link {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 1rem;
}

.signup-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.signup-link a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Back to login link */
.back-to-login {
    text-align: center;
    margin-top: 1rem;
}

.back-to-login a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.back-to-login a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Notification Toast */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
    max-width: 350px;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification.success .notification-icon {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.notification.error .notification-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notification-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .login-container {
        max-width: 100%;
        padding: 1.5rem;
        margin: 10px 0;
        border-radius: 16px;
    }
    
    .login-header {
        margin-bottom: 1.5rem;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }
    
    .logo {
        width: 100px;
        height: 100px;
        margin-bottom: 0.8rem;
    }
    
    .login-header h1 {
        font-size: 1.6rem;
    }
    
    .login-header p {
        font-size: 13px;
    }
    
    .form-group {
        margin-bottom: 1.2rem;
    }
    
    .form-input {
        padding: 16px 16px 16px 45px;
        font-size: 16px;
        border-radius: 14px;
    }
    
    .input-icon {
        left: 16px;
        font-size: 18px;
    }
    
    .password-toggle {
        right: 16px;
        font-size: 18px;
    }
    
    .code-input {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .form-options {
        margin-bottom: 1.2rem;
        font-size: 13px;
    }
    
    .custom-checkbox {
        width: 20px;
        height: 20px;
    }
    
    .custom-checkbox i {
        font-size: 14px;
    }
    
    .login-button {
        padding: 16px;
        font-size: 16px;
        border-radius: 14px;
        margin-bottom: 1.2rem;
    }
    
    .signup-link {
        margin-top: 0.8rem;
        font-size: 13px;
    }
    
    .notification {
        right: 15px;
        left: 15px;
        max-width: none;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .login-container {
        padding: 1.2rem;
        border-radius: 12px;
    }
    
    .login-header {
        margin-bottom: 1.2rem;
    }
    
    .theme-toggle {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
    
    .logo {
        width: 80px;
        height: 80px;
        margin-bottom: 0.6rem;
    }
    
    .login-header h1 {
        font-size: 1.4rem;
    }
    
    .login-header p {
        font-size: 12px;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-input {
        padding: 14px 14px 14px 42px;
        border-radius: 12px;
    }
    
    .input-icon {
        left: 14px;
        font-size: 16px;
    }
    
    .password-toggle {
        right: 14px;
        font-size: 16px;
    }
    
    .code-input {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 1rem;
    }
    
    .login-button {
        padding: 14px;
        border-radius: 12px;
        margin-bottom: 1rem;
    }
    
    .signup-link {
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .login-container {
        padding: 1rem;
    }
    
    .login-header h1 {
        font-size: 1.3rem;
    }
    
    .form-input {
        padding: 12px 12px 12px 40px;
    }
    
    .input-icon {
        left: 12px;
    }
    
    .password-toggle {
        right: 12px;
    }
    
    .code-input {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .login-button {
        padding: 12px;
    }
}