/* ══════════════════════════════════════════════════════════════════════
   Difalink Auth Pages - Accessible & Themed Design
   Designed for disability-friendly UX: high contrast, large targets,
   clear focus states, screen reader support, cognitive simplicity
   ══════════════════════════════════════════════════════════════════════ */

/* --- Foundation / Page --- */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(160deg, #0d3b36 0%, #145c54 40%, #1a7a6f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    overflow: hidden;
}

/* Type-specific backgrounds */
.auth-page-user {
    background: linear-gradient(160deg, #0d3b36 0%, #145c54 40%, #1a7a6f 100%);
}
.auth-page-company {
    background: linear-gradient(160deg, #0c2d4a 0%, #164e7a 40%, #1e6fa0 100%);
}
.auth-page-admin {
    background: linear-gradient(160deg, #4a2c0c 0%, #7a4e16 40%, #a06b1e 100%);
}

/* Decorative background shapes */
.auth-page::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -120px;
    width: 400px;
    height: 400px;
    background: rgba(44, 176, 161, 0.12);
    border-radius: 50%;
    pointer-events: none;
}

.auth-page::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    pointer-events: none;
}

/* Skip to content link for screen readers */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #2cb0a1;
    color: #fff;
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    font-weight: 700;
    z-index: 1000;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* --- Container & Card --- */
.auth-container {
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 44px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255,255,255,0.1);
    animation: cardFadeIn 0.4s ease-out;
}

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-card-wide {
    max-width: 640px;
}

.auth-container:has(.auth-card-wide) {
    max-width: 660px;
}

/* --- Logo --- */
.auth-logo {
    display: block;
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo img {
    max-width: 140px;
    height: auto;
}

/* --- Headings --- */
.auth-card h2 {
    text-align: center;
    color: #0d3b36;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.auth-subtitle {
    text-align: center;
    color: #555;
    margin-bottom: 32px;
    font-size: 15px;
    line-height: 1.5;
}

/* --- Select Cards (login/register type selection) --- */
.auth-select-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 28px;
}

.auth-select-card {
    border: 2.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 28px 20px;
    text-align: center;
    text-decoration: none;
    color: #1a1a1a;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.auth-select-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #2cb0a1;
    transform: scaleX(0);
    transition: transform 0.25s ease;
}

.auth-select-card:hover,
.auth-select-card:focus {
    border-color: #2cb0a1;
    background: #f0fdf9;
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(44, 176, 161, 0.15);
    text-decoration: none;
    color: #1a1a1a;
}

.auth-select-card:hover::before,
.auth-select-card:focus::before {
    transform: scaleX(1);
}

.auth-select-card:focus {
    outline: 3px solid #2cb0a1;
    outline-offset: 3px;
}

.auth-select-card i {
    font-size: 40px;
    color: #2cb0a1;
    display: block;
    margin-bottom: 14px;
}

.auth-select-card h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #0d3b36;
}

.auth-select-card p {
    font-size: 13px;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 20px;
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    font-size: 16px;
    color: #1a1a1a;
    background: #fafbfc;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #9ca3af;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2cb0a1;
    box-shadow: 0 0 0 4px rgba(44, 176, 161, 0.15);
    background: #fff;
}

/* Error state */
.form-group.has-error input,
.form-group.has-error select {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-group .error-text {
    color: #dc2626;
    font-size: 13px;
    margin-top: 4px;
    font-weight: 500;
}

.form-row {
    display: flex;
    gap: 16px;
}

/* --- Input with Icon --- */
.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 16px;
    pointer-events: none;
}

.input-icon input {
    padding-left: 44px;
}

.input-icon:has(.toggle-pass) input {
    padding-right: 48px;
}

.toggle-pass {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-pass:hover,
.toggle-pass:focus {
    color: #2cb0a1;
    background: rgba(44, 176, 161, 0.08);
}

.toggle-pass:focus {
    outline: 2px solid #2cb0a1;
    outline-offset: 2px;
}

/* --- Submit Button --- */
.btn-auth {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #2cb0a1, #249185);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-top: 12px;
    letter-spacing: 0.2px;
    min-height: 52px;
    position: relative;
    overflow: hidden;
}

.btn-auth::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}

