/**
 * Testd - Authentication Page Styles
 * Login and Message pages
 * Teal/green theme for QA testing platform
 */

/* CSS Variables for Auth Pages */
:root {
    /* Teal Color Palette */
    --primary: #14b8a6;
    --primary-dark: #0f766e;
    --primary-light: #5eead4;
    --primary-hover: #0d9488;
    --primary-bg: rgba(20, 184, 166, 0.08);
    --primary-glow: rgba(20, 184, 166, 0.25);

    /* Accent Colors */
    --accent-coral: #ef4444;
    --accent-gold: #f59e0b;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Text */
    --text-dark: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Backgrounds */
    --bg-overlay: linear-gradient(135deg, rgba(15, 23, 42, 0.4) 0%, rgba(30, 41, 59, 0.5) 100%);
    --modal-bg: rgba(255, 255, 255, 0.85);

    /* Borders */
    --border-light: rgba(91, 191, 179, 0.15);

    /* Shadows */
    --shadow-soft: 0 25px 80px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 60px rgba(91, 191, 179, 0.15);

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Keyframe Animations */
@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

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

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-30px) rotate(180deg);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Base */
body.auth-page {
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Floating Particles - Teal themed */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    background: linear-gradient(135deg, rgba(91, 191, 179, 0.4) 0%, rgba(109, 213, 199, 0.3) 100%);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(91, 191, 179, 0.3);
}

.particle:nth-child(1) {
    left: 10%; top: 20%;
    width: 12px; height: 12px;
    animation-delay: 0s;
    animation-duration: 10s;
}
.particle:nth-child(2) {
    left: 20%; top: 80%;
    width: 18px; height: 18px;
    animation-delay: 1.5s;
    animation-duration: 8s;
}
.particle:nth-child(3) {
    left: 65%; top: 35%;
    width: 10px; height: 10px;
    animation-delay: 3s;
    animation-duration: 12s;
}
.particle:nth-child(4) {
    left: 80%; top: 15%;
    width: 8px; height: 8px;
    animation-delay: 0.5s;
    animation-duration: 9s;
}
.particle:nth-child(5) {
    left: 35%; top: 70%;
    width: 14px; height: 14px;
    animation-delay: 2s;
    animation-duration: 7s;
}
.particle:nth-child(6) {
    left: 90%; top: 55%;
    width: 10px; height: 10px;
    animation-delay: 4s;
    animation-duration: 11s;
}

/* Auth Container */
.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh; /* Use dynamic viewport height for mobile */
    background: url('/assets/images/happy_teacher_in_classroom.jpg') center center / cover no-repeat;
}

/* Overlay with gradient */
.auth-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh; /* Use dynamic viewport height for mobile */
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2;
    box-sizing: border-box;
}

/* Auth Modal - Enhanced glassmorphism */
.auth-modal {
    background: var(--modal-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: 24px;
    padding: 32px 36px 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-soft), var(--shadow-glow);
    border: 1px solid rgba(255, 255, 255, 0.4);
    position: relative;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.auth-modal.wide {
    max-width: 480px;
    padding: 36px 36px 32px;
}

.auth-modal.message {
    max-width: 460px;
    padding: 48px 44px;
    border-radius: 28px;
    text-align: center;
}

/* Decorative top accent bar - teal gradient */
.auth-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 0 0 4px 4px;
}

.auth-modal.message::before {
    display: none;
}

/* Logo Container */
.logo-container {
    text-align: center;
    margin-bottom: 20px;
}

.logo-wrapper {
    display: inline-block;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    padding: 14px 24px;
    border-radius: 16px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(91, 191, 179, 0.1);
    transition: transform var(--transition-smooth), box-shadow var(--transition-fast);
}

.logo-wrapper:hover {
    transform: scale(1.02);
    box-shadow:
        0 8px 30px rgba(91, 191, 179, 0.15),
        0 2px 6px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.logo-wrapper img {
    height: 52px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(91, 191, 179, 0.1));
}

/* App Title */
.app-title {
    font-family: 'Nunito', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.app-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
    font-weight: 500;
}

/* Form Styling */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.input-wrapper {
    position: relative;
}

