/* Add these vendor prefixes for maximum browser compatibility */
/* Place at the TOP of your auth.css file */

/* Flexbox prefixes for IE 10-11 */
.auth-container {
    display: -webkit-box;      /* OLD - iOS 6-, Safari 3.1-6 */
    display: -moz-box;         /* OLD - Firefox 19- */
    display: -ms-flexbox;      /* TWEENER - IE 10 */
    display: -webkit-flex;     /* NEW - Chrome */
    display: flex;             /* NEW, Spec - Opera 12.1, Firefox 20+ */
    
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.auth-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 12px;
    -webkit-border-radius: 12px;
    -moz-border-radius: 12px;
    -moz-box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    -webkit-box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        -webkit-transform: translateY(20px);
        -ms-transform: translateY(20px);
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        -webkit-transform: translateY(0);
        -ms-transform: translateY(0);
        transform: translateY(0);
    }
}

.brand-title {
    color: #2563eb;
    font-weight: 700;
    font-size: 1.75rem;
    margin-bottom: 8px;
    line-height: 1.2;
}

/* Form Elements */
.form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-control {
    border: 1px solid #e2e8f0;
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    -webkit-transition: all 0.2s;
    -moz-transition: all 0.2s;
    -ms-transition: all 0.2s;
    -o-transition: all 0.2s;
    transition: all 0.2s;
    width: 100%;
}

.form-control:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* Password Toggle */
.password-input-container {
    position: relative;
    display: block;
    width: 100%;
}

.password-input-container input {
    padding-right: 45px !important;
    width: 100% !important;
    box-sizing: border-box;
}

.toggle-password-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    -webkit-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    transform: translateY(-50%);
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s;
    z-index: 10;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    margin: 0;
    border: none;
    background: transparent;
}

.toggle-password-icon:hover {
    color: #374151;
}