.btn-auth:hover {
    background: linear-gradient(135deg, #249185, #1d7a6f);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(44, 176, 161, 0.3);
}

.btn-auth:hover::after {
    opacity: 1;
}

.btn-auth:focus {
    outline: 3px solid #2cb0a1;
    outline-offset: 3px;
}

.btn-auth:active {
    transform: translateY(0);
    box-shadow: none;
}

/* --- Footer Links --- */
.auth-footer {
    margin-top: 28px;
    text-align: center;
    font-size: 14px;
    color: #555;
    line-height: 2;
}

.auth-footer a {
    color: #2cb0a1;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

.auth-footer a:hover,
.auth-footer a:focus {
    color: #1d7a6f;
}

.auth-footer a:focus {
    outline: 2px solid #2cb0a1;
    outline-offset: 2px;
    border-radius: 3px;
}

/* --- Alert Messages --- */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 2px solid #fecaca;
}

.alert-danger::before {
    content: '\f071';
    font-family: 'FontAwesome';
    font-size: 16px;
    flex-shrink: 0;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 2px solid #bbf7d0;
}

.alert-success::before {
    content: '\f00c';
    font-family: 'FontAwesome';
    font-size: 16px;
    flex-shrink: 0;
}

/* --- Accessibility: Focus visible for keyboard navigation --- */
*:focus-visible {
    outline: 3px solid #2cb0a1;
    outline-offset: 2px;
}

/* --- Accessibility: Reduced motion preference --- */
@media (prefers-reduced-motion: reduce) {
    .auth-card {
        animation: none;
    }
    .auth-select-card,
    .btn-auth {
        transition: none;
        transform: none !important;
    }
}

/* --- Accessibility: High contrast mode support --- */
@media (prefers-contrast: high) {
    .form-group input,
    .form-group select {
        border-width: 3px;
        border-color: #000;
    }
    .btn-auth {
        background: #000;
        border: 3px solid #000;
    }
    .auth-select-card {
        border-width: 3px;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .auth-page {
        padding: 0;
        align-items: stretch;
        min-height: 100vh;
        overflow: visible;
        overflow-y: auto;
    }
    .auth-page::before, .auth-page::after { display: none; }
    .auth-container {
        max-width: 100%;
        width: 100%;
    }
    .auth-logo {
        margin-bottom: 20px;
        padding-top: 24px;
    }
    .auth-logo img {
        max-width: 120px;
    }
    .auth-card {
        border-radius: 0;
        box-shadow: none;
        padding: 28px 20px;
        min-height: 100vh;
    }
    .auth-card h2 {
        font-size: 22px;
    }
    .auth-select-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .auth-select-card {
        padding: 22px 18px;
        display: flex;
        align-items: center;
        text-align: left;
        gap: 16px;
    }
    .auth-select-card i {
        font-size: 32px;
        margin-bottom: 0;
    }
    .auth-select-card h3 {
        font-size: 16px;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .form-group input,
    .form-group select {
        font-size: 16px;
        padding: 14px 16px;
    }
    .input-icon input {
        padding-left: 44px;
    }
    .input-icon:has(.toggle-pass) input {
        padding-right: 48px;
    }
    .btn-auth {
        font-size: 16px;
        padding: 15px;
    }
}

@media (max-width: 380px) {
    .auth-card {
        padding: 24px 16px;
    }
    .auth-logo img {
        max-width: 100px;
    }
}

/* --- MOBILE (< 1200px): never let the leading icon cover the typed text --- */
/* Hide the decorative leading icon and reset the input's left padding so the
   text starts at the normal edge. The functional password toggle (right side,
   a <button>, so NOT a direct child <i>) is intentionally kept. */
@media (max-width: 1199px) {
    .input-icon > i {
        display: none !important;
    }
    .input-icon input {
        padding-left: 16px !important;
    }
    /* keep room for the password show/hide button */
    .input-icon:has(.toggle-pass) input {
        padding-right: 48px !important;
    }
}
