/* =============================================
   SIGNL — Admin Dashboard Styles
   ============================================= */

/* ── Admin Layout ── */
.admin-content {
    padding-top: var(--space-md);
}

/* ── Tab Content ── */
.tab-content {
    display: none;
    animation: fade-in 250ms ease;
}

.tab-content.active {
    display: block;
}

/* ── Stats Row ── */
.admin-stats {
    margin-bottom: var(--space-xl);
}

.stat-card .stat-change {
    font-size: 0.75rem;
    margin-top: 4px;
}

.stat-change.positive {
    color: var(--green);
}

.stat-change.negative {
    color: var(--red);
}

.stat-value-red {
    color: var(--red) !important;
}

.stat-value-green {
    color: var(--green) !important;
}

/* ── Health Indicator ── */
.health-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.health-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.health-item .health-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.health-item .health-status {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: auto;
}

/* ── Admin Tables ── */
.admin-table-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.admin-table-actions .table-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── User Tiers ── */
.tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tier-scout .badge {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
}

.tier-pro .badge {
    background: var(--accent-glow);
    color: var(--accent);
}

.tier-admin .badge {
    background: rgba(0, 230, 118, 0.08);
    color: var(--green);
}

/* ════════════════════════════════════════════
   EMAIL CENTER
   ════════════════════════════════════════════ */

/* ── Email Stats Grid ── */
.email-stats {
    margin-bottom: var(--space-lg);
}

/* ── Insights Row (chart + breakdown side by side) ── */
.email-insights-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.email-volume-card,
.email-type-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.email-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Email Volume Bar Chart ── */
.email-volume-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
    padding-top: var(--space-sm);
}

.email-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    justify-content: flex-end;
}

.email-bar {
    width: 100%;
    max-width: 36px;
    background: linear-gradient(180deg, var(--accent, #a78bfa), rgba(167, 139, 250, 0.4));
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: height 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    min-height: 4px;
}

.email-bar:hover {
    background: linear-gradient(180deg, #c4b5fd, rgba(196, 181, 253, 0.6));
    transform: scaleX(1.1);
}

.email-bar-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

.email-bar-value {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ── Template Type Breakdown ── */
.email-type-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.type-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.type-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 100px;
}

.type-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
}

.type-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.type-count {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 24px;
    text-align: right;
}

/* ── Quick Actions ── */
.email-quick-actions {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.email-action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.btn-action {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 200ms ease;
    text-align: left;
    color: var(--text-primary);
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent, #a78bfa);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-action:active {
    transform: translateY(0);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.action-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.action-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.action-text strong {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.action-text small {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── Email Log Table ── */
.email-subject-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-status-sent {
    color: var(--green);
}

.email-status-failed {
    color: var(--red);
}

.email-status-skipped {
    color: var(--amber, #f59e0b);
}

/* ── Modal Extras ── */
.modal-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
    line-height: 1.5;
}

/* ══════════════════════════════════════════
   AI COSTS
   ══════════════════════════════════════════ */

.cost-chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.cost-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 200px;
    padding-top: var(--space-md);
}

.cost-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    justify-content: flex-end;
}

.cost-bar {
    width: 100%;
    max-width: 40px;
    background: var(--accent);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: height 600ms ease;
    position: relative;
    min-height: 4px;
}

.cost-bar:hover {
    background: var(--accent-hover);
}

.cost-bar-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

.cost-bar-value {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
}

.cost-totals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.cost-total {
    text-align: center;
}

.cost-total-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.cost-total-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ══════════════════════════════════════════
   ENGINE PANEL
   ══════════════════════════════════════════ */

.engine-panel {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.engine-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.engine-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.engine-status .status-text {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

/* ── Dry Run Toggle ── */
.dry-run-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* ══════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════ */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    max-width: 420px;
    padding: 12px 20px;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-md, 8px);
    color: var(--text-primary, #e2e8f0);
    font-size: 0.88rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
}

.toast-exiting {
    opacity: 0;
    transform: translateY(8px);
    transition: all 300ms ease;
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */

@media (max-width: 768px) {
    .health-grid {
        grid-template-columns: 1fr;
    }

    .email-insights-row {
        grid-template-columns: 1fr;
    }

    .email-action-buttons {
        grid-template-columns: 1fr;
    }

    .cost-totals {
        grid-template-columns: 1fr;
    }

    .engine-panel {
        flex-direction: column;
        align-items: flex-start;
    }
}