/* ============================================================
   BrsApi.ir Panel — Shared Stylesheet (Light Theme)
   Matches brsapi.ir: white/light bg + dark header + green brand
   Used by: login.html, register.html, panel.html
   ============================================================ */

@font-face {
    font-family: 'Gandom';
    src: url('Gandom.woff2') format('woff2');
    font-display: swap;
}

/* ---------- DESIGN TOKENS ---------- */
:root {
    /* Backgrounds */
    --bg-page-start: #f5f5f5;
    --bg-page-end: #e8f5e9;
    --bg-card: #ffffff;
    --bg-input: #fafafa;
    --bg-muted: #f8f9fa;
    --bg-highlight: #e8f5e9;
    --bg-dark: #1a1a1a;
    --bg-dark-hover: #2d2d2d;

    /* Borders */
    --border: #e0e0e0;
    --border-strong: #c8c8c8;
    --border-focus: #66bb6a;

    /* Text */
    --text: #212121;
    --text-secondary: #555555;
    --text-muted: #888888;
    --text-on-dark: #ffffff;

    /* Brand (brsapi green) */
    --primary: #2e7d32;
    --primary-light: #388e3c;
    --primary-dark: #1b5e20;
    --primary-soft: #e8f5e9;

    /* Accents */
    --info: #1565c0;
    --danger: #c62828;
    --warning: #ef6c00;

    /* Radii */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);

    --transition: 0.2s ease;
}

/* ---------- BASE ---------- */
* {
    font-family: 'Gandom', Tahoma, sans-serif;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(135deg, var(--bg-page-start) 0%, var(--bg-page-end) 100%);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ---------- AUTH CONTAINER ---------- */
.container {
    max-width: 560px;
    width: 95%;
    background: var(--bg-card);
    padding: 40px 36px;
    margin: 24px auto;
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: cardIn 0.4s ease;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

h2 {
    text-align: center;
    color: var(--primary);
    font-size: 26px;
    margin: 0 0 8px;
    position: relative;
    padding-bottom: 18px;
    letter-spacing: -0.3px;
    font-weight: 700;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    width: 56px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.subtitle-link {
    text-align: center;
    margin: 0 0 24px;
}

.subtitle-link a {
    color: var(--info);
    text-decoration: none;
    font-size: 15px;
    transition: color var(--transition);
    cursor: pointer;
}

.subtitle-link a:hover {
    color: #0d47a1;
    text-decoration: underline;
}

/* ---------- FORM ELEMENTS ---------- */
label {
    display: block;
    margin-top: 18px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

input {
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--r-md);
    border: 2px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    font-size: 15px;
    margin-top: 6px;
    transition: border-color var(--transition),
    background var(--transition),
    box-shadow var(--transition);
}

input::placeholder {
    color: var(--text-muted);
}

input:hover:not(:disabled) {
    border-color: var(--border-strong);
}

input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.2);
}

input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-muted);
}

/* ---------- BUTTONS ---------- */
button {
    width: 100%;
    padding: 15px;
    margin-top: 22px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--r-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
    position: relative;
    overflow: hidden;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(46, 125, 50, 0.3);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: linear-gradient(135deg, #a5d6a7 0%, #81c784 100%);
    color: #ffffff;
}

button.loading {
    color: transparent !important;
    pointer-events: none;
}

button.loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- MESSAGES ---------- */
.message {
    margin-top: 16px;
    font-size: 14px;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    line-height: 1.7;
    min-height: 0;
}

.message:empty {
    display: none;
}

/* ---------- CAPTCHA ---------- */
.captcha-container {
    margin: 24px 0 8px;
    background: var(--bg-muted);
    padding: 16px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.captcha-display-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 360px;
    margin-inline: auto;
}

.captcha-image {
    display: block;
    width: 100%;
    max-width: 260px;
    min-width: 0;
    height: auto;
    aspect-ratio: 260 / 82;
    border: 2px solid var(--primary);
    border-radius: var(--r-sm);
    cursor: pointer;
    background: #ffffff;
    object-fit: contain;
    transition: transform var(--transition), box-shadow var(--transition);
}

.captcha-image:hover {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.refresh-captcha {
    width: auto;
    min-width: 0;
    margin: 0;
    cursor: pointer;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    transition: background var(--transition);
    user-select: none;
}

.refresh-captcha:hover {
    background: var(--primary-soft);
}

#captchaInput {
    width: 100%;
    min-width: 0;
    margin-top: 0;
    direction: ltr;
    text-align: center;
    letter-spacing: 6px;
    text-transform: lowercase;
    font-family: monospace;
}

/* ---------- LOADING OVERLAY ---------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
}

.loading-overlay[style*="display: flex"] {
    display: flex !important;
}

.spinner {
    border: 4px solid rgba(46, 125, 50, 0.15);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 46px;
    height: 46px;
    animation: spin 0.9s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    margin-bottom: 20px;
}

#loaderMessage {
    font-size: 16px;
    text-align: center;
    color: var(--text);
    padding: 0 24px;
    max-width: 480px;
    line-height: 1.9;
}

/* ---------- ALERT BOX ---------- */
.alert-box {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    border-right: 4px solid var(--warning);
    border-radius: var(--r-md);
    padding: 16px 18px;
    font-size: 14px;
    line-height: 1.8;
    margin-top: 20px;
    animation: pulse 1.8s infinite;
}

.alert-box p {
    margin: 8px 0 0;
    color: #6d4c00;
    font-size: 13px;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 108, 0, 0.3); }
    50%      { box-shadow: 0 0 0 8px rgba(239, 108, 0, 0); }
}

