/* ===================================
   AGENT PORTAL — DASHBOARD STYLES
   shortletkey.ng B2B Platform
   =================================== */

/* ─── Body: agent mode ──────────────────────────────────────────────────────── */

body.agent-mode {
    overflow: hidden;
}

/* ─── Dashboard root ────────────────────────────────────────────────────────── */

#agentDashboard {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.agent-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */

.agent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 64px;
    min-height: 64px;
    background: var(--bg-color);
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    gap: 1rem;
    flex-shrink: 0;
}

.agent-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.agent-portal-tag {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-color);
    background: rgba(200, 158, 92, 0.12);
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    border: 1px solid rgba(200, 158, 92, 0.3);
}

.agent-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.agent-profile-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.agent-profile-chip strong {
    font-size: 0.93rem;
    color: var(--text-color);
    font-weight: 600;
}

.agent-profile-chip span {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Approval badges */
.agent-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.18rem 0.6rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.agent-badge.approved {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.agent-badge.pending {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.agent-badge.rejected {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ─── Tab navigation ─────────────────────────────────────────────────────────── */

.agent-tabs {
    display: flex;
    align-items: stretch;
    background: var(--bg-color);
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}

.agent-tabs::-webkit-scrollbar { display: none; }

.agent-tab {
    padding: 0 1.5rem;
    height: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
    font-family: var(--font-primary);
    flex-shrink: 0;
}

.agent-tab:hover {
    color: var(--primary-color);
    background: rgba(26, 84, 144, 0.04);
}

.agent-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* ─── Tab content area ───────────────────────────────────────────────────────── */

.agent-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.75rem 1.5rem;
    background: var(--bg-secondary);
}

.agent-tab-content::-webkit-scrollbar { width: 6px; }
.agent-tab-content::-webkit-scrollbar-track { background: transparent; }
.agent-tab-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* ─── Section header ─────────────────────────────────────────────────────────── */

.agent-section-hdr {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.agent-section-hdr h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

.agent-section-hdr span {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 400;
}

/* ─── Empty state ────────────────────────────────────────────────────────────── */

.agent-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.agent-empty p { margin: 0; font-size: 1rem; }

/* ─── Property cards grid ────────────────────────────────────────────────────── */

.agent-props-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.agent-prop-card {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
}

.agent-prop-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.agent-prop-img {
    height: 190px;
    overflow: hidden;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.agent-prop-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.agent-prop-card:hover .agent-prop-img img {
    transform: scale(1.04);
}

.agent-prop-body {
    padding: 1rem 1.1rem 0.75rem;
    flex: 1;
}

.agent-prop-body h3 {
    font-size: 0.975rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 0.35rem;
    line-height: 1.3;
    font-family: var(--font-primary);
}

.agent-prop-loc {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-light);
    font-size: 0.8rem;
    margin: 0 0 0.7rem;
}

.agent-prop-loc svg {
    flex-shrink: 0;
    color: var(--primary-color);
}

.agent-prop-feats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
}

.agent-prop-feats span {
    font-size: 0.75rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.agent-prop-price {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.agent-prop-price .ppn {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.agent-prop-price .per {
    font-size: 0.8rem;
    color: var(--text-light);
}

.agent-prop-price .comm-note {
    font-size: 0.72rem;
    color: var(--accent-color);
    font-weight: 600;
    margin-left: auto;
}

.agent-prop-actions {
    display: flex;
    gap: 0.6rem;
    padding: 0.75rem 1.1rem 1rem;
    border-top: 1px solid var(--border-color);
}

.agent-prop-actions .btn {
    flex: 1;
    justify-content: center;
    text-align: center;
    font-size: 0.82rem;
    padding: 0.55rem 0.75rem;
}

/* ─── Filter row ─────────────────────────────────────────────────────────────── */

.agent-filter-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.agent-filter-btn {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-primary);
}

.agent-filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.agent-filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* ─── Table ──────────────────────────────────────────────────────────────────── */

.agent-table-wrap {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

.agent-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.865rem;
    min-width: 700px;
}

.agent-table thead tr {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
}

.agent-table th {
    padding: 0.8rem 1rem;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    white-space: nowrap;
}

.agent-table td {
    padding: 0.8rem 1rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.agent-table tbody tr:last-child td {
    border-bottom: none;
}

.agent-table tbody tr:hover td {
    background: rgba(26, 84, 144, 0.03);
}

.agent-table td small {
    font-size: 0.72rem;
    color: var(--text-light);
    display: block;
    line-height: 1.4;
}

.res-actions {
    white-space: nowrap;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ─── Status badges ──────────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.22rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
    line-height: 1.4;
}

.badge-yellow {
    background: rgba(245, 158, 11, 0.12);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-green {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-orange {
    background: rgba(249, 115, 22, 0.1);
    color: #9a3412;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge-red {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-gray {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
    border: 1px solid rgba(100, 116, 139, 0.25);
}

/* ─── Extra-small button ─────────────────────────────────────────────────────── */

.btn-xs {
    padding: 0.28rem 0.65rem;
    font-size: 0.77rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-primary);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.btn-xs.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-xs.btn-primary:hover { background: var(--primary-dark); }

.btn-xs.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-xs.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-xs.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-xs.btn-danger:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

/* ─── Payments tab ───────────────────────────────────────────────────────────── */

.pay-summary-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.pay-summary-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.pay-summary-card h4 {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin: 0 0 0.6rem;
    font-family: var(--font-primary);
}

.sum-count {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.sum-total {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-color);
}

.pay-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.pay-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--warning-color);
}

.pay-card.paid {
    border-left-color: var(--success-color);
    opacity: 0.85;
}

.pay-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

.pay-card-info strong {
    font-size: 0.93rem;
    color: var(--text-color);
    font-weight: 700;
}

.pay-card-info span {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.expiry-warn {
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    color: #dc2626 !important;
}

.pay-card-amt {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

.pay-card-amt strong {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-color);
    white-space: nowrap;
}

/* ─── Detail modal content ───────────────────────────────────────────────────── */

.detail-grid {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.detail-grid p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.35rem 0;
}

.detail-grid p strong {
    color: var(--text-color);
    font-weight: 600;
    min-width: 110px;
    display: inline-block;
}

.detail-grid hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.5rem 0;
}

/* ─── Dark mode overrides ────────────────────────────────────────────────────── */

[data-theme="dark"] #agentDashboard {
    background: var(--bg-color);
}

[data-theme="dark"] .agent-header {
    background: var(--bg-color);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .agent-tabs {
    background: var(--bg-color);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .agent-tab-content {
    background: #0a1628;
}

[data-theme="dark"] .agent-prop-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .agent-prop-feats span {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.1);
    color: var(--text-secondary);
}

[data-theme="dark"] .agent-table-wrap {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .agent-table thead tr {
    background: rgba(255,255,255,0.04);
}

[data-theme="dark"] .agent-table td,
[data-theme="dark"] .agent-table th {
    border-color: var(--border-color);
}

[data-theme="dark"] .agent-filter-btn {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .agent-filter-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

[data-theme="dark"] .pay-summary-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .pay-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .badge-yellow {
    background: rgba(245,158,11,0.15);
    color: #fbbf24;
    border-color: rgba(245,158,11,0.3);
}

[data-theme="dark"] .badge-green {
    background: rgba(16,185,129,0.15);
    color: #34d399;
    border-color: rgba(16,185,129,0.3);
}

[data-theme="dark"] .badge-orange {
    background: rgba(249,115,22,0.15);
    color: #fb923c;
    border-color: rgba(249,115,22,0.3);
}

[data-theme="dark"] .badge-red {
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border-color: rgba(239,68,68,0.3);
}

[data-theme="dark"] .badge-gray {
    background: rgba(100,116,139,0.15);
    color: #94a3b8;
    border-color: rgba(100,116,139,0.3);
}

[data-theme="dark"] .agent-badge.approved {
    background: rgba(16,185,129,0.15);
    color: #34d399;
}

[data-theme="dark"] .agent-badge.pending {
    background: rgba(245,158,11,0.15);
    color: #fbbf24;
}

[data-theme="dark"] .btn-xs.btn-secondary {
    background: rgba(255,255,255,0.06);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .agent-header {
        padding: 0 1rem;
        height: 58px;
        min-height: 58px;
    }

    .agent-portal-tag { display: none; }

    .agent-profile-chip span { display: none; }

    .agent-tab {
        padding: 0 1rem;
        font-size: 0.81rem;
        height: 46px;
    }

    .agent-tab-content {
        padding: 1.25rem 1rem;
    }

    .agent-props-grid {
        grid-template-columns: 1fr;
    }

    .pay-summary-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .pay-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .pay-card-amt {
        flex-direction: row;
        align-items: center;
        width: 100%;
        justify-content: space-between;
    }

    .agent-table {
        min-width: 600px;
        font-size: 0.8rem;
    }

    .agent-table th,
    .agent-table td {
        padding: 0.65rem 0.75rem;
    }

    .res-actions {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .agent-header-right .btn {
        font-size: 0.78rem;
        padding: 0.4rem 0.7rem;
    }

    .agent-section-hdr h2 {
        font-size: 1.1rem;
    }

    .sum-count {
        font-size: 1.75rem;
    }
}
