/* ===================================================
   auth.css — Authentication & profile modals
   Phone OTP flow, profile completion, glassmorphic style
   =================================================== */

/* --- Base dialog reset --- */
dialog {
    border: none;
    padding: 0;
    margin: auto;
    background: transparent;
    max-width: 100vw;
    max-height: 100vh;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
}

/* --- Glassmorphic card shared by all modals --- */
.glass-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 20px;
    padding: 36px 32px;
    width: 360px;
    max-width: 92vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    animation: modalFadeIn 0.3s ease both;
    text-align: right;
    direction: rtl;
    font-family: 'Tajawal', sans-serif;
    position: relative;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.glass-card h2 {
    font-size: 22px;
    font-weight: 800;
    color: #1A1A1A;
    margin-bottom: 6px;
}

.glass-card .modal-subtitle {
    font-size: 14px;
    color: #888;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* --- Modal views (phone / OTP toggling) --- */
.modal-view {
    display: none;
}
.modal-view.active {
    display: block;
    animation: modalFadeIn 0.25s ease both;
}

/* --- Phone number input with country code prefix --- */
.phone-input-row {
    display: flex;
    align-items: center;
    border: 1.5px solid #ddd;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 18px;
    transition: border-color 0.2s;
}
.phone-input-row:focus-within {
    border-color: #D4AF37;
}
.phone-prefix {
    background: #f4f4f4;
    padding: 12px 14px;
    font-size: 15px;
    font-weight: 700;
    color: #444;
    border-left: 1px solid #ddd;
    flex-shrink: 0;
    direction: ltr;
}
.phone-input-row input[type="tel"] {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 14px;
    font-size: 16px;
    font-family: 'Tajawal', sans-serif;
    direction: ltr;
    background: transparent;
    color: #1A1A1A;
}
.phone-input-row input::placeholder {
    color: #aaa;
}

/* --- OTP six-digit grid --- */
.otp-grid {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 22px;
    direction: ltr;
}
.otp-digit {
    width: 44px;
    height: 54px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: #1A1A1A;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    caret-color: #D4AF37;
}
.otp-digit:focus {
    border-color: #D4AF37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

/* --- Modal action button --- */
.btn-modal-primary {
    width: 100%;
    background: #D4AF37;
    color: #fff;
    border: none;
    padding: 13px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    margin-top: 4px;
}
.btn-modal-primary:hover {
    background: #b5952f;
    transform: translateY(-1px);
}
.btn-modal-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* --- Secondary text link --- */
.modal-link {
    display: block;
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
    color: #888;
    cursor: pointer;
    text-decoration: underline;
    border: none;
    background: none;
    font-family: 'Tajawal', sans-serif;
    width: 100%;
}
.modal-link:hover { color: #D4AF37; }

/* --- Error message --- */
.error-msg {
    color: #E74C3C;
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
    min-height: 18px;
}

/* --- Close button (top corner) --- */
.modal-close-btn {
    position: absolute;
    top: 14px;
    left: 14px;
    background: none;
    border: none;
    font-size: 20px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}
.modal-close-btn:hover { color: #555; }

/* --- Profile modal form inputs --- */
.profile-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #ddd;
    border-radius: 12px;
    font-size: 15px;
    font-family: 'Tajawal', sans-serif;
    outline: none;
    margin-bottom: 14px;
    transition: border-color 0.2s;
    background: #fafafa;
    color: #1A1A1A;
    direction: rtl;
}
.profile-input:focus {
    border-color: #D4AF37;
    background: #fff;
}

/* --- Info mini-dialog (add-on descriptions) --- */
.info-dialog .glass-card {
    width: 320px;
    padding: 28px 24px;
}
.info-dialog .glass-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: #D4AF37;
    margin-bottom: 10px;
}
.info-dialog .glass-card p {
    font-size: 14px;
    color: #555;
    line-height: 1.7;
    margin-bottom: 18px;
}

/* --- Spinner overlay (shared) --- */
.processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f0e8c0;
    border-top-color: #D4AF37;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Responsive --- */
@media (max-width: 420px) {
    .glass-card { padding: 28px 20px; }
    .otp-digit  { width: 38px; height: 48px; font-size: 20px; }
}
