/* Login Page Styles */

/* Base Layout */
.login-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh; /* Better mobile support */
    background: var(--bg-primary);
    font-family: var(--font-ui);
    overflow-x: hidden;
    overflow-y: auto;
}

.login-container {
    min-height: 100vh;
    min-height: 100dvh; /* Better mobile support */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 32px);
    position: relative;
    box-sizing: border-box;
}

/* Background Elements */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(47, 129, 247, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(35, 134, 54, 0.08) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

.floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--accent-secondary), var(--accent-primary));
    opacity: 0.04;
    animation: float 25s infinite ease-in-out;
    will-change: transform;
}

.shape-1 {
    width: clamp(120px, 15vw, 200px);
    height: clamp(120px, 15vw, 200px);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: clamp(100px, 12vw, 150px);
    height: clamp(100px, 12vw, 150px);
    top: 60%;
    right: 15%;
    animation-delay: -8s;
}

.shape-3 {
    width: clamp(80px, 10vw, 100px);
    height: clamp(80px, 10vw, 100px);
    bottom: 20%;
    left: 70%;
    animation-delay: -16s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(120deg); }
    66% { transform: translateY(10px) rotate(240deg); }
}

/* Login Card */
.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    max-width: min(420px, 90vw);
    width: 100%;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
    margin: auto;
}

/* Header */
.login-header {
    text-align: center;
    padding: clamp(24px, 5vw, 32px) clamp(16px, 4vw, 24px) clamp(16px, 4vw, 24px);
    border-bottom: 1px solid var(--border-muted);
}

.logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.logo-image {
    width: clamp(40px, 8vw, 56px);
    height: clamp(40px, 8vw, 56px);
    object-fit: contain;
}

.app-title {
    font-size: clamp(20px, 5vw, 28px);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    font-size: clamp(14px, 3vw, 16px);
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

/* Form Container */
.login-form-container {
    padding: clamp(16px, 4vw, 24px);
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-1);
    margin-bottom: var(--space-6);
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab:hover {
    color: var(--text-primary);
}

.auth-tab.active {
    background: var(--accent-secondary);
    color: white;
    box-shadow: 0 2px 8px rgba(47, 129, 247, 0.3);
}

/* Messages */
.message-container {
    margin-bottom: var(--space-4);
    min-height: 0;
}

.auth-message {
    padding: var(--space-3);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    animation: slideIn 0.3s ease;
}

.auth-message-error {
    background: rgba(218, 54, 51, 0.1);
    color: #ff6b6b;
    border: 1px solid rgba(218, 54, 51, 0.2);
    position: relative;
    padding-right: 40px;
}

.message-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.message-close:hover {
    background: rgba(255, 107, 107, 0.1);
}

.auth-message-success {
    background: rgba(35, 134, 54, 0.1);
    color: #51cf66;
    border: 1px solid rgba(35, 134, 54, 0.2);
}

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

/* Form Styles */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    padding: clamp(12px, 2.5vw, 16px);
    border-radius: var(--radius-md);
    font-size: clamp(14px, 3vw, 16px);
    transition: all 0.2s ease;
    font-family: var(--font-ui);
    width: 100%;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.1);
    background: var(--bg-primary);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* Password Input */
.password-input {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: var(--text-primary);
}

.password-strength {
    margin-top: var(--space-2);
    font-size: 12px;
}

