/* ============================================================
   InvoiceCraft — Admin Dashboard Styles
   ============================================================ */
.admin-body { overflow: auto; }
.admin-badge {
    font-size: .65rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; padding: 2px 8px; border-radius: 4px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    color: #fff; margin-left: 4px;
}

/* ---- ADMIN MAIN ---- */
.admin-main {
    margin-top: 60px; padding: 24px 32px; max-width: 1400px; margin-left: auto; margin-right: auto;
    min-height: calc(100vh - 60px);
}

/* ---- TABS ---- */
.admin-tabs {
    display: flex; gap: 4px; margin-bottom: 24px;
    background: var(--bg-panel); padding: 4px; border-radius: var(--radius);
    border: 1px solid var(--border); width: fit-content;
}
.tab-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-muted);
    font-family: var(--font); font-size: .85rem; font-weight: 600;
    cursor: pointer; transition: all var(--transition);
}
.tab-btn:hover { color: var(--text); background: var(--bg-hover); }
.tab-btn.active {
    background: linear-gradient(135deg, var(--accent), var(--purple));
    color: #fff; box-shadow: 0 2px 12px var(--accent-glow);
}
.tab-content { display: none; animation: fadeSlideIn .3s ease; }
.tab-content.active { display: block; }

/* ---- STATS GRID ---- */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    display: flex; align-items: center; gap: 16px;
    padding: 20px 24px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    transition: all var(--transition);
}
.stat-card:hover { border-color: rgba(99,102,241,.3); transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon-blue { background: rgba(59,130,246,.15); color: #3b82f6; }
.stat-icon-green { background: rgba(34,197,94,.15); color: #22c55e; }
.stat-icon-purple { background: rgba(168,85,247,.15); color: #a855f7; }
.stat-icon-red { background: rgba(239,68,68,.15); color: #ef4444; }
.stat-icon-orange { background: rgba(245,158,11,.15); color: #f59e0b; }
.stat-icon-cyan { background: rgba(6,182,212,.15); color: #06b6d4; }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.stat-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; }

/* ---- CHARTS ---- */
.charts-grid {
    display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px;
}
.chart-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.chart-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.chart-header h3 { font-size: .9rem; font-weight: 700; }
.chart-body { padding: 20px; position: relative; height: 260px; }
.chart-body-doughnut { height: 260px; display: flex; align-items: center; justify-content: center; }
.chart-body canvas { max-height: 100%; }

/* ---- TABLES ---- */
.section-header-bar {
    padding: 16px 0; display: flex; align-items: center; justify-content: space-between;
}
.section-header-bar h3 { font-size: 1rem; font-weight: 700; }
.table-wrapper { overflow-x: auto; }
.admin-table {
    width: 100%; border-collapse: collapse;
    background: var(--bg-card); border-radius: var(--radius);
    overflow: hidden; border: 1px solid var(--border);
}
.admin-table thead { background: var(--bg-panel); }
.admin-table th {
    padding: 12px 16px; font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); text-align: left; white-space: nowrap;
}
.admin-table td {
    padding: 12px 16px; font-size: .85rem;
    border-top: 1px solid var(--border); white-space: nowrap;
}
.admin-table tbody tr { transition: background var(--transition); }
.admin-table tbody tr:hover { background: var(--bg-hover); }
.admin-table input[type="checkbox"] {
    width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer;
}

/* Status Pills */
.status-pill {
    display: inline-flex; padding: 3px 10px; border-radius: 12px;
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.status-pill.paid { background: var(--green-bg); color: #22c55e; }
.status-pill.unpaid { background: var(--red-bg); color: #ef4444; }
.status-pill.partial { background: var(--orange-bg); color: #f59e0b; }
.status-pill.overdue { background: var(--red-bg); color: #ef4444; }

/* Action buttons */
.action-btns { display: flex; gap: 4px; }
.action-btn {
    width: 30px; height: 30px; border-radius: 6px;
    border: 1px solid var(--border); background: transparent;
    color: var(--text-muted); cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: all var(--transition);
}
.action-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--text-dim); }
.action-btn.delete:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }

/* Empty state */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 48px; color: var(--text-dim); text-align: center;
}
.empty-state a { color: var(--accent-light); text-decoration: none; }
.empty-state a:hover { text-decoration: underline; }

/* ---- INVOICES TOOLBAR ---- */
.invoices-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.search-box {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0 12px; min-width: 260px;
}
.search-box input {
    background: transparent; border: none; padding: 10px 0;
    color: var(--text); font-size: .88rem; width: 100%;
}
.search-box input:focus { outline: none; }
.search-box svg { color: var(--text-dim); flex-shrink: 0; }
.filter-group { display: flex; gap: 8px; align-items: center; }
.filter-group select { min-width: 120px; }
.btn-danger { color: var(--red) !important; }
.btn-danger:hover { background: var(--red-bg) !important; border-color: var(--red) !important; }

/* ---- BULK GENERATE ---- */
.bulk-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.bulk-editor { display: flex; flex-direction: column; gap: 16px; }
.bulk-info-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
}
.bulk-info-card h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 6px; }
.bulk-info-card p { font-size: .85rem; color: var(--text-muted); }
.bulk-format-info {
    margin-top: 16px; padding: 16px; border-radius: var(--radius-sm);
    background: var(--bg-input); border: 1px solid var(--border);
}
.bulk-format-info h4 { font-size: .75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.bulk-format-info code {
    display: block; font-family: var(--font-mono); font-size: .78rem;
    color: var(--accent-light); padding: 8px; border-radius: 4px;
    background: rgba(99,102,241,.08); word-break: break-all;
}
.bulk-format-info pre {
    font-family: var(--font-mono); font-size: .75rem;
    color: var(--text-muted); padding: 8px; border-radius: 4px;
    background: var(--bg-panel); overflow-x: auto; white-space: pre;
    margin-top: 4px;
}
.bulk-business-section {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
}
.bulk-business-section h4 { font-size: .82rem; font-weight: 700; margin-bottom: 12px; }
.bulk-actions { display: flex; gap: 10px; }

/* Bulk preview panel */
.bulk-preview-panel {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    display: flex; flex-direction: column; max-height: calc(100vh - 180px);
}
.bulk-preview-list {
    flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.bulk-preview-list::-webkit-scrollbar { width: 5px; }
.bulk-preview-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.bulk-invoice-card {
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px;
    display: flex; justify-content: space-between; align-items: center;
    animation: fadeSlideIn .3s ease;
}
.bulk-invoice-info { display: flex; flex-direction: column; gap: 2px; }
.bulk-invoice-info strong { font-size: .88rem; }
.bulk-invoice-info span { font-size: .78rem; color: var(--text-muted); }
.bulk-invoice-amount { font-size: 1rem; font-weight: 700; color: var(--accent-light); }

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
    .admin-main { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
    .charts-grid { grid-template-columns: 1fr; }
    .bulk-layout { grid-template-columns: 1fr; }
    .invoices-toolbar { flex-direction: column; align-items: stretch; }
    .search-box { min-width: 100%; }
}
@media (max-width: 640px) {
    .admin-tabs { flex-wrap: wrap; width: 100%; }
    .tab-btn { flex: 1; justify-content: center; font-size: .78rem; padding: 8px 12px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
