/**
 * Team Portal Dashboard Core
 * Consolidated stylesheet for dashboard layouts, widgets, and charts.
 * Replaces: dashboard.css, dashboard-widget.css, my-dashboard.css
 *
 * @package TeamPortal
 * @version 2.0.0
 */

/* ==========================================================================
   PART 1: DASHBOARD GRID & LAYOUT
   ========================================================================== */
.tp-dashboard-grid {
    padding: 20px;
    background: #f5f5f5;
    min-height: 600px;
}

.grid-stack { background: transparent; }
.grid-stack-item { border-radius: 8px; overflow: visible; } /* Visible overflow for shadows */

.grid-stack-item-content {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex; flex-direction: column;
}

.grid-stack-item-content:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* ==========================================================================
   PART 2: GENERIC WIDGET COMPONENTS
   ========================================================================== */
/* Widget Header */
.widget-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.widget-header h3 {
    margin: 0; font-size: 16px; font-weight: 600;
    display: flex; align-items: center; gap: 8px; color: #fff;
}
.widget-header .dashicons { font-size: 20px; width: 20px; height: 20px; }

.widget-actions { display: flex; gap: 5px; }
.widget-actions button {
    background: transparent; border: none; color: rgba(255, 255, 255, 0.8);
    cursor: pointer; padding: 4px; border-radius: 4px; transition: all 0.2s ease;
}
.widget-actions button:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }

/* Widget Body */
.widget-body {
    padding: 20px; flex: 1;
    overflow-y: auto;
    position: relative;
    max-height: 100%; /* For grid stack compatibility */
}
.widget-body::-webkit-scrollbar { width: 6px; }
.widget-body::-webkit-scrollbar-track { background: #f1f1f1; }
.widget-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* Widget Footer */
.widget-footer {
    padding: 12px 20px; background: #f9f9f9;
    border-top: 1px solid #e0e0e0; text-align: center;
}
.view-all-link {
    color: #667eea; text-decoration: none; font-weight: 500;
    display: inline-flex; align-items: center; gap: 5px; transition: all 0.2s ease;
}
.view-all-link:hover { color: #764ba2; }

/* ==========================================================================
   PART 3: STATS WIDGETS (Consolidated)
   ========================================================================== */
.dashboard-stats-grid,
.tp-widget-stats-overview .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px; margin-bottom: 30px;
}

.stat-card {
    background: white; border-radius: 12px; padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); /* Unified shadow */
    display: flex; align-items: center; gap: 16px;
    transition: all 0.3s ease; position: relative; overflow: hidden;
    border: 1px solid #e0e0e0;
}

.stat-card::before {
    content: ''; position: absolute; top: 0; right: 0; width: 4px; height: 100%;
    background: linear-gradient(180deg, var(--stat-color, #667eea), transparent);
    opacity: 0.8;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--stat-color, #667eea);
}

/* Stat Variants */
.stat-card-primary, .stat-clients { --stat-color: #667eea; }
.stat-card-success, .stat-active { --stat-color: #43e97b; }
.stat-card-warning, .stat-tax { --stat-color: #fa709a; }
.stat-card-info, .stat-documents { --stat-color: #4facfe; }
.stat-reminders { --stat-color: #f093fb; }
.stat-activities { --stat-color: #30cfd0; }

.stat-icon {
    width: 56px; height: 56px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    background: linear-gradient(135deg, var(--stat-color, #667eea), rgba(255,255,255,0.2));
    color: white; flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.stat-content { flex: 1; min-width: 0; }
.stat-label { font-size: 13px; color: #6b7280; margin: 0 0 6px 0; font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; color: #1f2937; margin: 0 0 4px 0; line-height: 1; }

.stat-change {
    font-size: 12px; display: flex; align-items: center; gap: 4px; color: #6b7280;
}
.stat-change.positive { color: #10b981; }
.stat-change.negative { color: #dc2626; }

/* ==========================================================================
   PART 4: WELCOME DASHBOARD (Overlay)
   ========================================================================== */
.welcome-dashboard {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 99999; display: none; opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: center; justify-content: center;
}
.welcome-dashboard.show { display: flex; opacity: 1; }

.dashboard-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px);
}

.dashboard-container {
    position: relative; width: 90%; max-width: 1200px; max-height: 85vh;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 24px; box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    overflow: hidden; display: flex; flex-direction: column;
}

.dashboard-header {
    background: #ffffff; padding: 20px 28px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.header-content { display: flex; align-items: center; gap: 16px; }
.header-icon {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    color: white; font-size: 24px;
}
.dashboard-title { margin: 0; font-size: 20px; font-weight: 700; color: #1e293b; }
.dashboard-subtitle { margin: 2px 0 0 0; font-size: 13px; color: #64748b; }

.header-actions { display: flex; gap: 8px; }
.dashboard-btn {
    width: 36px; height: 36px; border: none; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s ease; background: #f1f5f9; color: #64748b;
}
.dashboard-btn:hover { background: #e2e8f0; color: #334155; }
.dashboard-btn--close:hover { background: #fee2e2; color: #ef4444; }

.dashboard-content {
    flex: 1; overflow-y: auto; padding: 24px 28px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}

/* ==========================================================================
   PART 5: CHARTS & ACTIVITY
   ========================================================================== */
.chart-container {
    background: white; border-radius: 12px; padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); margin-bottom: 24px;
}
.chart-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; padding-bottom: 16px; border-bottom: 2px solid #f3f4f6;
}
.chart-title {
    font-size: 16px; font-weight: 700; color: #1f2937; margin: 0;
    display: flex; align-items: center; gap: 10px;
}
.chart-body { min-height: 250px; position: relative; }

/* Activity Panel */
.activity-panel {
    background: white; border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); overflow: hidden;
}
.panel-header {
    padding: 16px 20px; border-bottom: 1px solid #f3f4f6;
    display: flex; justify-content: space-between; align-items: center;
}
.panel-title { font-size: 15px; font-weight: 700; color: #1f2937; margin: 0; }

/* Recent Clients List */
.tp-widget-recent-clients .clients-list { display: flex; flex-direction: column; gap: 10px; }
.client-item {
    display: flex; align-items: center; gap: 12px; padding: 10px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
    transition: all 0.2s ease;
}
.client-item:hover { background: #fff; border-color: #667eea; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.client-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
