/* 
 * Authentication System CSS
 * Mobile-first design system for authentication forms
 * Based on homepage color scheme and modern UX practices
 */

:root {
    /* Color Palette from Homepage */
    --primary-color: #7367f0;
    --primary-hover: #5e50ee;
    --primary-light: rgba(115, 103, 240, 0.1);
    --secondary-color: #0b92d4;
    --secondary-hover: #0878b8;
    --secondary-light: rgba(11, 146, 212, 0.1);
    
    /* Accent Colors */
    --accent-gradient: linear-gradient(45deg, #ffd700, #ffa500);
    --gold-primary: #ffd700;
    --gold-secondary: #ffa500;
    
    /* Status Colors */
    --success-color: #28c76f;
    --success-light: rgba(40, 199, 111, 0.1);
    --danger-color: #ea5455;
    --danger-light: rgba(234, 84, 85, 0.1);
    --warning-color: #ff9f43;
    --warning-light: rgba(255, 159, 67, 0.1);
    --info-color: #1e9ff2;
    --info-light: rgba(30, 159, 242, 0.1);
    
    /* Text Colors */
    --text-dark: #2d3748;
    --text-medium: #4a5568;
    --text-muted: #718096;
    --text-light: #a0aec0;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-light: #f7fafc;
    --bg-lighter: #fafbfc;
    --bg-overlay: rgba(255, 255, 255, 0.8);
    
    /* Border Colors */
    --border-color: #e2e8f0;
    --border-focus: #cbd5e0;
    --border-hover: #b3bcc7;
    
    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.2);
    
    /* Border Radius */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Typography */
    --font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-Index */
    --z-base: 1;
    --z-overlay: 10;
    --z-modal: 1000;
    --z-tooltip: 1100;
}

/* Global Reset and Base Styles */
* {
    font-family: var(--font-family);
}

.auth-system {
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-dark);
}

/* Authentication Section Base */
.auth-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    padding: var(--space-md) 0;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255, 215, 0, 0.1) 0%, transparent 50%);
    animation: authFloat 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes authFloat {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg); 
    }
    50% { 
        transform: translateY(-20px) rotate(1deg); 
    }
}

/* Authentication Card */
.auth-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-lg);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    position: relative;
    z-index: var(--z-base);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Header */
.auth-header {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.auth-logo img {
    height: 48px;
    width: auto;
    margin-bottom: var(--space-md);
}

.auth-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--space-sm);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.auth-subtitle {
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* Social Login Section */
.social-auth-section {
    margin-bottom: var(--space-lg);
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px var(--space-md);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: var(--font-size-sm);
    border: 1.5px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-dark);
    text-decoration: none;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    min-height: 48px; /* Touch target size */
    width: 100%;
    margin-bottom: var(--space-sm);
}

.btn-social::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left var(--transition-slow);
}

.btn-social:hover::before {
    left: 100%;
}

.btn-social:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-focus);
    text-decoration: none;
}

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

.btn-google:hover {
    border-color: #db4437;
    color: #db4437;
}

.btn-facebook:hover {
    border-color: #4267b2;
    color: #4267b2;
}

/* Divider */
.divider {
    position: relative;
    text-align: center;
    margin: var(--space-lg) 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    background: var(--bg-primary);
    padding: 0 var(--space-md);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: var(--space-sm);
}

.form-control,
.form-control-lg {
    width: 100%;
    height: 48px;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-color);
    padding: 0 14px;
    transition: all var(--transition-normal);
    background: var(--bg-overlay);
    backdrop-filter: blur(10px);
    font-family: var(--font-family);
}

.form-control:focus,
.form-control-lg:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-primary);
    outline: none;
}

.form-control::placeholder,
.form-control-lg::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Input Groups */
.input-group {
    display: flex;
    width: 100%;
}

.input-group-text {
    background: var(--bg-overlay);
    border: 1.5px solid var(--border-color);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    color: var(--text-muted);
    backdrop-filter: blur(10px);
    padding: 0 12px;
    display: flex;
    align-items: center;
    font-size: var(--font-size-base);
}

.input-group .form-control,
.input-group .form-control-lg {
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group:focus-within .input-group-text {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.password-toggle {
    cursor: pointer;
    border-left: none !important;
    background: var(--bg-overlay) !important;
    transition: color var(--transition-normal);
}

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

/* Form Feedback */
.form-feedback {
    font-size: var(--font-size-xs);
    margin-top: var(--space-xs);
    line-height: 1.4;
}

.form-feedback.valid {
    color: var(--success-color);
}

.form-feedback.invalid {
    color: var(--danger-color);
}

.form-control.is-valid {
    border-color: var(--success-color);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px var(--space-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-family);
    border-radius: var(--radius-md);
    border: 1.5px solid transparent;
    text-decoration: none;
    transition: all var(--transition-normal);
    cursor: pointer;
    min-height: 48px; /* Touch target */
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-slow);
}

.btn:hover::before {
    left: 100%;
}

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

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: white;
}

.btn-success {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #24b263;
    border-color: #24b263;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: white;
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--primary-color);
    text-decoration: none;
    padding: var(--space-sm) 0;
    font-weight: 500;
}

.btn-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.btn-ghost {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-dark);
}

.btn-ghost:hover {
    background: var(--bg-light);
    border-color: var(--border-focus);
}

/* Button Sizes */
.btn-sm {
    padding: 8px var(--space-md);
    font-size: var(--font-size-xs);
    min-height: 36px;
}

