/* CSS Custom Properties for theming */
:root {
    /* Purple color palette inspired by HARFY - matching the image */
    --primary-purple: #9333EA;
    --primary-magenta: #D946EF;
    --accent-purple: #A855F7;
    --dark-purple: #6B21A8;
    
    /* Much darker theme colors - matching HARFY background */
    --bg-primary: #0A0A0A;
    --bg-secondary: #111111;
    --bg-card: #1A1A1A;
    --bg-input: #222222;
    
    /* Text colors */
    --text-primary: #FFFFFF;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    /* State colors */
    --error-color: #EF4444;
    --success-color: #10B981;
    
    /* Shadows and effects */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.25);
    --shadow-purple: 0 4px 20px rgba(147, 51, 234, 0.3);
    
    /* Animations */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background overlay with gradient */
.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        var(--bg-primary) 0%,
        #0f0f0f 25%,
        #151515  50%,
        #0a0a0a 75%,
        var(--bg-primary) 100%
    );
    z-index: -1;
}

.background-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at top left,
        rgba(147, 51, 234, 0.08) 0%,
        transparent 50%
    ),
    radial-gradient(
        ellipse at bottom right,
        rgba(217, 70, 239, 0.08) 0%,
        transparent 50%
    );
}

/* Main container */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* Login card */
.login-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--primary-purple),
        var(--primary-magenta),
        var(--primary-purple)
    );
}

/* Form header */
.form-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-container {
    margin-bottom: 24px;
}

.header-logo {
    width: 60px;
    height: 60px;
    opacity: 0.9;
}

.form-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
}

/* Form toggle buttons */
.form-toggle {
    display: flex;
    background: var(--bg-input);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 32px;
    gap: 4px;
}

.toggle-btn {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.toggle-btn.active {
    background: var(--primary-purple);
    color: white;
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.3);
}

.toggle-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Form styles */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    transition: all var(--transition-normal);
}

.auth-form.hidden {
    display: none;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.input-field {
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-normal);
    outline: none;
}

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

.input-field:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
    transform: translateY(-1px);
}

.input-field:hover:not(:focus) {
    border-color: rgba(147, 51, 234, 0.3);
}

/* Error messages */
.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-5px);
    transition: all var(--transition-fast);
    min-height: 20px;
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Auth button */
.auth-button {
    position: relative;
    width: 100%;
    padding: 16px 24px;
    background: var(--primary-purple);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    overflow: hidden;
    margin-top: 8px;
}

.auth-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
    background: var(--accent-purple);
}

.auth-button:active {
    transform: translateY(0);
}

.auth-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.button-text {
    display: inline-block;
    transition: opacity var(--transition-fast);
}

.button-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    opacity: 0;
    animation: spin 1s linear infinite;
}

.auth-button.loading .button-text {
    opacity: 0;
}

.auth-button.loading .button-loader {
    opacity: 1;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Form message */
.form-message {
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
}

.form-message.show {
    opacity: 1;
    transform: translateY(0);
}

.form-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.form-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Form footer */
.form-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.demo-link {
    color: var(--primary-purple);
    text-decoration: underline;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    text-underline-offset: 4px;
}

.demo-link:hover {
    color: var(--primary-magenta);
    transform: translateY(-1px);
}

.forgot-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}

.forgot-link:hover {
    color: var(--primary-purple);
    transform: translateY(-1px);
}

.forgot-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--primary-purple);
    transition: width var(--transition-normal);
}

.forgot-link:hover::after {
    width: 100%;
}

/* Responsive design */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    .login-card {
        padding: 32px 24px;
        border-radius: 16px;
    }
    
    .login-title {
        font-size: 1.75rem;
    }
    
    .input-field {
        padding: 14px 16px;
    }
    
    .login-button {
        padding: 14px 20px;
    }
}

@media (max-width: 360px) {
    .login-card {
        padding: 24px 20px;
    }
    
    .login-title {
        font-size: 1.5rem;
    }
}

/* Focus styles for accessibility */
.auth-button:focus-visible,
.toggle-btn:focus-visible,
.forgot-link:focus-visible {
    outline: 2px solid var(--primary-purple);
    outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
