/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 50%, #dfe4ea 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-x: hidden;
    color: #1d1d1f;
    line-height: 1.6;
}

/* Auth Container with Glass Morphism */
.auth-container {
    max-width: 720px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: 50px 50px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: visible;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 620px;
}

/* Consistent height for both modes */
.auth-container.login-mode,
.auth-container.signup-mode {
    min-height: 620px;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.02), rgba(118, 75, 162, 0.02));
    pointer-events: none;
    border-radius: 25px;
}

/* Forms Container - Dynamic height management */
.forms-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Auth Header */
.auth-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
}

.auth-header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    font-weight: 800;
    letter-spacing: -0.5px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-header p {
    font-size: 1.05rem;
    color: #6c757d;
    margin-bottom: 20px;
    font-weight: 400;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Welcome Icon */
.welcome-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 25px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.3);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.welcome-icon:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.4);
}

/* Modern Toggle Container */
.toggle-container {
    position: relative;
    display: flex;
    background: rgba(102, 126, 234, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 30px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Forms Container - Dynamic height management */
.forms-container {
    position: relative;
    width: 100%;
    overflow: visible;
    padding: 5px;
    margin: -5px;
}

.toggle-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.toggle-btn:hover {
    color: #764ba2;
    transform: scale(1.02);
}

.toggle-btn.active {
    color: white;
}

.toggle-btn svg {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toggle-btn:hover svg {
    transform: scale(1.15) rotate(5deg);
}

/* Animated Slider */
.toggle-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    z-index: 1;
}

.toggle-slider.signup {
    transform: translateX(calc(100% + 4px));
}

/* Form Wrapper - Handles slide animation */
.form-wrapper {
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
    opacity: 0;
    transform: translateX(30px) scale(0.98);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    visibility: hidden;
    z-index: 1;
}

.form-wrapper.active {
    position: relative;
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: all;
    visibility: visible;
    z-index: 2;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Auth Form */
.auth-form {
    position: relative;
    z-index: 2;
}

/* Form Group */
.form-group {
    margin-bottom: 20px;
    position: relative;
    padding: 2px;
}

/* Reduced spacing for signup form */
#signupForm .form-group {
    margin-bottom: 16px;
    padding: 2px;
}

/* Password Grid - Two column layout for password fields */
.password-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    animation: fadeInGrid 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Subtle divider between password fields */
.password-grid::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 38px;
    bottom: 28px;
    width: 2px;
    background: linear-gradient(to bottom, 
        transparent, 
        rgba(102, 126, 234, 0.15) 15%, 
        rgba(118, 75, 162, 0.2) 50%,
        rgba(102, 126, 234, 0.15) 85%, 
        transparent
    );
    transform: translateX(-50%);
    opacity: 0;
    animation: dividerFadeIn 0.6s ease-out 0.2s forwards;
}

@keyframes dividerFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) scaleY(0.5);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) scaleY(1);
    }
}

@keyframes fadeInGrid {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.password-grid .form-group {
    margin-bottom: 0;
}

.password-grid .form-label {
    font-size: 12px;
    letter-spacing: 0.3px;
}

.password-grid .form-input {
    font-size: 0.9rem;
    padding: 13px 16px;
}

.password-grid .input-hint {
    font-size: 10.5px;
}

/* Responsive: Stack on small screens */
@media (max-width: 600px) {
    .password-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .password-grid .form-label {
        font-size: 13px;
    }
    
    .password-grid .form-input {
        font-size: 0.95rem;
        padding: 14px 18px;
    }
    
    .password-grid .input-hint {
        font-size: 11px;
    }
}

/* Form Label */
.form-label {
    display: block;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.label-icon {
    width: 18px;
    height: 18px;
    color: #667eea;
}

/* Form Input */
.form-input {
    width: 100%;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    font-size: 1rem;
    color: #2d3748;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

/* Compact input for signup form */
#signupForm .form-input {
    padding: 13px 18px;
    font-size: 0.95rem;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.form-input:hover {
    border-color: rgba(102, 126, 234, 0.4);
}

.form-input::placeholder {
    color: #a0aec0;
    font-size: 0.9rem;
    font-weight: 400;
}

/* Input States - Error */
.form-input.error {
    border-color: #ff3b30;
    background: rgba(255, 59, 48, 0.05);
    animation: shake 0.4s ease;
}

/* Input States - Success */
.form-input.success {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Required Star */
.required-star {
    color: #ef4444;
    font-weight: 600;
    margin-left: 4px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* Input Hint */
.input-hint {
    display: block;
    font-size: 11px;
    color: #86868b;
    margin-top: 4px;
    font-weight: 500;
}

.input-hint.error {
    color: #ff3b30;
    font-weight: 600;
}

.input-hint.success {
    color: #10b981;
    font-weight: 600;
}

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

.password-input-wrapper .form-input {
    padding-right: 50px;
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

/* Forgot Password */
.forgot-password {
    text-align: right;
    margin-bottom: 20px;
}

.forgot-password a {
    color: #667eea;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}

.forgot-password a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Auth Button with Beautiful Gradient */
.auth-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 28px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.auth-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.auth-btn:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

.auth-btn:hover:not(:disabled) {
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
    transform: translateY(-3px);
}

.auth-btn:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.auth-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

/* Company Register Section - Professional Card Design */
.company-register-section {
    margin-bottom: 35px;
}

.company-register-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border: 1.5px solid rgba(102, 126, 234, 0.2);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.company-register-card:hover {
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.12);
    transform: translateY(-2px);
}

.company-register-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.company-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.company-icon svg {
    color: white;
}

.company-text {
    flex: 1;
}

.company-text h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 6px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.company-text p {
    font-size: 0.875rem;
    color: #718096;
    margin: 0;
    line-height: 1.5;
}

.company-register-btn {
    margin-bottom: 0;
    margin-top: 0;
    width: 100%;
}

.company-register-btn svg {
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.company-register-btn:hover svg {
    transform: translateX(4px);
}

/* Company Register Divider */
.company-register-divider {
    position: relative;
    text-align: center;
    margin: 25px 0 20px;
}

.company-register-divider::before,
.company-register-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 30px);
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(102, 126, 234, 0.3), transparent);
}

.company-register-divider::before {
    left: 0;
}

.company-register-divider::after {
    right: 0;
}

.company-register-divider span {
    background: white;
    padding: 0 15px;
    color: #718096;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    position: relative;
    z-index: 2;
    margin-top: 30px;
}

/* Features Info */
.features-info {
    text-align: center;
}

.feature-icons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 12px;
}

.feature-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(10px);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.feature-icon:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    background: linear-gradient(145deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.feature-text {
    font-size: 0.9rem;
    color: #718096;
    line-height: 1.6;
    font-weight: 400;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .auth-container {
        padding: 35px 25px;
        margin: 20px 10px;
        border-radius: 25px;
    }

    .auth-header h1 {
        font-size: 2rem;
    }

    .auth-header p {
        font-size: 0.95rem;
    }

    .welcome-icon {
        width: 60px;
        height: 60px;
    }

    .toggle-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .form-input {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .auth-btn {
        padding: 14px 24px;
        font-size: 0.95rem;
    }

    .feature-icon {
        width: 38px;
        height: 38px;
    }
}

/* Accessibility - Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body {
        animation: none;
    }
}

/* Focus visible for keyboard navigation */
.auth-btn:focus-visible,
.form-input:focus-visible,
.password-toggle:focus-visible,
.toggle-btn:focus-visible,
.forgot-password a:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

/* Selection styling */
::selection {
    background: rgba(102, 126, 234, 0.3);
    color: #1d1d1f;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}
