/* Login Page Styles - Cohesive with Main Design System */

/* CSS Custom Properties for dynamic calculations */
:root {
    --header-height: 69px; /* Match the actual header height from main site */
}

/* Override body styles for login page */
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f8faf9 0%, #f1f5f9 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: #2d3748;
}

/* Fixed header positioning */
header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    height: var(--header-height) !important;
    background: linear-gradient(135deg, #b0302f 0%, #8b2635 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 2rem !important;
    box-shadow: 0 2px 20px rgba(176, 48, 47, 0.15) !important;
}

/* Professional Auth Navigation */
.auth-nav {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid transparent;
    backdrop-filter: blur(10px);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.2);
}

.nav-link:active {
    transform: translateY(0);
}

.nav-link svg {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.nav-link:hover svg {
    opacity: 1;
}

/* Active state for current page */
.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.nav-link.active svg {
    opacity: 1;
}

/* Add subtle animation for page transitions */
.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.nav-link:hover::before {
    left: 100%;
}

/* Main content container - Higher specificity to override styles.css */
body main {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: calc(100vh - var(--header-height)) !important;
    padding: 20px 20px 40px !important;
    margin-top: 0 !important;
    padding-top: calc(var(--header-height) + 1rem) !important;
    background: linear-gradient(135deg, #f8faf9 0%, #f1f5f9 100%) !important;
}

/* Login container */
.login-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(176, 48, 47, 0.05);
    width: 100%;
    max-width: 450px;
    position: relative;
    animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Page title */
.login-container h2 {
    text-align: center;
    margin: 0 0 32px 0;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #b0302f 0%, #8b2635 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.login-container h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(135deg, #b0302f 0%, #8b2635 100%);
    border-radius: 2px;
}

/* Alert Messages */
.info-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.error-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.success-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.success-message a {
    color: white;
    text-decoration: underline;
    font-weight: 600;
}

.success-message a:hover {
    text-decoration: none;
}

/* Form styling */
.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.form-group label::after {
    content: '*';
    color: #ef4444;
    margin-left: 4px;
    font-weight: 700;
}

.form-group label.optional::after {
    content: '';
}

.form-help {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 6px;
    font-style: italic;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: #ffffff;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-sizing: border-box;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #b0302f;
    box-shadow: 0 0 0 3px rgba(176, 48, 47, 0.1);
    transform: translateY(-2px);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* Validation styles */
.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.field-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-error::before {
    content: '⚠';
    font-size: 0.75rem;
}

.form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

.form-group select:disabled {
    background-color: #f1f5f9;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #d1d5db;
}

.form-group textarea {
    min-height: 100px;
    line-height: 1.5;
}

/* Password field inline toggle */
/* Hide Edge/IE built-in password reveal to avoid duplicate eye */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

.password-input-wrap { position: relative; display: block; }
.password-input-wrap > input { padding-right: 48px; }
.password-input-wrap > .password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.password-input-wrap > .password-toggle:hover { color: #374151; background: #f1f5f9; }
.password-input-wrap > .password-toggle:focus { outline: none; box-shadow: 0 0 0 3px rgba(176, 48, 47, 0.15); }
.password-input-wrap > .password-toggle svg { width: 20px; height: 20px; display: block; }
.password-input-wrap > .password-toggle .icon-eye-off { display: none; }
.password-input-wrap > .password-toggle.revealed .icon-eye { display: none; }
.password-input-wrap > .password-toggle.revealed .icon-eye-off { display: block; }

/* Login button */
.login-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #b0302f 0%, #8b2635 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 15px rgba(176, 48, 47, 0.3);
    margin-bottom: 20px;
    position: relative;
}

.login-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #912323 0%, #7a1f2e 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(176, 48, 47, 0.4);
}

.login-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(176, 48, 47, 0.3);
}

.login-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loading state for button */
.login-btn.loading {
    background: #9ca3af;
    cursor: not-allowed;
    pointer-events: none;
}

.login-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s ease infinite;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* Links styling */
.forgot-password {
    text-align: center;
    margin: 20px 0;
}

.forgot-password a,
.back-to-login a {
    color: #b0302f;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.forgot-password a:hover,
.back-to-login a:hover {
    color: #8b2635;
}

.forgot-password a::after,
.back-to-login a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, #b0302f 0%, #8b2635 100%);
    transition: width 0.3s ease;
}

.forgot-password a:hover::after,
.back-to-login a:hover::after {
    width: 100%;
}

.forgot-password p {
    margin: 0;
    color: #64748b;
    font-size: 0.95rem;
}

/* Back to login link */
.back-to-login {
    text-align: center;
    margin-top: 20px;
}

/* Recovery form (hidden by default) */
#recoveryForm {
    display: none;
}

/* Registration container (if used) */
.reg-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(176, 48, 47, 0.05);
    width: 100%;
    max-width: 500px;
    margin-top: 40px;
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Form sections for registration */
.form-section {
    margin-bottom: 32px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    transition: all 0.3s ease;
}

.form-section:hover {
    border-color: rgba(176, 48, 47, 0.2);
    background: #ffffff;
}

.form-section h3 {
    margin: 0 0 20px 0;
    color: #2d3748;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Loading text for dropdowns */
.loading-text {
    color: #6b7280;
    font-style: italic;
    font-size: 0.9rem;
}

/* Responsive design */
@media (max-width: 768px) {
    :root {
        --header-height: 69px; /* Ensure consistent header height */
    }
    
    body main {
        padding: 15px 16px 20px !important;
        margin-top: 0 !important;
        padding-top: calc(var(--header-height) + 0.75rem) !important;
        min-height: calc(100vh - var(--header-height)) !important;
        align-items: flex-start !important;
    }
    
    .login-container,
    .reg-container {
        padding: 32px 24px;
        max-width: 100%;
        margin: 0 auto; /* Center the container */
    }
    
    .login-container h2 {
        font-size: 1.75rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .login-btn {
        padding: 14px 20px;
        font-size: 1rem;
    }
    
    /* Mobile navigation adjustments */
    .nav-links {
        gap: 4px;
    }
    
    .nav-link {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .nav-link span {
        display: none; /* Hide text on very small screens */
    }
}

@media (max-width: 480px) {
    body main {
        padding: 10px 20px 20px !important;
        margin-top: 0 !important;
        padding-top: calc(var(--header-height) + 0.5rem) !important;
        align-items: flex-start !important;
        min-height: calc(100vh - var(--header-height)) !important;
    }
    
    .login-container,
    .reg-container {
        padding: 24px 20px;
        margin: 0 auto;
    }
    
    .login-container h2 {
        font-size: 1.5rem;
        margin-bottom: 24px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-section {
        padding: 20px 16px;
        margin-bottom: 24px;
    }
    
    /* Ultra mobile - show only icons */
    .nav-link {
        padding: 8px;
        min-width: 40px;
        justify-content: center;
    }
    
    .nav-link span {
        display: none;
    }
}

.form-section h3 {
    margin: 0 0 1rem 0;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid #007bff;
    padding-bottom: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Update login container for registration form */
.login-container {
    max-width: 700px;
    width: 100%;
}

/* Registration container - wider than login */
.reg-container {
    max-width: 900px;
    width: 100%;
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 2rem auto;
        margin-top: 70vh;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .form-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .login-container {
        padding: 1.5rem;
        margin-top: 70vh;
        margin: 1rem;
        max-width: 90%;
    }
    
    /* Update responsive styles for registration container */
    .reg-container {
        padding: 1.5rem;
        margin: 1rem;
            margin-top: 70vh;
        max-width: 95%;
    }
}