/* Dashboard Styles - Sage Pastel & QuickBooks Inspired */

/* Color Variables */
:root {
    --sage-primary: #A8B6A1;
    --sage-light: #DCE6D2;
    --sage-dark: #8C9A85;
    --sage-muted: #B8C9B1;
    
    --qb-green: #2E8B57;
    --qb-blue: #4A90E2;
    --qb-gray: #6D6D6D;
    --qb-light-gray: #F5F5F5;
    --qb-white: #FFFFFF;
    
    --text-primary: #2D3748;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7FAFC;
    --bg-accent: #EDF2F7;
    
    --border-color: #E2E8F0;
    --border-light: #EDF2F7;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.1);
}

/* Base Styles */
body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
}

/* Additional icon colors */
.kpi-card__icon--trash,
.shortcut-tile__icon--trash {
    background: rgba(244, 63, 94, 0.12);
    color: var(--danger);
}

/* Define danger variable if not already defined */
:root {
    --danger: #DC2626;
}

.container-fluid {
    padding: 1.5rem;
}

/* Quick Actions Title */
.quick-actions-title {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

/* Welcome Card */
.welcome-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 1.5rem;
    gap: 1.5rem;
    border: 1px solid var(--border-light);
    margin-bottom: 1.5rem;
}

.welcome-card__icon {
    background: var(--sage-light);
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--sage-primary);
    flex-shrink: 0;
}

.welcome-card__body {
    flex: 1;
    min-width: 200px;
}

.welcome-card__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.welcome-card__sub {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

.welcome-card__stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.welcome-card__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.welcome-card__stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sage-primary);
}

.welcome-card__stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Page Header */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}

.page-header__title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.page-header__sub {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0 0;
}

.page-header__actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--sage-light);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sage-primary);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--sage-primary);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.btn-outline-soft {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-outline-soft:hover {
    background: var(--sage-light);
    color: var(--sage-primary);
    border-color: var(--sage-muted);
}

/* KPI Cards */
.kpi-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 1.25rem;
    transition: all 0.3s ease;
    height: 100%;
    border: 1px solid var(--border-light);
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--sage-muted);
}

.kpi-card__accent {
    width: 4px;
    height: 100%;
    border-radius: var-radius-sm 0 0 var(--radius-sm);
    flex-shrink: 0;
}

.kpi-card__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.kpi-card__icon--info {
    background: var(--sage-light);
    color: var(--sage-primary);
}

.kpi-card__icon--success {
    background: rgba(46, 139, 87, 0.1);
    color: var(--qb-green);
}

.kpi-card__icon--warn {
    background: rgba(255, 193, 7, 0.1);
    color: #d97706;
}

.kpi-card__body {
    flex: 1;
}

.kpi-card__label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-card__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    line-height: 1.2;
}

.kpi-card__trend {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.25rem;
}

.trend-flat {
    color: var(--text-muted);
}

.kpi-card__arrow {
    margin-left: auto;
    font-size: 1rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.kpi-card:hover .kpi-card__arrow {
    transform: translateX(2px);
}

/* Compact KPI Cards */
.kpi-card--compact {
    padding: 1rem;
}

.kpi-card--compact .kpi-card__icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.kpi-card--compact .kpi-card__body {
    flex: 1;
}

.kpi-card--compact .kpi-card__label {
    font-size: 0.75rem;
}

.kpi-card--compact .kpi-card__value {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Shortcut Tiles */
.shortcut-tile {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    padding: 1.25rem;
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
    height: 100%;
}

.shortcut-tile:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--sage-muted);
}

.shortcut-tile__icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
    background: var(--sage-light);
    color: var(--sage-primary);
}

.shortcut-tile__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    text-align: center;
}

.shortcut-tile__sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    text-align: center;
    line-height: 1.3;
}

.shortcut-tile__badge {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    /* Hide by default, will be shown via JS when needed */
    display: none;
}

