/* Modern Auth Forms - PayNacion */
/* Beautiful and Interactive Authentication Forms */

:root {
    --brand-primary: #2563EB;
    --brand-secondary: #1E40AF;
    --brand-success: #10B981;
    --brand-danger: #EF4444;
    --brand-warning: #F59E0B;
    
    --gradient-primary: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.2));
    
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    
    --bg-white: #FFFFFF;
    --bg-light: #F8FAFC;
    --bg-lighter: #F1F5F9;
    
    --border-light: #E2E8F0;
    --border-primary: #CBD5E1;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* CRITICAL: Force square checkbox on all mobile devices v2.0 */
@media (max-width: 768px) {
    input[type="checkbox"].checkbox,
    .checkbox-group .checkbox,
    input.checkbox {
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        max-width: 22px !important;
        min-height: 22px !important;
        max-height: 22px !important;
        aspect-ratio: 1 / 1 !important;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        border-radius: 4px !important;
    }
    
    /* Also fix the checkmark position */
    input[type="checkbox"].checkbox:checked::after,
    .checkbox-group .checkbox:checked::after,
    input.checkbox:checked::after {
        top: 2px !important;
        left: 7px !important;
        width: 5px !important;
        height: 10px !important;
    }
}

/* Auth Container */
.auth-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.3);
    overflow: hidden;
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
    position: relative;
}

/* Removed blue top bar */

/* Auth Content */
.auth-content {
    padding: var(--space-8);
}

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

.auth-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Tab Navigation */
.auth-tabs {
    display: flex;
    background: var(--bg-lighter);
    border-radius: var(--radius-lg);
    padding: 4px;
    margin-bottom: var(--space-8);
    position: relative;
}

.auth-tab {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
    border: none;
    background: transparent;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.auth-tab-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.auth-tab.active {
    color: var(--brand-primary);
}

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

/* Form Styles */
.auth-forms-container {
    position: relative;
    overflow: hidden;
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-form {
    width: 100%;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    display: none;
}

.auth-form.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    display: block;
    position: static;
}

.auth-form.slide-left {
    transform: translateX(-100%);
    opacity: 0;
}

.auth-form.slide-right {
    transform: translateX(100%);
    opacity: 0;
}

.auth-form.slide-in-left {
    transform: translateX(-100%);
    opacity: 0;
}

.auth-form.slide-in-right {
    transform: translateX(100%);
    opacity: 0;
}

/* Form Groups */
.form-group {
    margin-bottom: var(--space-4);
    position: relative;
    width: 100%;
    display: block;
    contain: layout;
    transition: margin-bottom 0.3s ease;
}

.form-group.has-error {
    margin-bottom: calc(var(--space-4) + 28px);
}

/* Password fields with strength indicator should not affect icon position */
.form-group:has(.password-strength) .input-group .input-icon {
    position: absolute !important;
    right: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 150 !important;
}

/* Phone input group needs special handling for dropdown */
.form-group:has(.phone-input-group),
.form-group.phone-group {
    contain: none !important;
    overflow: visible !important;
    z-index: 1000000;
}

.form-group.floating {
    position: relative;
}

/* Form Labels */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    transition: var(--transition);
}

.form-label.floating {
    position: absolute;
    top: 50%;
    left: var(--space-4);
    transform: translateY(-50%);
    background: var(--bg-white);
    padding: 0 var(--space-2);
    pointer-events: none;
    transition: var(--transition);
    z-index: 3;
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: var(--space-4);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    box-sizing: border-box;
    position: relative;
    z-index: 2;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-focus);
}

.form-control:focus + .form-label.floating,
.form-control:not(:placeholder-shown) + .form-label.floating {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--brand-primary);
    font-weight: 600;
}

