/* Dashboard Core Styles - Structure & Hierarchy */
/* Foundation for all dashboard layouts and sections */

/*
DASHBOARD TAXONOMY HIERARCHY:

Level 1: Dashboard Container
├── .dashboard-content
    ├── .dashboard-header
    └── .dashboard-body

Level 2: Section Types  
├── .dashboard-section.kpis
├── .dashboard-section.data-table
├── .dashboard-section.chart-grid
├── .dashboard-section.activity-feed
└── .dashboard-section.actions

Level 3: Content Components
├── .section-header (.section-title + .section-subtitle + .section-actions)
├── .section-content (.metric-grid | .data-table | .card-grid | .activity-list)

Level 4: Atomic Elements
├── .metric-card (.metric-header + .metric-content)
├── .data-row (.data-label + .data-value + .data-status)  
├── .activity-item (.activity-header + .activity-content)
*/

/* ===================================
   LEVEL 1: DASHBOARD CONTAINER
   =================================== */

.module-content .dashboard-content {
    width: 100%;
    height: 100%;
    padding: 16px !important;
    background: var(--bg-workspace);
    border-radius: var(--radius-2xl);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.dashboard-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    flex: 1;
}

/* ===================================
   LEVEL 2: SECTION TYPES
   =================================== */

.dashboard-section {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dashboard-section.kpis {
    /* KPI sections - metrics overview */
}

.dashboard-section.data-table {
    /* Table sections - structured data */
}

.dashboard-section.chart-grid {
    /* Visual chart sections */
}

.dashboard-section.activity-feed {
    /* Live activity/timeline sections */
    position: relative;
}

.dashboard-section.actions {
    /* Action button sections */
    text-align: center;
}

/* ===================================
   LEVEL 3: CONTENT COMPONENTS
   =================================== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-light);
}

.section-title {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.section-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

/* Section filters - positioned between badge and actions */
.section-filters {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    margin-left: auto;
    margin-right: var(--space-md);
}

/* Filter controls styling */
.filter-dropdown {
    padding: var(--space-xs) var(--space-md);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    min-width: 120px;
    height: 36px;
}

.filter-dropdown:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-xs);
}

.filter-dropdown:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.filter-search {
    padding: var(--space-xs) var(--space-md);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: var(--text-sm);
    min-width: 180px;
    height: 36px;
    transition: all 0.2s var(--ease-out);
}

.filter-search:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.filter-search::placeholder {
    color: var(--text-muted);
}

.filter-date {
    padding: var(--space-xs) var(--space-md);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: var(--text-sm);
    height: 36px;
    transition: all 0.2s var(--ease-out);
}

.filter-date:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.filter-checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    height: 36px;
    cursor: pointer;
    user-select: none;
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all 0.2s var(--ease-out);
}

.filter-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.section-content {
    /* Container for all section content */
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ===================================
   SCROLLABLE PANEL BEHAVIOR
   Fixed header, scrollable content
   =================================== */

/* Panel.js scrollable behavior - Fills parent height with internal scrolling */
.dashboard-section.scrollable-panel {
    display: flex;
    flex-direction: column;
    flex: 1;              /* Fill available parent height */
    min-height: 0;        /* Allow flex shrinking */
    overflow: hidden;     /* Contain scrolling within panel */
}

.dashboard-section.scrollable-panel .section-content {
    flex: 1;              /* Content area fills remaining space after header */
    min-height: 0;        /* Allow flex shrinking */
    overflow-y: auto;     /* Enable vertical scrolling */
    overflow-x: hidden;   /* Hide horizontal overflow */
}

/* CollapsiblePanel.js scrollable behavior - Fills parent height with internal scrolling */
.service-category-section.scrollable-panel {
    display: flex;
    flex-direction: column;
    flex: 1;              /* Fill available parent height */
    min-height: 0;        /* Allow flex shrinking */
    overflow: hidden;     /* Contain scrolling within panel */
}

.service-category-section.scrollable-panel .category-services-grid {
    flex: 1;              /* Content area fills remaining space */
    min-height: 0;        /* Allow flex shrinking */
    overflow-y: auto;     /* Enable vertical scrolling */
    overflow-x: hidden;   /* Hide horizontal overflow */
}

/* Content Layout Types */
/* Legacy classes for backward compatibility - now use unified-grid */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-md);
}

.section-content .data-table {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* Grid Responsive Variants - Legacy classes */
.grid-2 { 
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: var(--space-md);
}
.grid-3 { 
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: var(--space-md);
}
.grid-4 { 
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: var(--space-md);
}

/* ===================================
   LOADING & EMPTY STATES
   =================================== */

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
}

.loading-spinner {
    font-size: var(--text-2xl);
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-md);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-state p {
    margin: 0;
    font-size: var(--text-base);
    color: var(--text-muted);
}

.empty-module-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-xl);
}

.empty-module-state h2 {
    margin: 0 0 var(--space-md) 0;
    color: var(--text-secondary);
    font-size: var(--text-xl);
    font-weight: 600;
}

.empty-module-state p {
    margin: 0 0 var(--space-xl) 0;
    font-size: var(--text-base);
    color: var(--text-muted);
    max-width: 400px;
    line-height: 1.5;
}

.empty-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
}

.empty-state h3 {
    margin: 0 0 var(--space-xs) 0;
}

.empty-state p {
    margin: 0;
}