/* ---------- MODAL ---------- */
#modalBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 999;
    padding: 20px;
}

#modalContent {
    background: var(--bg-card);
    color: var(--text);
    padding: 30px;
    border-radius: var(--r-lg);
    text-align: center;
    max-width: 480px;
    width: 100%;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

#modalContent button {
    padding: 12px 28px !important;
    margin-top: 20px;
    width: auto !important;
}

/* ---------- REGISTER NOTICE ---------- */
.register-notice {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: var(--primary-soft);
    border: 1px solid #a5d6a7;
    border-right: 4px solid var(--primary);
    border-radius: var(--r-md);
    padding: 16px 18px;
    margin: 0 0 22px;
    color: var(--text);
}

.register-notice-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
    animation: pulse 2s infinite;
}

.register-notice-content strong {
    display: block;
    color: var(--primary-dark);
    font-size: 15px;
    margin-bottom: 6px;
    font-weight: 700;
}

.register-notice-content p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.85;
    color: var(--text-secondary);
}

.register-notice-content em {
    font-style: normal;
    color: var(--info);
    font-weight: 600;
}

/* ---------- INPUT ORIENTATION FIXES ---------- */
#phone,
input[type="email"] {
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
}

#emailCode {
    text-align: center;
    letter-spacing: 4px;
}

/* ---------- RESPONSIVE (MOBILE) ---------- */
@media (max-width: 520px) {
    body {
        align-items: flex-start;
        padding: 0;
    }

    .container {
        padding: 26px 20px;
        border-radius: var(--r-lg);
        margin: 12px auto;
    }

    h2 {
        font-size: 21px;
    }

    .captcha-container {
        padding: 12px;
        gap: 10px;
    }

    .captcha-display-row {
        grid-template-columns: minmax(0, 1fr) max-content;
        gap: 8px;
    }

    .captcha-image {
        width: 100%;
        max-width: none;
        height: auto;
        object-fit: contain;
    }

    .refresh-captcha {
        text-align: center;
        font-size: 12px;
        padding: 9px 8px;
        background: var(--primary-soft);
    }

    button {
        font-size: 15px;
        padding: 14px;
    }

    .register-notice {
        padding: 14px;
    }

    .register-notice-icon {
        font-size: 20px;
    }

    .register-notice-content strong {
        font-size: 14px;
    }

    .register-notice-content p {
        font-size: 12.5px;
    }
}
/* ---------- REGISTRATION SUCCESS MESSAGE ---------- */
.message.message-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.9;
    color: #2e7d32;
    background: #e8f5e9;
    border: 2px solid #2e7d32;
    border-right-width: 8px;
    border-radius: 14px;
    padding: 22px 18px;
    margin-top: 24px;
    box-shadow: 0 4px 14px rgba(46, 125, 50, 0.12);
}

.message.message-success::before {
    content: "✓";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    margin-bottom: 10px;
    border-radius: 50%;
    background: #2e7d32;
    color: #ffffff;
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
}

@media (max-width: 520px) {
    .message.message-success {
        font-size: 19px;
        padding: 18px 14px;
        margin-top: 20px;
    }

    .message.message-success::before {
        width: 42px;
        height: 42px;
        font-size: 27px;
    }
}

/* ---------- REGISTRATION SUCCESS PANEL LOGIN LINK ---------- */
.message.message-success .success-login-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 18px;
    padding: 12px 26px;
    min-height: 46px;
    box-sizing: border-box;
    border: 1px solid #1b6d35;
    border-radius: 9px;
    background: #2e7d32;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.6;
    text-decoration: none;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.message.message-success .success-login-link:hover {
    background: #256b29;
    box-shadow: 0 3px 10px rgba(46, 125, 50, 0.2);
}
.message.message-success .success-login-link:focus-visible {
    outline: 3px solid #8bc99a;
    outline-offset: 3px;
}
@media (max-width: 520px) {
    .message.message-success .success-login-link {
        width: 100%;
        padding-inline: 14px;
        font-size: 14px;
    }
}