.form-control.error {
    border-color: var(--brand-danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-control.success {
    border-color: var(--brand-success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Input Icons */
.input-group {
    position: relative;
    width: 100%;
    display: block;
    vertical-align: top;
    isolation: isolate;
}

.input-group .form-control {
    width: 100% !important;
    border-radius: var(--radius-lg) !important;
    padding-right: 50px !important; /* Make space for icon */
    border: 2px solid var(--border-light) !important;
    box-sizing: border-box !important;
    position: relative !important;
}

.input-group .form-control:focus {
    outline: none !important;
    border-color: var(--brand-primary) !important;
    box-shadow: var(--shadow-focus) !important;
}

.input-icon {
    position: absolute !important;
    right: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: var(--text-light) !important;
    transition: color 0.2s ease !important;
    z-index: 100 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    font-size: 1rem !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.input-icon:hover {
    color: var(--brand-primary) !important;
}

.input-group .form-control:focus ~ .input-icon {
    color: var(--brand-primary) !important;
}

/* Phone Input Special Styling */
.phone-input-group {
    position: relative;
}

/* Basic intl-tel-input styling */
.iti {
    width: 100%;
    display: block;
}

.iti__flag-container {
    background: transparent;
    border: none;
    transition: var(--transition);
}

.iti__selected-flag {
    background: transparent;
    border: none;
    padding: 0 8px 0 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-right: 1px solid var(--border-light);
}

.iti__arrow {
    border-top: 3px solid var(--text-light);
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    margin-left: 4px;
}

/* Phone input field */
.phone-input {
    width: 100%;
    padding: var(--space-4);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    box-sizing: border-box;
}

.phone-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-focus);
}

/* When phone input is focused, also style the flag container */
.iti--allow-dropdown input:focus + .iti__flag-container,
.iti__flag-container:focus {
    border-color: var(--brand-primary);
}

/* Country dropdown */
.iti__country-list {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    background: var(--bg-white);
    max-height: 200px;
    overflow-y: auto;
    z-index: 999999 !important;
}

.iti__country {
    padding: var(--space-2) var(--space-3);
    transition: var(--transition);
}

.iti__country:hover {
    background-color: var(--bg-lighter);
}

.iti__country.iti__highlight {
    background-color: var(--brand-primary);
    color: var(--bg-white);
}

.iti__flag {
    margin-right: var(--space-2);
}

.iti__country-name {
    color: var(--text-primary);
    margin-right: var(--space-2);
}

.iti__dial-code {
    color: var(--text-secondary);
}

/* Error Messages */
.form-error {
    display: flex;
    color: var(--brand-danger);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: var(--space-2);
    align-items: center;
    gap: var(--space-1);
    position: absolute;
    width: 100%;
    top: 100%;
    left: 0;
    z-index: 5;
    background: transparent;
    padding-top: 4px;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.form-error.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

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

/* Success Messages */
.form-success {
    color: var(--brand-success);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-1);
    animation: slideDown 0.3s ease-out;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: var(--space-2);
    display: none;
    position: relative;
    z-index: 1;
}

.password-strength.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

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

.strength-fill {
    height: 100%;
    width: 0%;
    transition: var(--transition);
    border-radius: var(--radius-sm);
}

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

.strength-fill.fair {
    background: var(--brand-warning);
    width: 50%;
}

.strength-fill.good {
    background: var(--brand-primary);
    width: 75%;
}

.strength-fill.strong {
    background: var(--brand-success);
    width: 100%;
}

.strength-text {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Auth Button */
.btn-auth {
    width: 100%;
    height: 52px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--gradient-primary);
    color: var(--bg-white);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.btn-auth::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: var(--transition);
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

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

.btn-auth:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-auth.loading {
    pointer-events: none;
}

.btn-auth .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid var(--bg-white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-auth.loading .spinner {
    display: block;
}

.btn-auth.loading .btn-text {
    display: none;
}

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

/* Alert Messages */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    font-weight: 500;
    border: none;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    animation: slideDown 0.3s ease-out;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border-left: 4px solid var(--brand-success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border-left: 4px solid var(--brand-danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    border-left: 4px solid var(--brand-warning);
}

/* Remember Me Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
}

.checkbox {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    max-width: 18px;
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-sm);
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-white);
    flex-shrink: 0;
}

.checkbox:checked {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.checkbox:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid var(--bg-white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    background: transparent;
}

.checkbox-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Touch and hover states for better mobile experience */
.checkbox:hover:not(:checked) {
    border-color: var(--brand-primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.checkbox:active {
    transform: scale(0.95);
}

/* Disabled checkbox styles */
.checkbox:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--border-light);
    background-color: var(--bg-lighter);
}

.checkbox:disabled:checked {
    background-color: var(--text-light);
    border-color: var(--text-light);
}

.checkbox:disabled + .checkbox-label {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Better touch targets for mobile */
@media (hover: none) and (pointer: coarse) {
    .checkbox-group {
        padding: var(--space-3) 0;
        min-height: 48px;
    }
    
    .checkbox {
        width: 24px;
        height: 24px;
    }
    
    .checkbox:checked::after {
        top: 4px;
        left: 8px;
        width: 5px;
        height: 11px;
        border-width: 0 3px 3px 0;
    }
}

/* Forgot Password Link */
.forgot-password {
    text-align: center;
    margin-top: var(--space-4);
}

.forgot-password a {
    color: var(--brand-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.forgot-password a:hover {
    color: var(--brand-secondary);
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .auth-container {
        max-width: 100%;
        margin: var(--space-4);
        border-radius: var(--radius-xl);
    }
    
    .auth-content {
        padding: var(--space-6);
    }
    
    .auth-title {
        font-size: 1.5rem;
    }
    
    .form-control {
        padding: var(--space-3);
        font-size: 0.875rem;
    }
    
    .btn-auth {
        height: 48px;
        font-size: 0.875rem;
    }
    
    /* Mobile checkbox improvements */
    .checkbox {
        width: 20px;
        height: 20px;
        border-width: 2px;
    }
    
    .checkbox:checked::after {
        top: 2px;
        left: 6px;
        width: 4px;
        height: 9px;
        border-width: 0 2px 2px 0;
    }
    
    .checkbox-label {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    .auth-forms-container {
        /* Dynamic height on mobile too */
    }
    
    .auth-form.slide-left {
        transform: translateX(-100%);
    }
    
    .auth-form.slide-right {
        transform: translateX(100%);
    }
    
    .auth-form.slide-in-left {
        transform: translateX(-100%);
    }
    
    .auth-form.slide-in-right {
        transform: translateX(100%);
    }
}

@media (max-width: 480px) {
    .auth-container {
        margin: var(--space-2);
    }
    
    .auth-content {
        padding: var(--space-4);
    }
    
    .auth-tabs {
        margin-bottom: var(--space-6);
    }
    
    .form-group {
        margin-bottom: var(--space-4);
    }
    
    /* Extra small screen checkbox improvements */
    .checkbox-group {
        padding: var(--space-2) 0;
        min-height: 44px; /* Better touch target */
        align-items: flex-start;
    }
    
    .checkbox {
        width: 22px;
        height: 22px;
        margin-top: 2px; /* Align with text baseline */
        min-width: 22px; /* Prevent compression */
        max-width: 22px; /* Prevent expansion */
    }
    
    .checkbox:checked::after {
        top: 2px;
        left: 7px;
        width: 5px;
        height: 10px;
    }
    
    .checkbox-label {
        font-size: 1rem;
        line-height: 1.5;
        padding-left: var(--space-1);
    }
}

/* Extra fix for very small screens to ensure square checkbox */
@media (max-width: 768px) {
    .checkbox {
        box-sizing: border-box !important;
        aspect-ratio: 1 / 1 !important; /* Force square ratio */
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        max-width: 22px !important;
        min-height: 22px !important;
        max-height: 22px !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
    }
}

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

/* Focus indicators for accessibility */
.auth-tab:focus-visible,
.btn-auth:focus-visible,
.checkbox:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control {
        border-width: 3px;
    }
    
    .btn-auth {
        border: 2px solid var(--brand-primary);
    }
} 