.btn-lg {
    padding: 16px var(--space-xl);
    font-size: var(--font-size-base);
    min-height: 56px;
}

/* Form Check (Checkboxes, Radio) */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.form-check-input {
    width: 18px;
    height: 18px;
    margin: 0;
    border-radius: var(--radius-xs);
    border: 1.5px solid var(--border-color);
    background: var(--bg-primary);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 2px var(--primary-light);
    outline: none;
}

.form-check-label {
    font-size: var(--font-size-sm);
    color: var(--text-dark);
    cursor: pointer;
    user-select: none;
}

/* Progressive Form Steps */
.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: stepSlideIn 0.3s ease;
}

@keyframes stepSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mode Selector */
.login-mode-selector {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 3px;
    margin-bottom: var(--space-md);
}

.mode-tabs {
    display: flex;
    gap: 2px;
}

.mode-tab {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 500;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    transition: all var(--transition-normal);
    cursor: pointer;
    min-height: 44px; /* Touch target */
}

.mode-tab:hover {
    color: var(--text-dark);
    background: rgba(255, 255, 255, 0.7);
}

.mode-tab.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

/* Password Strength Indicator */
.password-strength {
    margin-top: var(--space-sm);
}

.strength-meter {
    height: 4px;
    background: var(--bg-light);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--space-xs);
}

.strength-fill {
    height: 100%;
    transition: all var(--transition-normal);
    border-radius: 2px;
}

.strength-text {
    font-size: var(--font-size-xs);
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.password-requirements {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.password-requirements .req {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    transition: color var(--transition-normal);
}

.password-requirements .req.valid {
    color: var(--success-color);
}

/* Role Selection */
.role-selection {
    margin-bottom: var(--space-lg);
}

.role-option {
    margin-bottom: var(--space-md);
    cursor: pointer;
}

.role-card {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: all var(--transition-normal);
    background: var(--bg-primary);
}

.role-option.selected .role-card {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.role-card:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-xs);
}

.role-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-size-xl);
    flex-shrink: 0;
}

.role-content {
    flex: 1;
}

.role-content h6 {
    margin: 0 0 var(--space-xs) 0;
    font-weight: 600;
    color: var(--text-dark);
    font-size: var(--font-size-base);
}

.role-content p {
    margin: 0;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

.role-check {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.role-option.selected .role-check {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Magic Link */
.magic-description {
    text-align: center;
    padding: var(--space-lg) 0;
}

.magic-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    color: white;
    font-size: var(--font-size-2xl);
}

.magic-description h5 {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-lg);
}

.magic-description p {
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--text-muted);
}

/* Security Info */
.security-info {
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-md);
    margin-top: var(--space-lg);
}

.security-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--success-color);
    font-size: var(--font-size-xs);
    font-weight: 500;
}

/* Footer */
.auth-footer {
    text-align: center;
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: var(--z-modal);
}

.loading-content {
    text-align: center;
    color: white;
}

/* Alerts */
.alert {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-light);
    border-color: rgba(40, 199, 111, 0.2);
    color: #276749;
}

.alert-danger {
    background: var(--danger-light);
    border-color: rgba(234, 84, 85, 0.2);
    color: #c53030;
}

.alert-warning {
    background: var(--warning-light);
    border-color: rgba(255, 159, 67, 0.2);
    color: #d69e2e;
}

.alert-info {
    background: var(--info-light);
    border-color: rgba(30, 159, 242, 0.2);
    color: #2b6cb0;
}

/* Spinner */
.spinner-border {
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-rotate 0.75s linear infinite;
}

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

/* Responsive Design */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .auth-card {
        padding: var(--space-xl);
        max-width: 460px;
    }
    
    .auth-title {
        font-size: var(--font-size-3xl);
    }
    
    .auth-subtitle {
        font-size: var(--font-size-base);
    }
    
    .btn-social {
        padding: 14px var(--space-lg);
        font-size: var(--font-size-base);
    }
    
    .form-control,
    .form-control-lg {
        height: 52px;
        padding: 0 var(--space-md);
    }
    
    .btn {
        padding: 14px var(--space-xl);
        font-size: var(--font-size-base);
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .auth-section {
        padding: var(--space-xl) 0;
    }
    
    .auth-card {
        max-width: 500px;
        padding: var(--space-2xl);
    }
    
    .role-card {
        padding: var(--space-xl);
    }
    
    .magic-description {
        padding: var(--space-xl) 0;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .auth-card {
        max-width: 540px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn-social, 
    .btn, 
    .mode-tab, 
    .role-card {
        min-height: 52px;
    }
    
    .form-control,
    .form-control-lg {
        min-height: 52px;
    }
    
    /* Increase touch targets */
    .form-check-input {
        width: 20px;
        height: 20px;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .auth-section::before {
        animation: none;
    }
}

/* Dark mode support (future-proofing) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a202c;
        --bg-light: #2d3748;
        --bg-lighter: #2d3748;
        --text-dark: #f7fafc;
        --text-muted: #a0aec0;
        --border-color: #4a5568;
        --border-focus: #718096;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-muted: #000000;
    }
    
    .btn {
        border-width: 2px;
    }
    
    .form-control,
    .form-control-lg {
        border-width: 2px;
    }
}

/* Print styles */
@media print {
    .auth-section::before,
    .loading-overlay,
    .btn::before {
        display: none !important;
    }
    
    .auth-section {
        background: white !important;
        color: black !important;
    }
} 