/* 
   Mobile-first responsive auth pages
   - Optimized for all screen sizes from 320px to 4K
   - Smooth transitions and modern design
*/

/* Reset & base setup */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f3f4f6;
    margin: 0;
    padding: 0;
    color: #111827;
    line-height: 1.5;
}

/* Mobile-first wrapper */
.auth-wrapper {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Card styling - mobile first */
.auth-card {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    max-width: 24rem; /* 384px - comfortable on mobile */
}

/* Heading */
.auth-card h1 {
    text-align: center;
    margin: 0 0 1.25rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Form layout */
form {
    margin-top: 0;
}

.form-field {
    margin-bottom: 1rem;
}

.form-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
}

.form-field input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    background-color: #ffffff;
    appearance: none; /* Remove default mobile styling */
    -webkit-appearance: none;
}

.form-field input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-color: #ffffff;
}

/* Better mobile input handling */
.form-field input::placeholder {
    color: #9ca3af;
}

/* Buttons */
button {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #111827;
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    touch-action: manipulation; /* Better mobile tap handling */
    -webkit-tap-highlight-color: transparent;
}

button:hover {
    background: #1f2937;
}

button:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Links */
.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.auth-link a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.auth-link a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Error/message styles */
.message,
.form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.field-error {
    font-size: 0.8125rem;
    color: #dc2626;
    margin-top: 0.25rem;
    display: block;
}

/* Very small screens (< 375px) */
@media (max-width: 374px) {
    .auth-wrapper {
        padding: 0.75rem;
    }

    .auth-card {
        padding: 1.25rem;
    }

    .auth-card h1 {
        font-size: 1.375rem;
    }

    .form-field input,
    button {
        font-size: 0.9375rem;
    }
}

/* Small phones landscape and up (>= 480px) */
@media (min-width: 480px) {
    .auth-card {
        max-width: 26rem; /* 416px */
    }
}

/* Tablets portrait (>= 640px) */
@media (min-width: 640px) {
    .auth-wrapper {
        padding: 2rem;
    }

    .auth-card {
        padding: 2rem;
        max-width: 28rem; /* 448px */
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    }

    .auth-card h1 {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }

    .form-field {
        margin-bottom: 1.25rem;
    }

    .form-field input {
        padding: 0.75rem 1rem;
    }

    button {
        padding: 0.875rem 1.25rem;
        margin-top: 0.75rem;
    }
}

/* Tablets landscape and small desktops (>= 768px) */
@media (min-width: 768px) {
    .auth-card {
        max-width: 30rem; /* 480px */
    }
}

/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
    body {
        background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    }

    .auth-wrapper {
        padding: 3rem;
    }

    .auth-card {
        padding: 2.5rem;
        border-radius: 1rem;
    }

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

/* Large desktop (>= 1440px) */
@media (min-width: 1440px) {
    .auth-card {
        max-width: 32rem; /* 512px */
    }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .auth-card {
        border: 2px solid #111827;
    }

    button {
        border: 2px solid #ffffff;
    }

    .form-field input {
        border-width: 2px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    body {
        background: #111827;
        color: #f9fafb;
    }

    .auth-card {
        background: #1f2937;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.25);
    }

    .auth-card h1 {
        color: #f9fafb;
    }

    .form-field label {
        color: #e5e7eb;
    }

    .form-field input {
        background: #111827;
        border-color: #374151;
        color: #f9fafb;
    }

    .form-field input:focus {
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    }

    .auth-link {
        color: #9ca3af;
    }

    button {
        background: #3b82f6;
    }

    button:hover {
        background: #2563eb;
    }

    @media (min-width: 1024px) {
        body {
            background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
        }
    }
}