/* Buttons */
.btn {
    border-radius: 8px;
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    padding: 12px 24px;
    font-weight: 500;
    -webkit-transition: all 0.2s;
    -moz-transition: all 0.2s;
    -ms-transition: all 0.2s;
    -o-transition: all 0.2s;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    -webkit-transform: translateY(-1px);
    -ms-transform: translateY(-1px);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:disabled {
    background: #94a3b8;
    border-color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.w-100 {
    width: 100%;
}

/* Links */
.text-decoration-none {
    color: #2563eb;
    transition: color 0.2s;
    text-decoration: none;
}

.text-decoration-none:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
}

.alert i {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Checkbox */
.form-check {
    display: flex;
    align-items: center;
    padding-left: 0;
}

.form-check-input {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.form-check-label {
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    margin-bottom: 0;
}

/* Text Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: #6b7280;
}

.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-3 { margin-top: 16px; }
.d-block { display: block; }

/* ========== TABLET (768px - 1024px) ========== */
@media (max-width: 1024px) and (min-width: 768px) {
    .auth-card {
        max-width: 500px;
        padding: 48px;
    }

    .brand-title {
        font-size: 1.875rem;
    }

    .form-control {
        font-size: 15px;
        padding: 14px 18px;
    }

    .btn {
        padding: 14px 28px;
        font-size: 15px;
    }
}

/* ========== MOBILE (up to 767px) ========== */
@media (max-width: 767px) {
    .auth-container {
        padding: 16px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .auth-card {
        padding: 28px 24px;
        max-width: 100%;
        border-radius: 10px;
    }

    .brand-title {
        font-size: 1.5rem;
        margin-bottom: 6px;
    }

    .text-muted {
        font-size: 14px;
    }

    .form-control {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 12px 14px;
    }

    .password-input-container input {
        padding-right: 42px !important;
    }

    .toggle-password-icon {
        right: 10px;
        font-size: 20px;
        padding: 6px;
    }

    .btn {
        padding: 14px 20px;
        font-size: 15px;
        font-weight: 600;
    }

    .form-text {
        font-size: 13px;
    }

    .form-check-label {
        font-size: 15px;
    }

    /* Make alerts more compact */
    .alert {
        padding: 10px 14px;
        font-size: 13px;
    }

    .alert i {
        font-size: 16px;
    }

    /* Spacing adjustments */
    .mb-3 { margin-bottom: 14px; }
    .mb-4 { margin-bottom: 20px; }
}

/* ========== SMALL MOBILE (up to 480px) ========== */
@media (max-width: 480px) {
    .auth-container {
        padding: 12px;
        padding-top: 30px;
    }

    .auth-card {
        padding: 24px 20px;
        border-radius: 8px;
        box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.15);
    }

    .brand-title {
        font-size: 1.35rem;
        word-break: break-word;
    }

    .text-muted {
        font-size: 13px;
    }

    .form-control {
        font-size: 16px; /* Important: prevents iOS zoom */
        padding: 11px 12px;
    }

    textarea.form-control {
        min-height: 70px;
    }

    .password-input-container input {
        padding-right: 40px !important;
    }

    .toggle-password-icon {
        right: 8px;
        font-size: 19px;
    }

    .btn {
        padding: 13px 18px;
        font-size: 15px;
    }

    .form-check-input {
        width: 16px;
        height: 16px;
    }

    /* Make links more tappable */
    .text-decoration-none {
        display: inline-block;
        padding: 4px 0;
        font-size: 14px;
    }
}

/* ========== EXTRA SMALL MOBILE (up to 360px) ========== */
@media (max-width: 360px) {
    .auth-container {
        padding: 8px;
        padding-top: 20px;
    }

    .auth-card {
        padding: 20px 16px;
    }

    .brand-title {
        font-size: 1.25rem;
    }

    .form-control {
        padding: 10px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* ========== DARK MODE SUPPORT ========== */
@media (prefers-color-scheme: dark) {
    .auth-container {
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    }

    .auth-card {
        background: #1e293b;
        border: 1px solid #334155;
        color: #f8fafc;
    }

    .brand-title {
        color: #60a5fa;
    }

    .form-label {
        color: #e2e8f0;
    }

    .form-control {
        background: #334155;
        border-color: #475569;
        color: #f8fafc;
    }

    .form-control:focus {
        border-color: #60a5fa;
        background: #334155;
        color: #f8fafc;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }

    .form-control::placeholder {
        color: #94a3b8;
    }

    .form-text {
        color: #94a3b8;
    }

    .btn-primary {
        background: #60a5fa;
        border-color: #60a5fa;
        color: #0f172a;
    }

    .btn-primary:hover {
        background: #3b82f6;
        border-color: #3b82f6;
        color: #0f172a;
    }

    .btn-primary:disabled {
        background: #475569;
        border-color: #475569;
        color: #94a3b8;
    }

    .toggle-password-icon {
        color: #94a3b8;
    }

    .toggle-password-icon:hover {
        color: #cbd5e1;
    }

    .text-decoration-none {
        color: #60a5fa;
    }

    .text-decoration-none:hover {
        color: #3b82f6;
    }

    .text-muted {
        color: #94a3b8;
    }

    .form-check-label {
        color: #e2e8f0;
    }

    .alert-error {
        background: #450a0a;
        color: #fca5a5;
        border-color: #7f1d1d;
    }

    .alert-success {
        background: #052e16;
        color: #86efac;
        border-color: #166534;
    }
}

/* ========== LANDSCAPE MOBILE FIX ========== */
@media (max-height: 600px) and (orientation: landscape) {
    .auth-container {
        padding: 16px;
        align-items: flex-start;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .auth-card {
        padding: 20px 24px;
        margin: 0 auto;
    }

    .brand-title {
        font-size: 1.35rem;
    }

    .mb-3 { margin-bottom: 12px; }
    .mb-4 { margin-bottom: 16px; }
}

/* ========== HIGH DPI SCREENS ========== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .form-control {
        border-width: 0.5px;
    }

    .toggle-password-icon {
        -webkit-font-smoothing: antialiased;
    }
}

/* ========== ACCESSIBILITY IMPROVEMENTS ========== */
.form-control:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.toggle-password-icon:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    .auth-container {
        background: white;
        padding: 0;
    }

    .auth-card {
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }

    .btn,
    .toggle-password-icon {
        display: none;
    }
}