/* ========================================
   BILLFAST DASHBOARD STYLES
   Uses the same CSS variable system as landing.css/styles.css
   ======================================== */

.dashboard-main {
    padding: 7rem 2rem 4rem;
    min-height: 100vh;
}

.dashboard-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.dashboard-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 0.25rem;
    color: var(--text-main);
}

.dashboard-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.btn-export:hover {
    background: var(--surface-hover, #ECEDF2);
    color: var(--text-main);
}

.btn-export:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 0.4rem;
}

.stat-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Dashboard row */
.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.25rem;
    align-items: start;
}

/* Generic dash card */
.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.dash-card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.dash-card-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.dash-link {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.dash-link:hover {
    text-decoration: underline;
}

/* Chart */
.chart-wrap {
    position: relative;
}

#activityChart {
    width: 100% !important;
    max-height: 220px;
}

.chart-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Top Clients */
.clients-card {
    min-height: 280px;
}

.clients-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.client-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.client-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(107, 78, 255, 0.15);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.client-info {
    flex: 1;
    min-width: 0;
}

.client-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-count {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.client-total {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}

.clients-empty {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 1rem 0;
}

/* Invoices Table */
.invoices-card {
    padding: 1.5rem;
}

.invoices-table-wrap {
    overflow-x: auto;
}

.invoices-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.invoices-table thead tr {
    border-bottom: 1px solid var(--border);
}

.invoices-table th {
    text-align: left;
    padding: 0 0.75rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.invoices-table th:last-child,
.invoices-table td:last-child {
    text-align: right;
}

.invoices-table td {
    padding: 0.875rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.invoices-table tbody tr:last-child td {
    border-bottom: none;
}

.invoices-table tbody tr:hover td {
    background: var(--surface-hover);
}

.invoice-num-cell {
    font-weight: 600;
    color: var(--text-main) !important;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.invoice-amount-cell {
    font-weight: 700;
    color: var(--text-main) !important;
}

.table-empty {
    padding: 3rem 1rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: var(--text-secondary);
}

/* Plan Badge */
.dashboard-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.plan-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    line-height: 1.2;
    white-space: nowrap;
}

.plan-badge-free {
    background: var(--border);
    color: var(--text-secondary);
}

.plan-badge-pro {
    background: linear-gradient(135deg, #6B4EFF, #9B7DFF);
    color: white;
}

.plan-badge-business {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: white;
}

/* Gated Button Lock Icon */
.btn-lock-icon {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-left: 0.1rem;
}

.btn-gated {
    position: relative;
}

/* Hide lock icon when user has Business plan */
.btn-unlocked .btn-lock-icon {
    display: none;
}

/* Nav Active State */
.nav-link-active {
    color: var(--primary) !important;
    position: relative;
}

.nav-link-active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

/* Empty State (enhanced) */
.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(107, 78, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--primary);
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 0.4rem;
}

.empty-state-sub {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
    max-width: 320px;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 900px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-row {
        grid-template-columns: 1fr;
    }

    .dashboard-main {
        padding: 5rem 1rem 3rem;
    }
}

@media (max-width: 500px) {
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .dashboard-header {
        flex-direction: column;
    }
}

/* Upgrade Banner */
.upgrade-banner {
    background: linear-gradient(135deg, rgba(107,78,255,0.12) 0%, rgba(107,78,255,0.06) 100%);
    border: 1px solid rgba(107,78,255,0.25);
    border-radius: var(--radius-lg, 16px);
    padding: 1rem 1.5rem;
}

.upgrade-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.upgrade-banner-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.upgrade-banner-text strong {
    font-size: 0.95rem;
    color: var(--text-main);
}

.upgrade-banner-text span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.upgrade-banner-cta {
    flex-shrink: 0;
    padding: 0.5rem 1.25rem;
    background: var(--primary, #6B4EFF);
    color: white;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, transform 0.15s;
    white-space: nowrap;
}

.upgrade-banner-cta:hover {
    background: var(--primary-dark, #5538e0);
    transform: translateY(-1px);
}
