/* NoWaitn Dashboard - Main Styles */

:root {
    --primary-bg: #0f172a;
    --secondary-bg: #1e293b;
    --accent-blue: #00d4ff;
    --accent-cyan: #00ffff;
    --accent-purple: #8b5cf6;
    --accent-green: #00ff88;
    --accent-yellow: #fbbf24;
    --accent-red: #ff3366;
    --accent-orange: #ff6b35;
    --text-primary: #ccd6f6;
    --text-secondary: #8892b0;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --glass-bg: rgba(15, 23, 42, 0.8);
    --glass-border: rgba(100, 100, 120, 0.3);
    --glow-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Iframe optimization */
html.in-iframe body {
    overflow: hidden;
    height: 100vh;
    min-height: auto;
}

html.in-iframe .dashboard {
    height: 100vh;
    overflow: hidden;
}

html.in-iframe .mobile-menu-overlay,
html.in-iframe .mobile-menu {
    display: none !important;
}

.dashboard {
    display: grid;
    grid-template-areas: 
        "header header"
        "center drawer";
    grid-template-columns: 1fr 80px;
    grid-template-rows: 80px 1fr;
    min-height: 100vh;
    position: relative;
}

#header-nav {
    grid-area: header;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, 
        rgba(15, 23, 42, 0.98) 0%, 
        rgba(30, 41, 59, 0.98) 50%, 
        rgba(51, 65, 85, 0.98) 100%);
    backdrop-filter: blur(20px);
}

#center-content {
    grid-area: center;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
    background: rgba(15, 23, 42, 0.3);
}

#advanced-sidebar {
    grid-area: drawer;
    background: linear-gradient(135deg, 
        rgba(15, 23, 42, 0.95) 0%, 
        rgba(30, 41, 59, 0.95) 100%);
    border-left: 1px solid rgba(148, 163, 184, 0.2);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    padding: 20px;
    width: 100%;
    max-width: 100vw;
}

/* Tile Base Styles */
.metric-tile, .viz-tile, .status-tile, .system-tile {
    background: linear-gradient(135deg, 
        rgba(15, 23, 42, 0.95) 0%, 
        rgba(30, 41, 59, 0.95) 100%);
    border: 1px solid rgba(100, 100, 120, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    padding: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.metric-tile:hover, .viz-tile:hover, .status-tile:hover, .system-tile:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.15);
    transform: translateY(-2px);
}

/* Tile Sizes */
.metric-tile.compact {
    grid-column: span 1;
    min-height: 120px;
}

.viz-tile.large {
    grid-column: span 2;
    min-height: 350px;
}

.viz-tile.medium {
    grid-column: span 1;
    min-height: 250px;
}

.viz-tile.small {
    grid-column: span 1;
    min-height: 180px;
}

.status-tile, .system-tile {
    grid-column: span 1;
    min-height: 200px;
}

/* Tile Headers */
.tile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(100, 100, 120, 0.1);
}

.tile-icon {
    font-size: 18px;
    margin-right: 8px;
}

.tile-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tile-controls {
    display: flex;
    gap: 4px;
}

.control-btn {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: var(--accent-cyan);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-cyan);
}

.control-btn.active {
    background: var(--accent-cyan);
    color: var(--primary-bg);
}

/* Metric Tiles */
.metric-value.large {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 8px 0;
}

.metric-trend {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.metric-trend.positive {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.metric-trend.negative {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.metric-trend.neutral {
    background: rgba(156, 163, 175, 0.2);
    color: var(--text-secondary);
}

/* D3 Visualization Containers */
.d3-viz {
    width: 100%;
    height: calc(100% - 60px);
    min-height: 150px;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

/* Mini Charts */
.mini-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    height: calc(100% - 60px);
}

.mini-chart {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.mini-chart-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.mini-metric {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-cyan);
}

.mini-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mini-bar {
    height: 4px;
    background: rgba(0, 212, 255, 0.2);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.mini-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
    transition: width 0.5s ease;
}

/* Alert List */
.alert-list {
    max-height: 150px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin-bottom: 6px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.alert-item:hover {
    background: rgba(0, 0, 0, 0.4);
}

.alert-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.alert-item.warning .alert-dot {
    background: var(--warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.alert-item.info .alert-dot {
    background: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}

.alert-item.success .alert-dot {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.alert-text {
    flex: 1;
    font-size: 12px;
    color: var(--text-primary);
}

.alert-time {
    font-size: 10px;
    color: var(--text-secondary);
}

/* System Stats */
.system-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.system-stat {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    width: 60px;
    text-transform: uppercase;
}

.stat-bar {
    flex: 1;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--accent-cyan));
    transition: width 0.5s ease;
    border-radius: 4px;
}

.stat-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    width: 40px;
    text-align: right;
}

/* Chart Placeholders with Animation */
.chart-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: radial-gradient(circle at center, rgba(0, 212, 255, 0.05), transparent);
}

.chart-pulse {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 2px solid var(--accent-cyan);
    border-radius: 50%;
    opacity: 0.3;
    animation: pulse 2s infinite;
}

.chart-data {
    display: flex;
    gap: 4px;
    align-items: end;
    height: 40px;
}

.data-point {
    width: 8px;
    background: linear-gradient(to top, var(--accent-cyan), transparent);
    border-radius: 2px;
    transition: height 0.5s ease;
    animation: dataFlow 3s infinite;
}

.data-point:nth-child(2) { animation-delay: 0.2s; }
.data-point:nth-child(3) { animation-delay: 0.4s; }
.data-point:nth-child(4) { animation-delay: 0.6s; }
.data-point:nth-child(5) { animation-delay: 0.8s; }

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.2;
    }
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}

@keyframes dataFlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .viz-tile.large {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
    }
    
    .metric-tile.compact,
    .viz-tile.large,
    .viz-tile.medium,
    .viz-tile.small {
        grid-column: span 1;
    }
    
    .tile-controls {
        flex-wrap: wrap;
    }
}

/* Sidebar Styles */
.sidebar-left,
.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Panel Base Styles */
.panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 2px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
    opacity: 0.6;
}

.panel:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 212, 255, 0.2);
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 300px 1fr 250px;
        gap: 16px;
    }
    
    .panel {
        padding: 20px;
    }
}

@media (max-width: 1000px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .sidebar-left,
    .sidebar-right {
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
}

@media (max-width: 768px) {
    .dashboard {
        padding: 12px;
    }
    
    .panel {
        padding: 16px;
    }
    
    .panel-title {
        font-size: 14px;
    }
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.2), transparent);
    animation: loadingShimmer 1.5s infinite;
}

@keyframes loadingShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.hidden { display: none; }
.fade-in { animation: fadeIn 0.3s ease-in; }

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

/* Import advanced header styles */
@import url('advanced-header.css');