.input-wrapper i,
.input-wrapper .streamline-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.25rem;
    transition: color var(--transition-fast);
}

.input-wrapper .streamline-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.form-control {
    width: 100%;
    padding: 14px 16px 14px 48px;
    font-size: 0.9375rem;
    font-family: 'DM Sans', sans-serif;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-dark);
    transition: all var(--transition-fast);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.form-control::placeholder {
    color: #94a3b8;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow:
        0 0 0 4px var(--primary-bg),
        0 1px 2px rgba(0, 0, 0, 0.04);
}

.form-control:focus + i,
.form-control:focus + .streamline-icon,
.input-wrapper:focus-within i,
.input-wrapper:focus-within .streamline-icon {
    color: var(--primary);
}

/* Login Button - Teal gradient */
.btn-login {
    width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Nunito', 'Plus Jakarta Sans', sans-serif;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.6s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

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

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

.btn-login i,
.btn-login .streamline-icon {
    font-size: 1.25rem;
}

.btn-login .streamline-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Loading State */
.btn-login.loading {
    pointer-events: none;
    opacity: 0.85;
}

.btn-login.loading .btn-text {
    opacity: 0;
}

.btn-login .spinner {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

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

/* Help Link */
.help-link {
    text-align: center;
    margin-top: 16px;
    margin-bottom: 12px;
}

.help-link a {
    font-size: 0.8125rem;
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
    padding: 6px 12px;
    border-radius: 8px;
}

.help-link a:hover {
    color: var(--primary);
    background: var(--primary-bg);
}

/* Privacy Policy Link */
.privacy-link {
    text-align: center;
    padding-top: 14px;
    border-top: 1px solid rgba(91, 191, 179, 0.1);
}

.privacy-link a {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
    padding: 4px 10px;
    border-radius: 6px;
}

.privacy-link a i,
.privacy-link a .streamline-icon {
    font-size: 0.9375rem;
}

.privacy-link a .streamline-icon {
    width: 0.9375rem;
    height: 0.9375rem;
}

.privacy-link a:hover {
    color: var(--primary-dark);
    background: var(--primary-bg);
}

/* Version Text */
.auth-modal .version-text {
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--primary);
    margin: 16px auto 0;
    padding: 4px 12px;
    background: var(--primary-bg);
    border-radius: 6px;
    display: block;
    width: fit-content;
    letter-spacing: 0.02em;
}

/* Error Message */
.error-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fff1f2 100%);
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: none;
    align-items: center;
    gap: 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #dc2626;
    animation: shake 0.5s ease;
}

.error-message i,
.error-message .streamline-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.error-message .streamline-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.error-message.show {
    display: flex;
}

/* ==================== PROFILE & POSITION SELECTION ==================== */

.welcome-header {
    text-align: center;
    margin-bottom: 24px;
}

.welcome-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.user-name-display {
    font-family: 'Nunito', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

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

/* Profile Options */
.profile-options {
    margin-bottom: 24px;
}

.profile-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: rgba(255, 255, 255, 0.8);
}

.profile-option:last-child {
    margin-bottom: 0;
}

.profile-option:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
    transform: translateX(4px);
}

.profile-option.selected,
.profile-option:has(input:checked) {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(91, 191, 179, 0.08) 0%, rgba(91, 191, 179, 0.04) 100%);
    box-shadow: 0 0 0 4px var(--primary-bg);
}

.profile-option input[type="radio"] {
    display: none;
}

.profile-radio {
    width: 22px;
    height: 22px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.profile-option.selected .profile-radio,
.profile-option:has(input:checked) .profile-radio {
    border-color: var(--primary);
    background: var(--primary);
}

.profile-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: all var(--transition-smooth);
}

.profile-option.selected .profile-radio::after,
.profile-option:has(input:checked) .profile-radio::after {
    opacity: 1;
    transform: scale(1);
}

.profile-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    flex-shrink: 0;
    transition: transform var(--transition-smooth);
}

.profile-option:hover .profile-icon {
    transform: scale(1.05);
}

