* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a, #1e293b, #334155);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.page {
    width: 100%;
    display: flex;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border-radius: 20px;
    padding: 32px 28px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
}

.close-btn {
    position: absolute;
    top: 18px;
    right: 24px;
    color: #ffffff;
    text-decoration: none;
    font-size: 40px;
    font-weight: bold;
    line-height: 1;
    transition: 0.2s ease;
}

.close-btn:hover {
    opacity: 0.8;
    transform: scale(1.06);
}

.brand {
    text-align: center;
    margin-bottom: 28px;
}

.brand h1 {
    font-size: 36px;
    color: #0f172a;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.brand p {
    font-size: 14px;
    color: #64748b;
}

.auth-section h2 {
    font-size: 24px;
    color: #111827;
    margin-bottom: 20px;
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.input-group label {
    font-size: 14px;
    color: #374151;
    font-weight: 600;
}

.input-group input {
    height: 46px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 0 14px;
    font-size: 15px;
    outline: none;
    transition: 0.2s ease;
}

.input-group input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 4px;
    font-size: 14px;
    color: #374151;
}

.checkbox-group input {
    margin-top: 3px;
}

.btn {
    width: 100%;
    border: none;
    border-radius: 12px;
    height: 46px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.primary {
    background: #2563eb;
    color: white;
    margin-top: 6px;
}

.primary:hover {
    background: #1d4ed8;
}

.divider {
    text-align: center;
    margin: 22px 0 16px;
    color: #64748b;
    font-size: 14px;
    position: relative;
}

.divider span {
    background: #ffffff;
    padding: 0 10px;
    position: relative;
    z-index: 2;
}

.divider::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e5e7eb;
    z-index: 1;
}

.social-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.social {
    background: #f8fafc;
    color: #111827;
    border: 1px solid #dbe3ee;
}

.social:hover {
    background: #eef2f7;
}

.switch-text {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: #6b7280;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.link-btn {
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
}

.link-btn:hover {
    text-decoration: underline;
}

.hidden {
    display: none;
}

.active {
    display: block;
}

.flash-messages {
    margin-bottom: 18px;
}

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 600;
}

.flash.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.flash.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.desktop-auth-banner {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.terms-link {
    border: none;
    background: transparent;
    color: #2563eb;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    text-decoration: underline;
}

.terms-link:hover {
    color: #1d4ed8;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: 0.25s ease;
    z-index: 9999;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 760px;
    max-height: 85vh;
    overflow: hidden;
    background: #ffffff;
    border-radius: 22px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
    padding: 28px 24px 28px; /* زيادة padding bottom */
    animation: modalPop 0.22s ease;
}

@keyframes modalPop {
    from {
        transform: translateY(12px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-card h2 {
    margin: 0 0 18px;
    font-size: 30px;
    color: #0f172a;
}

.modal-card h3 {
    margin: 18px 0 8px;
    font-size: 18px;
    color: #0f172a;
}

.modal-content {
    max-height: calc(85vh - 140px);
    overflow-y: auto;
    padding-right: 8px;
    color: #475569;
    line-height: 1.7;
}

.modal-content p {
    margin-bottom: 12px;
}

.modal-actions {
    display: flex;
    justify-content: center;
    margin-top: 24px;
    padding-top: 10px;
}

.modal-actions .btn {
    width: 220px;
    margin-bottom: 6px;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: 0.2s ease;
}

.modal-close:hover {
    background: #e2e8f0;
}

body.modal-open {
    overflow: hidden;
}

@media (max-width: 640px) {
    .modal-card {
        padding: 22px 18px 18px;
        border-radius: 18px;
    }

    .modal-card h2 {
        font-size: 24px;
        padding-right: 36px;
    }

    .modal-card h3 {
        font-size: 16px;
    }

    .modal-content {
        max-height: calc(85vh - 130px);
    }
}

@media (max-width: 520px) {
    .auth-card {
        padding: 24px 18px;
        border-radius: 16px;
    }

    .page-close-btn {
        top: 14px;
        right: 18px;
        font-size: 34px;
    }

    .brand h1 {
        font-size: 30px;
    }

    .auth-section h2 {
        font-size: 22px;
    }
}