/* SecreTrip Agent Portal - Inherits from Astra theme */

/* ── Base — inherit everything from theme ── */
.sra-portal,
.sra-portal * {
    box-sizing: border-box;
}

.sra-portal {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    direction: rtl;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* ── Header ── */
.sra-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--ast-global-color-0, #1a1a2e);
    color: #fff;
    padding: 24px 30px;
    border-radius: 12px;
    margin-bottom: 24px;
}
.sra-header h1 {
    margin: 0;
    font-size: 22px;
    font-family: inherit;
    color: #fff;
}
.sra-subtitle { margin: 4px 0 0; color: rgba(255,255,255,.7); font-size: 14px; }

/* ── Stats ── */
.sra-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.sra-stat {
    background: #fff;
    border-radius: 10px;
    padding: 18px 22px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    border-top: 3px solid var(--ast-global-color-0, #0ea5e9);
}
.sra-stat-num {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--ast-global-color-0, #0ea5e9);
    font-family: inherit;
}
.sra-stat-label { font-size: 13px; color: #64748b; margin-top: 4px; display: block; }

/* ── Tabs ── */
.sra-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}
.sra-tab {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    color: #64748b;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all .2s;
}
.sra-tab.active, .sra-tab:hover {
    color: var(--ast-global-color-0, #0ea5e9);
    border-bottom-color: var(--ast-global-color-0, #0ea5e9);
}
.sra-tab-content { display: none; }
.sra-tab-content.active { display: block; }

/* ── Filters ── */
.sra-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}
.sra-filters input,
.sra-filters select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

/* ── Table ── */
.sra-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sra-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    min-width: 600px;
}
.sra-table th {
    background: var(--ast-global-color-0, #1e293b);
    color: #fff;
    padding: 12px 14px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
}
.sra-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    vertical-align: middle;
}
.sra-table tr:hover td { background: #f8fafc; }
.sra-table tr:last-child td { border-bottom: none; }
.sra-commission { color: #059669; }
.sra-loading { text-align: center; padding: 30px; color: #94a3b8; }

/* ── Badges ── */
.sra-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.sra-badge-pending   { background: #fef3c7; color: #92400e; }
.sra-badge-matched   { background: #dbeafe; color: #1e40af; }
.sra-badge-confirmed { background: #d1fae5; color: #065f46; }
.sra-badge-paid      { background: #d1fae5; color: #065f46; }
.sra-badge-cancelled { background: #fee2e2; color: #991b1b; }

/* ── Buttons — inherit from Astra/WooCommerce ── */
.sra-btn {
    display: inline-block;
    padding: 9px 20px;
    border-radius: var(--ast-button-border-radius, 6px);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all .2s;
    line-height: 1.4;
}
.sra-btn-primary {
    background: var(--ast-global-color-0, #0ea5e9);
    color: #fff !important;
}
.sra-btn-primary:hover {
    background: var(--ast-global-color-1, #0284c7);
    color: #fff !important;
    text-decoration: none;
}
.sra-btn-secondary { background: #64748b; color: #fff !important; }
.sra-btn-outline {
    background: transparent;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.5);
}
.sra-btn-outline:hover { background: rgba(255,255,255,.1); text-decoration: none; }

/* Admin context — outline button should be visible on white background */
.sra-admin .sra-btn-outline,
.wrap .sra-btn-outline {
    color: #334155 !important;
    border: 1.5px solid #cbd5e1;
    background: #fff;
}
.sra-admin .sra-btn-outline:hover,
.wrap .sra-btn-outline:hover {
    background: #f1f5f9;
    color: #1e293b !important;
}
.sra-btn-sm   { padding: 6px 14px; font-size: 13px; }
.sra-btn-lg   { padding: 12px 28px; font-size: 16px; width: 100%; text-align: center; display: block; }

/* ── Form ── */
.sra-form-wrap {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    max-width: 580px;
    margin: 0 auto;
}
.sra-form-wrap h2 { margin-top: 0; font-family: inherit; }
.sra-form-note { color: #64748b; font-size: 14px; margin-bottom: 24px; }
.sra-form-row { margin-bottom: 18px; }
.sra-form-row label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    font-family: inherit;
}
.sra-form-row input,
.sra-form-row select,
.sra-form-row textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border .2s;
    box-sizing: border-box;
    background: #fff;
    color: inherit;
}
.sra-form-row input:focus,
.sra-form-row select:focus,
.sra-form-row textarea:focus {
    outline: none;
    border-color: var(--ast-global-color-0, #0ea5e9);
    box-shadow: 0 0 0 3px rgba(14,165,233,.1);
}
.sra-form-row small { display: block; color: #64748b; font-size: 12px; margin-top: 4px; }
.req { color: #ef4444; }

/* ── Notices ── */
.sra-notice {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 14px;
    font-family: inherit;
}
.sra-notice-success { background: #d1fae5; color: #065f46; border-right: 4px solid #059669; }
.sra-notice-error   { background: #fee2e2; color: #991b1b; border-right: 4px solid #ef4444; }
.sra-notice-info    { background: #dbeafe; color: #1e40af; border-right: 4px solid #3b82f6; }

/* ── Login ── */
.sra-login-prompt { display: flex; justify-content: center; padding: 60px 20px; }
.sra-login-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    max-width: 360px;
    width: 100%;
}
.sra-login-box h2 { margin-top: 0; font-family: inherit; }
.sra-login-box p  { color: #64748b; margin-bottom: 24px; }
.sra-login-box .sra-btn { margin: 6px; }

/* ── Admin ── */
.sra-admin-actions { margin-bottom: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.sra-inline-input  { width: 80px; padding: 4px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-family: inherit; }
.sra-inline-select { padding: 4px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; font-family: inherit; }

/* ── WooCommerce card (trip plans) ── */
.sra-product-badge {
    display: inline-block;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 6px;
}

/* ════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════ */

/* Tablet */
@media (max-width: 900px) {
    .sra-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile */
@media (max-width: 768px) {
    .sra-portal { padding: 12px; }

    .sra-header {
        flex-direction: column;
        gap: 14px;
        text-align: center;
        padding: 20px;
    }

    .sra-portal .sra-stats { gap: 6px !important; padding-bottom: 8px; }
    .sra-portal .sra-stat  { padding: 8px 10px; min-width: 72px !important; max-width: 88px !important; }
    .sra-portal .sra-stat-num { font-size: 15px; }
    .sra-portal .sra-stat-label { font-size: 10px; }

    .sra-tabs { gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .sra-tab  { white-space: nowrap; padding: 10px 14px; font-size: 14px; }

    .sra-filters { flex-direction: column; }
    .sra-filters input,
    .sra-filters select { width: 100%; }

    /* Table scrolls horizontally on mobile — critical fix */
    .sra-table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
        display: block;
        width: 100%;
    }
    .sra-table {
        min-width: 600px;
        display: table;
    }
    .sra-table th,
    .sra-table td { padding: 10px 10px; font-size: 13px; white-space: nowrap; }

    .sra-form-wrap { padding: 20px; }
    .sra-btn-lg { padding: 14px; font-size: 15px; }

    .sra-admin-actions { flex-direction: column; }
    .sra-admin-actions .sra-btn { width: 100%; text-align: center; }
}

/* Small mobile */
@media (max-width: 400px) {
    .sra-portal .sra-stats { gap: 5px !important; }
    .sra-portal .sra-stat  { padding: 7px 8px; min-width: 65px !important; max-width: 80px !important; }
    .sra-portal .sra-stat-num { font-size: 13px; }
    .sra-portal .sra-stat-label { font-size: 10px; }
    .sra-header h1 { font-size: 18px; }
}

/* ── Agent Check Modal ── */
#sra-modal-overlay {
    animation: sraFadeIn .2s ease;
}
#sra-modal-box {
    animation: sraSlideUp .25s ease;
}
@keyframes sraFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes sraSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── FAQ ── */
.sra-faq { display: flex; flex-direction: column; gap: 10px; }
.sra-faq-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 18px;
}
.sra-faq-item summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    color: #1e293b;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sra-faq-item summary::-webkit-details-marker { display: none; }
.sra-faq-item summary::after {
    content: '+';
    font-size: 20px;
    color: #0ea5e9;
    font-weight: 400;
    transition: transform .2s;
}
.sra-faq-item[open] summary::after { transform: rotate(45deg); }
.sra-faq-item p {
    margin: 12px 0 0;
    color: #475569;
    font-size: 14px;
    line-height: 1.7;
}

/* Rates table mobile scroll */
.sra-portal #tab-rates .sra-table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .sra-faq-item { padding: 12px 14px; }
    .sra-faq-item summary { font-size: 14px; }
    .sra-faq-item p { font-size: 13px; }
}