.strength-bar {
    width: 100%;
    height: 4px;
    background: var(--border-default);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--space-1);
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-fill.weak { width: 25%; background: #ff6b6b; }
.strength-fill.fair { width: 50%; background: #ffd93d; }
.strength-fill.good { width: 75%; background: #6bcf7f; }
.strength-fill.strong { width: 100%; background: #51cf66; }

.strength-text {
    color: var(--text-muted);
    font-size: 11px;
}

.password-requirements {
    margin-top: var(--space-2);
}

.requirements-text {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: var(--space-2) 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

.forgot-link {
    color: var(--accent-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.forgot-link:hover {
    color: var(--text-primary);
}

/* Buttons */
.btn-primary {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: var(--space-4);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 48px;
    position: relative;
}

.btn-primary:hover:not(:disabled) {
    background: #2ea043;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(35, 134, 54, 0.3);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-full {
    width: 100%;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}



/* Footer */
.login-footer {
    text-align: center;
    padding: clamp(12px, 3vw, 16px) clamp(16px, 4vw, 24px);
    border-top: 1px solid var(--border-muted);
    color: var(--text-muted);
    font-size: clamp(11px, 2.5vw, 12px);
}

.footer-links {
    margin-top: var(--space-2);
    display: flex;
    justify-content: center;
    gap: var(--space-4);
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--accent-secondary);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .login-container {
        align-items: flex-start;
        padding-top: clamp(32px, 8vh, 64px);
    }
}

@media (max-width: 768px) {
    .login-card {
        max-width: 95vw;
    }
    
    .form-options {
        flex-direction: column;
        gap: var(--space-2);
        align-items: flex-start;
    }
    
    .footer-links {
        flex-direction: column;
        gap: var(--space-1);
    }
    
    .floating-shapes .shape {
        opacity: 0.02; /* Reduce opacity on smaller screens */
    }
}

@media (max-width: 480px) {
    .login-card {
        max-width: 98vw;
        margin: var(--space-2) auto;
    }
    
    .floating-shapes .shape {
        display: none; /* Hide floating shapes on very small screens */
    }
    
    .background-pattern {
        opacity: 0.5; /* Reduce background pattern intensity */
    }
}

/* Landscape orientation support */
@media (max-height: 600px) and (orientation: landscape) {
    .login-container {
        align-items: flex-start;
        padding-top: var(--space-4);
        padding-bottom: var(--space-4);
    }
    
    .login-header {
        padding: var(--space-4) clamp(16px, 4vw, 24px) var(--space-3);
    }
    
    .login-form-container {
        padding: var(--space-4) clamp(16px, 4vw, 24px);
    }
    
    .floating-shapes .shape {
        display: none;
    }
}

/* Large screens optimization */
@media (min-width: 1440px) {
    .login-card {
        max-width: 440px;
    }
}

/* Loading State */
.form-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Focus Visible for Accessibility */
.auth-tab:focus-visible,
.btn-primary:focus-visible,
.btn-demo:focus-visible,
input:focus-visible,
.password-toggle:focus-visible {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .shape {
        animation: none;
    }
    
    .auth-message,
    .btn-primary,
    .form-group input,
    .auth-tab {
        transition: none;
    }
    
    .login-form-container {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* Forgot Password Specific Styles */
.back-to-login {
    text-align: center;
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-muted);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--text-primary);
}

.back-link svg {
    width: 16px;
    height: 16px;
}

/* Success Message Styles */
.success-message {
    text-align: center;
    padding: var(--space-6);
}

.success-icon {
    margin-bottom: var(--space-4);
    color: var(--accent-primary);
}

.success-message h3 {
    margin-bottom: var(--space-3);
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.success-message p {
    margin-bottom: var(--space-5);
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 14px;
}

.success-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
}

.success-actions .btn-secondary,
.success-actions .btn-primary {
    min-width: 120px;
}

/* Step Navigation for Forgot Password */
.auth-tabs[data-steps="2"] {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
}

.auth-tabs[data-steps="2"] .auth-tab {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-muted);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.auth-tabs[data-steps="2"] .auth-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.auth-tabs[data-steps="2"] .auth-tab:hover:not(.active) {
    background: var(--bg-hover);
    border-color: var(--border-default);
    color: var(--text-primary);
}

/* Password Strength Indicator */
.password-strength {
    margin-top: var(--space-2);
    font-size: 12px;
}

.password-strength-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--space-1);
}

.password-strength-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 2px;
}

.password-strength-fill.weak {
    background: var(--accent-danger);
    width: 25%;
}

.password-strength-fill.fair {
    background: #f59e0b;
    width: 50%;
}

.password-strength-fill.good {
    background: #10b981;
    width: 75%;
}

.password-strength-fill.strong {
    background: var(--accent-primary);
    width: 100%;
}

.password-strength-text {
    color: var(--text-muted);
    font-size: 11px;
}

/* Token Input Styling */
#resetToken {
    font-family: var(--font-mono);
    letter-spacing: 1px;
    text-align: center;
    font-size: 16px;
}

/* Responsive adjustments for forgot password */
@media (max-width: 480px) {
    .success-actions {
        flex-direction: column;
    }
    
    .success-actions .btn-secondary,
    .success-actions .btn-primary {
        width: 100%;
    }
    
    .auth-tabs[data-steps="2"] .auth-tab {
        font-size: 12px;
        padding: var(--space-2);
    }
}