.profile-icon.super { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #d97706; }
.profile-icon.admin { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #059669; }
.profile-icon.evaluator { background: linear-gradient(135deg, #ccfbf1, #99f6e4); color: #0d9488; }
.profile-icon.certificated { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #4f46e5; }
.profile-icon.classified { background: linear-gradient(135deg, #fce7f3, #fbcfe8); color: #db2777; }
.profile-icon.management { background: linear-gradient(135deg, #f3e8ff, #e9d5ff); color: #9333ea; }

.profile-details {
    flex: 1;
    min-width: 0;
}

.profile-title {
    font-family: 'Nunito', 'Plus Jakarta Sans', sans-serif;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.profile-description {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Continue Button - Teal themed */
.btn-continue {
    width: 100%;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Nunito', 'Plus Jakarta Sans', sans-serif;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-continue::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.6s ease;
}

.btn-continue:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-continue:hover:not(:disabled)::before {
    left: 100%;
}

.btn-continue:disabled {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

.btn-continue:disabled::before {
    display: none;
}

.btn-continue i,
.btn-continue .streamline-icon {
    font-size: 1.25rem;
}

.btn-continue .streamline-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Back Link */
.back-link {
    text-align: center;
    margin-top: 20px;
}

.back-link a {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 500;
}

.back-link a:hover {
    color: var(--primary-dark);
    background: var(--primary-bg);
}

/* ==================== MESSAGE PAGE ==================== */

.message-icon {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.75rem;
    margin: 0 auto 28px;
    position: relative;
}

.message-icon::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    opacity: 0.3;
    animation: pulse 2s ease-in-out infinite;
}

.message-icon.error {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: var(--danger);
}
.message-icon.error::before { background: var(--danger); }

.message-icon.warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: var(--warning);
}
.message-icon.warning::before { background: var(--warning); }

.message-icon.info {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: var(--info);
}
.message-icon.info::before { background: var(--info); }

.message-icon.success {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: var(--success);
}
.message-icon.success::before { background: var(--success); }

.message-title {
    font-family: 'Nunito', 'Plus Jakarta Sans', sans-serif;
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.message-text {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 36px;
}

.btn-return {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 36px;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Nunito', 'Plus Jakarta Sans', sans-serif;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-return::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.6s ease;
}

.btn-return:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
    color: #ffffff;
}

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

.btn-return i,
.btn-return .streamline-icon {
    font-size: 1.25rem;
}

.btn-return .streamline-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* ==================== RESPONSIVE ==================== */

/* Tablet and below - reduce padding, increase modal width */
@media (max-width: 768px) {
    .auth-overlay {
        padding: 16px;
    }

    .auth-modal {
        max-width: 100%;
        width: 100%;
    }

    .auth-modal.wide {
        max-width: 100%;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .auth-overlay {
        padding: 12px;
    }

    .auth-modal {
        padding: 28px 24px 24px;
        border-radius: 20px;
        margin: 0;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .logo-wrapper {
        padding: 12px 20px;
    }

    .logo-wrapper img {
        height: 44px;
    }

    .app-title {
        font-size: 1.5rem;
    }

    .form-control {
        padding: 12px 14px 12px 44px;
    }

    .btn-login,
    .btn-continue {
        padding: 12px 20px;
        min-height: 52px;
    }

    .auth-modal.message {
        padding: 36px 28px;
        border-radius: 24px;
    }

    .message-icon {
        width: 72px;
        height: 72px;
        font-size: 2.25rem;
    }

    .message-title {
        font-size: 1.375rem;
    }

    .message-text {
        font-size: 0.9375rem;
    }

    .profile-option {
        padding: 12px 14px;
        min-height: 64px;
    }

    .profile-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}

/* ==================== ENHANCED MOBILE RESPONSIVENESS ==================== */

/* Very small screens (iPhone SE, older phones) */
@media (max-width: 360px) {
    .auth-overlay {
        padding: 8px;
    }

    .auth-modal {
        padding: 24px 16px 20px;
        border-radius: 16px;
        margin: 0;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .logo-wrapper {
        padding: 10px 16px;
    }

    .logo-wrapper img {
        height: 40px;
    }

    .app-title {
        font-size: 1.375rem;
    }

    .app-subtitle {
        font-size: 0.8125rem;
        margin-bottom: 20px;
    }

    .form-control {
        padding: 12px 12px 12px 42px;
        font-size: 16px; /* Prevent iOS zoom */
        min-height: 48px;
    }

    .profile-option {
        padding: 10px 12px;
        gap: 10px;
        min-height: 60px;
    }

    .profile-radio {
        width: 22px;
        height: 22px;
        min-width: 22px;
    }

    .profile-icon {
        width: 36px;
        height: 36px;
        font-size: 1.125rem;
        border-radius: 10px;
    }

    .profile-title {
        font-size: 0.875rem;
    }

    .profile-description {
        font-size: 0.75rem;
    }

    .btn-login,
    .btn-continue {
        padding: 12px 16px;
        font-size: 0.9375rem;
        min-height: 50px;
    }
}

/* Touch device improvements */
@media (pointer: coarse) {
    /* Ensure minimum touch target size (48x48 for better touch) */
    .btn-login,
    .btn-continue,
    .btn-return {
        min-height: 52px;
    }

    .profile-option {
        min-height: 64px;
    }

    .profile-radio {
        width: 24px;
        height: 24px;
        min-width: 24px;
    }

    .help-link a,
    .privacy-link a,
    .back-link a {
        min-height: 48px;
        padding: 12px 16px;
        display: inline-flex;
        align-items: center;
    }

    /* Remove hover transforms on touch devices */
    .profile-option:hover {
        transform: none;
    }

    /* Add active states for touch feedback */
    .btn-login:active,
    .btn-continue:active,
    .btn-return:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .profile-option:active {
        transform: scale(0.99);
        background: var(--primary-bg);
        border-color: var(--primary);
    }

    /* Larger tap targets */
    .form-control {
        min-height: 50px;
    }

    /* Increase gap for easier tapping */
    .profile-options {
        gap: 10px;
    }
}

/* Landscape mode on mobile */
@media (max-width: 991.98px) and (orientation: landscape) {
    .auth-overlay {
        padding: 10px 20px;
    }

    .auth-modal {
        padding: 20px 28px;
        max-height: 95vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .logo-container {
        margin-bottom: 12px;
    }

    .logo-wrapper {
        padding: 8px 16px;
    }

    .logo-wrapper img {
        height: 36px;
    }

    .app-title {
        font-size: 1.25rem;
        margin-bottom: 2px;
    }

    .app-subtitle {
        margin-bottom: 16px;
        font-size: 0.8125rem;
    }

    .form-group {
        margin-bottom: 14px;
    }

    .profile-options {
        margin-bottom: 16px;
        max-height: 50vh;
        max-height: 50dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .profile-option {
        padding: 10px 14px;
        margin-bottom: 8px;
    }

    .message-icon {
        width: 64px;
        height: 64px;
        font-size: 2rem;
        margin-bottom: 16px;
    }

    .message-title {
        font-size: 1.25rem;
        margin-bottom: 8px;
    }

    .message-text {
        font-size: 0.875rem;
        margin-bottom: 20px;
    }

    /* Hide particles in landscape for better performance */
    .particles {
        opacity: 0.3;
    }
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    @media (max-width: 991.98px) {
        .auth-overlay {
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
            padding-bottom: max(16px, env(safe-area-inset-bottom));
            padding-top: max(16px, env(safe-area-inset-top));
        }
    }

    @media (max-width: 480px) {
        .auth-overlay {
            padding-left: max(12px, env(safe-area-inset-left));
            padding-right: max(12px, env(safe-area-inset-right));
            padding-bottom: max(12px, env(safe-area-inset-bottom));
            padding-top: max(12px, env(safe-area-inset-top));
        }
    }
}

/* Prevent input zoom on iOS */
@media (max-width: 991.98px) {
    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"] {
        font-size: 16px !important;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .auth-modal {
        animation: fadeIn 0.3s ease forwards;
    }

    .particle {
        animation: none;
        opacity: 0.4;
    }

    .btn-login::before,
    .btn-continue::before,
    .btn-return::before {
        display: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .auth-modal {
        border: 2px solid var(--text-dark);
    }

    .form-control {
        border-width: 2px;
    }

    .profile-option {
        border-width: 2px;
    }
}
