/* Enhanced Authentication Styles */

.auth-background {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.auth-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="auth-grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23auth-grid)"/></svg>');
    opacity: 0.3;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 2;
}

.auth-visual-content {
    position: relative;
    z-index: 2;
}

.auth-input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.auth-input {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 1rem 1rem 1rem 3.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    width: 100%;
}

.auth-input:focus {
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    outline: none;
}

.auth-input-icon {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 3;
}

.auth-checkbox {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 6px;
    border: 2px solid #d1d5db;
    transition: all 0.3s ease;
}

.auth-checkbox:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.auth-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 16px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.auth-link:hover {
    color: #764ba2;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Form validation styles */
.auth-input.is-invalid {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.auth-input.is-valid {
    border-color: #10b981;
    background-color: #f0fdf4;
}

/* Responsive improvements */
@media (max-width: 991px) {
    .auth-visual-content {
        display: none !important;
    }
}

@media (max-width: 576px) {
    .auth-card {
        border-radius: 16px;
        margin: 1rem;
    }
    
    .auth-input {
        padding: 0.875rem 0.875rem 0.875rem 3rem;
        font-size: 0.95rem;
    }
    
    .auth-input-icon {
        right: 1rem;
        font-size: 1.1rem;
    }
}

/* RTL Support */
[dir="rtl"] .auth-input {
    padding: 1rem 3.5rem 1rem 1rem;
}

[dir="rtl"] .auth-input-icon {
    right: auto;
    left: 1.25rem;
}

[dir="rtl"] .auth-checkbox {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Enhanced visual elements */
.auth-brand-logo {
    animation: fadeInUp 0.8s ease-out;
}

.auth-features {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modern form styling */
.form-check.card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
}

.form-check.card:hover {
    border-color: #667eea;
    background-color: rgba(102, 126, 234, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.form-check.card .form-check-input {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 1.25rem;
    height: 1.25rem;
}

.form-check.card .form-check-input:checked + .form-check-label {
    color: #667eea;
}

.form-check.card:has(.form-check-input:checked) {
    border-color: #667eea;
    background-color: rgba(102, 126, 234, 0.1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

/* Enhanced button styles */
.btn-outline-danger {
    border-width: 2px;
    border-radius: 16px;
    padding: 0.875rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.3);
}

/* Auth pages: a focused, accessible surface that matches Manarah's navy, blue, and teal identity. */
.auth-background.auth-page {
    position: relative;
    min-height: calc(100vh - 76px) !important;
    padding: clamp(1.5rem, 3.5vw, 3.5rem) 0 !important;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(circle at 14% 16%, rgba(30, 144, 255, 0.23), transparent 31rem),
        radial-gradient(circle at 88% 88%, rgba(13, 148, 136, 0.28), transparent 30rem),
        linear-gradient(135deg, #081c36 0%, #102f58 51%, #0b6d73 100%) !important;
}

.auth-background.auth-page::before {
    z-index: -1;
    opacity: 0.62;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px) !important;
    background-size: 38px 38px !important;
}

.auth-background.auth-page::after {
    content: '';
    position: absolute;
    width: 28rem;
    height: 28rem;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 50%;
    inset: auto auto -18rem -12rem;
    z-index: -1;
    box-shadow: 0 0 0 4rem rgba(255, 255, 255, 0.025), 0 0 0 8rem rgba(255, 255, 255, 0.018);
}

.auth-page .auth-shell {
    width: min(100%, 1240px);
    min-height: 0 !important;
    margin-inline: auto;
}

.auth-page .auth-form-column,
.auth-page .auth-brand-column {
    display: flex;
    align-items: center;
}

.auth-page .auth-card {
    width: 100%;
    position: relative;
    isolation: isolate;
    border: 1px solid rgba(219, 230, 242, 0.92) !important;
    border-radius: 24px !important;
    background: rgba(255, 255, 255, 0.985) !important;
    box-shadow: 0 26px 70px rgba(3, 18, 43, 0.32) !important;
}

.auth-page .auth-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    border-radius: 24px 24px 0 0;
    background: linear-gradient(90deg, #f15a34, #fb8a24 48%, #2d7ff9);
}

.auth-page .auth-card--register { max-width: 720px !important; }
.auth-page .auth-card--login { max-width: 540px !important; }

.auth-page .auth-card-header { margin-bottom: 1.65rem; }

.auth-page .auth-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    padding: 0.38rem 0.72rem;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    background: #eff6ff;
    color: #245fc0;
    font-size: 0.78rem;
    font-weight: 700;
}

.auth-page .auth-card .icon-box {
    width: 58px !important;
    height: 58px !important;
    margin-bottom: 0.85rem !important;
    border-radius: 17px !important;
    background: linear-gradient(135deg, #f04f41, #fb7a25) !important;
    box-shadow: 0 14px 28px rgba(239, 90, 52, 0.25) !important;
}

.auth-page .auth-card h1 {
    margin-bottom: 0.45rem !important;
    color: #12233f !important;
    font-size: clamp(1.85rem, 3vw, 2.35rem) !important;
    line-height: 1.2 !important;
}

.auth-page .auth-card-subtitle {
    max-width: 34rem;
    margin-inline: auto;
    color: #5c6d82 !important;
    font-size: 0.98rem;
    line-height: 1.65;
}

.auth-page .form-grid-2 {
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.auth-page .input-float { margin-bottom: 0.55rem; }

.auth-page .input-float .form-control {
    min-height: 54px !important;
    border: 1.5px solid #d7e2ef !important;
    border-radius: 12px !important;
    background: #f8fbff !important;
    font-weight: 600;
    box-shadow: none !important;
}

.auth-page .input-float .form-control:hover { border-color: #abc1dd !important; }

.auth-page .input-float .form-control:focus {
    border-color: #276ed8 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(39, 110, 216, 0.14) !important;
}

.auth-page .input-float label {
    color: #5e7188 !important;
    font-weight: 600;
}

.auth-page .input-password .form-control { padding-inline-start: 3.45rem !important; }

.auth-page .password-toggle {
    color: #5f748e !important;
    width: 38px;
    height: 38px;
    border-radius: 10px;
}

.auth-page .password-toggle:hover { background: #e9f2ff !important; color: #1d64ca !important; }

.auth-page .auth-role-fieldset {
    margin: 0.7rem 0 0.85rem;
    padding: 0.9rem;
    border: 1.5px solid #d9e5f1 !important;
    border-radius: 16px !important;
    background: linear-gradient(180deg, #fbfdff, #f6faff) !important;
}

.auth-page .auth-role-fieldset legend {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: auto;
    max-width: calc(100% - 1rem);
    margin: 0;
    padding-inline: 0.35rem;
    color: #1d3350 !important;
    font-size: 1rem !important;
}

.auth-page .auth-role-fieldset legend small {
    color: #718198;
    font-size: 0.72rem;
    font-weight: 500;
}

.auth-page .role-card {
    position: relative;
    display: block;
    min-height: 88px;
    height: 100%;
    margin: 0;
    padding: 0.75rem 0.8rem;
    cursor: pointer;
    border: 1.5px solid #e0e8f2;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(27, 50, 76, 0.035);
    transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.auth-page .role-card:hover {
    transform: translateY(-2px);
    border-color: #9bbce9;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.1);
}

.auth-page .role-radio {
    position: absolute;
    inset-block-start: 0.75rem;
    inset-inline-end: 0.75rem;
    width: 19px;
    height: 19px;
    margin: 0;
    accent-color: #276ed8;
    cursor: pointer;
}

.auth-page .role-card-content { padding-inline-end: 1.15rem; }

.auth-page .role-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: #edf4ff;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.auth-page .role-copy strong {
    display: block;
    color: #26374e;
    font-size: 0.92rem;
}

.auth-page .role-copy span {
    margin-top: 0.18rem;
    color: #718198;
    font-size: 0.73rem;
    font-weight: 500;
    line-height: 1.4;
}

.auth-page .role-card.is-selected,
.auth-page .role-card:has(.role-radio:checked) {
    border-color: #4d86df;
    background: linear-gradient(135deg, #f5f9ff, #edf5ff);
    box-shadow: 0 9px 20px rgba(37, 99, 235, 0.14);
}

.auth-page .role-card.is-selected::after,
.auth-page .role-card:has(.role-radio:checked)::after {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    inset-block: 0.7rem;
    width: 3px;
    border-radius: 999px;
    background: #276ed8;
}

.auth-page .role-card--success .role-icon { background: #e7f8f1; }
.auth-page .role-card--info .role-icon { background: #e8f6ff; }
.auth-page .role-card--warning .role-icon { background: #fff5dc; }

.auth-page .auth-avatar-upload {
    margin: 0.15rem 0 0.8rem;
}

.auth-page .input-file .file-label {
    justify-content: flex-start;
    min-height: 70px;
    padding: 0.65rem 0.9rem;
    border: 1.5px dashed #bcd1e8 !important;
    border-radius: 13px !important;
    background: #fbfdff !important;
    color: #3971b8 !important;
}

.auth-page .input-file .file-label:hover {
    border-color: #276ed8 !important;
    background: #f2f7ff !important;
}

.auth-page .input-file .file-icon { font-size: 1.35rem; }
.auth-page .file-copy { display: grid; gap: 0.1rem; text-align: start; }
.auth-page .file-copy strong { color: #315172; font-size: 0.9rem; }
.auth-page .file-copy small,
.auth-page .input-file .file-info { color: #78899e !important; font-size: 0.72rem; }

.auth-page .auth-terms { margin-top: 0.1rem; gap: 0.6rem; color: #53667d; font-size: 0.86rem; }
.auth-page .auth-terms .checkmark { width: 19px; height: 19px; }

.auth-page .auth-submit {
    min-height: 52px;
    border-radius: 12px !important;
    font-size: 1rem;
    box-shadow: 0 13px 24px rgba(239, 90, 52, 0.22) !important;
}

.auth-page .auth-google-button {
    min-height: 48px;
    border: 1px solid #ced9e5 !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    color: #1d334f !important;
    box-shadow: none !important;
}

.auth-page .auth-google-button:hover {
    background: #f6f9fd !important;
    border-color: #9eb5ce !important;
    color: #10243e !important;
}

.auth-page .auth-switch { color: #64748b; font-size: 0.9rem; }
.auth-page .auth-link { color: #1d64ca !important; text-decoration: underline; text-decoration-color: rgba(29, 100, 202, 0.28); text-underline-offset: 3px; }
.auth-page .auth-link:hover { color: #e65432 !important; }

.auth-page .auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: #7b8ca1;
    font-size: 0.8rem;
    font-weight: 700;
}

.auth-page .auth-divider::before,
.auth-page .auth-divider::after { content: ''; flex: 1; height: 1px; background: #dde6f0; }

.auth-page .auth-login-options { margin-top: -0.15rem; }

.auth-page .auth-brand-panel {
    width: 100%;
    max-width: 510px;
    min-height: 560px;
    padding: clamp(2rem, 4vw, 3.8rem) !important;
    text-align: start !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 28px !important;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.045)),
        radial-gradient(circle at 82% 18%, rgba(45, 127, 249, 0.35), transparent 13rem) !important;
    box-shadow: 0 24px 58px rgba(0, 0, 0, 0.2);
}

.auth-page .auth-brand-logo { text-align: center; }
.auth-page .auth-brand-logo img { max-width: 100%; height: 74px !important; object-fit: contain; }

.auth-page .auth-brand-kicker {
    display: inline-block;
    margin-bottom: 0.85rem;
    color: #bde7ff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.auth-page .auth-brand-panel h2 {
    max-width: 23rem;
    font-size: clamp(1.65rem, 2.8vw, 2.25rem);
    line-height: 1.35;
    font-weight: 800;
}

.auth-page .auth-brand-description {
    max-width: 27rem;
    margin-bottom: 1.55rem;
    color: rgba(231, 243, 255, 0.78);
    font-size: 1rem;
    line-height: 1.8;
}

.auth-page .auth-reassurance-list { display: grid; gap: 0.65rem; }

.auth-page .auth-reassurance-list > div {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 14px;
    background: rgba(5, 26, 57, 0.23);
}

.auth-page .auth-reassurance-list i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.13);
    color: #8ce6d0;
    font-size: 1.15rem;
    flex: 0 0 auto;
}

.auth-page .auth-reassurance-list span { display: grid; gap: 0.08rem; color: #ffffff; }
.auth-page .auth-reassurance-list strong { font-size: 0.88rem; }
.auth-page .auth-reassurance-list small { color: rgba(231, 243, 255, 0.7); font-size: 0.75rem; }

[data-theme="dark"] .auth-page .auth-card { background: rgba(18, 32, 54, 0.98) !important; border-color: #324564 !important; }
[data-theme="dark"] .auth-page .auth-card h1 { color: #f2f7ff !important; }
[data-theme="dark"] .auth-page .auth-card-subtitle,
[data-theme="dark"] .auth-page .auth-switch { color: #b9c7d9 !important; }
[data-theme="dark"] .auth-page .input-float .form-control,
[data-theme="dark"] .auth-page .auth-role-fieldset,
[data-theme="dark"] .auth-page .role-card,
[data-theme="dark"] .auth-page .input-file .file-label,
[data-theme="dark"] .auth-page .auth-google-button { background: #14243d !important; border-color: #334a6b !important; color: #e5eef9 !important; }
[data-theme="dark"] .auth-page .input-float label { background: #14243d !important; color: #b7c6d9 !important; }
[data-theme="dark"] .auth-page .auth-role-fieldset legend,
[data-theme="dark"] .auth-page .role-copy strong,
[data-theme="dark"] .auth-page .file-copy strong { color: #edf5ff !important; }
[data-theme="dark"] .auth-page .role-copy span,
[data-theme="dark"] .auth-page .file-copy small,
[data-theme="dark"] .auth-page .input-file .file-info { color: #a9bbd1 !important; }

@media (max-width: 991.98px) {
    .auth-background.auth-page { min-height: calc(100vh - 62px) !important; padding-block: 1.25rem !important; }
    .auth-page .auth-shell { width: min(100%, 760px); }
    .auth-page .auth-form-column { display: block; }
}

@media (max-width: 575.98px) {
    .auth-page .auth-card { padding: 1.35rem !important; border-radius: 18px !important; }
    .auth-page .auth-card::before { border-radius: 18px 18px 0 0; }
    .auth-page .auth-card-header { margin-bottom: 1.25rem; }
    .auth-page .auth-eyebrow { font-size: 0.7rem; }
    .auth-page .auth-card h1 { font-size: 1.7rem !important; }
    .auth-page .auth-card-subtitle { font-size: 0.88rem; }
    .auth-page .auth-role-fieldset { padding: 0.72rem; }
    .auth-page .auth-role-fieldset legend { display: grid; gap: 0.1rem; }
    .auth-page .auth-role-fieldset legend small { white-space: normal; }
    .auth-page .role-card { min-height: 80px; padding: 0.65rem; }
    .auth-page .role-icon { width: 34px; height: 34px; }
    .auth-page .role-copy span { font-size: 0.69rem; }
    .auth-page .auth-login-options { align-items: flex-start !important; }
}