/* Show badge when it has content */
.shortcut-tile__badge:not(:empty) {
    display: flex;
}

/* Trash badge specific styling */
.shortcut-tile__badge--trash {
    background: var(--danger);
}

/* Charts */
.chart-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.card-header-custom {
    background: var(--sage-light);
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header-custom h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-header-custom small {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.card-body-custom {
    padding: 1.5rem;
}

.card-body-custom--flush {
    padding: 0;
}

/* Activity List */
.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-list li {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.activity-list li:last-child {
    border-bottom: none;
}

.activity-list li .activity-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.activity-list li .activity-content {
    flex: 1;
}

.activity-list li .activity-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    display: block;
}

.activity-list li .activity-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
}

/* Loading state */
.activity-list-loading {
    justify-content: center;
}

/* No activity state */
.activity-list-no-activity {
    justify-content: center;
    opacity: 0.7;
    font-style: italic;
}

/* Predictions */
.insight-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}

.insight-item:last-child {
    border-bottom: none;
}

.insight-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.insight-icon--success {
    background: rgba(46, 139, 87, 0.1);
    color: var(--qb-green);
}

.insight-icon--info {
    background: rgba(74, 144, 226, 0.1);
    color: var(--qb-blue);
}

.insight-item div {
    flex: 1;
}

.insight-item small {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.insight-item strong {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Recommendations */
.recommendation-list {
    margin-top: 1rem;
}

/* Insight Divider */
.insight-divider {
    border-color: var(--border-subtle);
    margin: 1.5rem 0;
}

.recommendation-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.recommendation-item:last-child {
    border-bottom: none;
}

.recommendation-item .rec-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
    background: var(--sage-light);
    color: var(--sage-primary);
}

.recommendation-item .rec-content {
    flex: 1;
}

.recommendation-item .rec-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    display: block;
    font-size: 0.9rem;
}

.recommendation-item .rec-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* System Health */
.health-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 0;
    justify-content: space-between;
}

.health-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--sage-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    min-width: 120px;
    flex: 1;
    min-width: 120px;
}

.health-pill__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sage-primary);
}

.health-pill span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.health-cache-bar {
    width: 100%;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.health-cache-bar__fill {
    height: 100%;
    background: var(--sage-primary);
    width: 0%;
    transition: width 0.3s ease;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container-fluid {
        padding: 1rem;
    }
    
    .welcome-card {
        flex-direction: column;
        text-align: center;
    }
    
    .welcome-card__body {
        text-align: center;
        width: 100%;
    }
    
    .welcome-card__stats {
        justify-content: center;
        width: 100%;
        margin-top: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .page-header__actions {
        align-self: flex-start;
    }
    
    .kpiStrip,
    .row.g-3.mb-4: nth-child(2) {
        flex-direction: column;
    }
    
    .col-xl-3.col-md-6 {
        width: 100%;
        max-width: 100%;
    }
    
    .health-strip {
        flex-direction: column;
        align-items: stretch;
    }
    
    .health-pill {
        min-width: 100%;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Focus States */
.btn-outline-soft:focus,
.kpi-card:focus,
.shortcut-tile:focus {
    outline: 2px solid var(--sage-primary);
    outline-offset: 2px;
}

/* Dark Mode Support (if needed) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #2D3748;
        --bg-secondary: #1A202C;
        --bg-accent: #4A5568;
        --text-primary: #E2E8F0;
        --text-secondary: #CBD5E0;
        --text-muted: #A0AEC0;
        --border-color: #4A5568;
        --border-light: #2D3748;
    }
    
    .welcome-card,
    .kpi-card,
    .shortcut-tile,
    .chart-card {
        background: var(--bg-primary);
        box-shadow: var(--shadow-md);
    }
    
    .welcome-card__icon,
    .kpi-card__icon--info,
    .shortcut-tile__icon {
        background: var(--bg-accent);
    }
}