/* ==========================================================================
   Dashboard Shared Styles
   Extracted from ManagerDashboard, LocationDashboard, ClientDashboard
   ========================================================================== */

/* Dashboard Page Layout */
.dashboard-page,
.location-dashboard-page {
    padding: 1.5rem;
}

.date-range-section,
.range-selector-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.location-name {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

/* ==========================================================================
   KPI Cards
   ========================================================================== */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-gauge-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Alarms Card */
.alarms-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.alarms-card .kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.alarms-card .kpi-icon.warning {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
}

.alarms-card .kpi-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.alarms-card .kpi-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alarms-card .kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.alarm-breakdown {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
}

.alarm-breakdown .prevented {
    color: #4ade80;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.alarm-breakdown .failed {
    color: #f87171;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ==========================================================================
   Chart Layout
   ========================================================================== */
.chart-section,
.grid-section {
    margin-bottom: 1.5rem;
}

.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-half {
    min-width: 0;
}

.chart-container {
    min-height: 300px;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.section-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.section-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Glass Card
   ========================================================================== */
.glass-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
}

/* ==========================================================================
   Heatmap Styles
   ========================================================================== */
.heatmap-container {
    padding: 1.5rem;
}

.heatmap-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-x: auto;
}

.heatmap-header,
.heatmap-row {
    display: flex;
    gap: 2px;
}

.heatmap-corner {
    width: 60px;
    flex-shrink: 0;
}

.heatmap-hour-label {
    width: 24px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
}

.heatmap-day-label {
    width: 60px;
    height: 24px;
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.heatmap-cell {
    width: 24px;
    height: 24px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.heatmap-cell:hover {
    transform: scale(1.2);
    z-index: 1;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: center;
}

.legend-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.legend-gradient {
    width: 200px;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg,
        #22c55e 0%,
        #84cc16 11%,
        #a3e635 22%,
        #d9f99d 33%,
        #fef08a 44%,
        #fcd34d 55%,
        #fbbf24 66%,
        #f97316 77%,
        #ea580c 88%,
        #dc2626 100%
    );
}

/* ==========================================================================
   DriveOff Source Styles
   ========================================================================== */
.source-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1.5rem;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.source-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.source-item.tablet .source-icon {
    color: #3b82f6;
}

.source-item.website .source-icon {
    color: #a855f7;
}

.source-data {
    display: flex;
    flex-direction: column;
}

.source-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.source-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.source-percent {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.source-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

.source-bar-tablet {
    background: #3b82f6;
}

.source-bar-website {
    background: #a855f7;
}

/* ==========================================================================
   Alarm Effectiveness Styles
   ========================================================================== */
.effectiveness-stats {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 1rem 0;
}

.effectiveness-gauge {
    text-align: center;
}

.gauge-value {
    font-size: 3rem;
    font-weight: 700;
}

.gauge-value.success {
    color: #4ade80;
}

.gauge-value.warning {
    color: #facc15;
}

.gauge-value.danger {
    color: #f87171;
}

.gauge-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.25rem;
}

.effectiveness-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.detail-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.detail-value {
    font-weight: 600;
    color: #fff;
}

.detail-item.success .detail-value {
    color: #4ade80;
}

.detail-item.danger .detail-value {
    color: #f87171;
}

.effectiveness-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.1);
}

.bar-prevented {
    background: #4ade80;
    transition: width 0.3s ease;
}

.bar-failed {
    background: #f87171;
    transition: width 0.3s ease;
}

/* ==========================================================================
   High Risk Visitors Grid
   ========================================================================== */
.visitors-container :deep(.visitors-grid) {
    background: transparent;
}

.plate-button {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: monospace;
    font-weight: 600;
}

.plate-button:hover {
    background: rgba(59, 130, 246, 0.3);
}

.plate-text {
    font-family: monospace;
    font-weight: 600;
    color: #60a5fa;
}

.amount-danger {
    color: #f87171;
    font-weight: 600;
}

.risk-tag {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.risk-tag.danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.risk-tag.warning {
    background: rgba(234, 179, 8, 0.2);
    color: #facc15;
}

/* ==========================================================================
   Plate Profile Popup
   ========================================================================== */
.plate-profile {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.stat-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.stat-value.danger {
    color: #f87171;
}

.profile-risk {
    text-align: center;
}

.risk-badge {
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-weight: 600;
}

.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.badge-warning {
    background: rgba(234, 179, 8, 0.2);
    color: #facc15;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.profile-timeline {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.profile-balance {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
}

.profile-balance.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.profile-balance.success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

/* ==========================================================================
   Loading & Tooltips
   ========================================================================== */
.loading-overlay,
.loading-content {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.loading-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
}

.tooltip-content {
    font-size: 0.85rem;
}

.tooltip-badge {
    display: inline-block;
    margin-top: 0.25rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.tooltip-badge.peak {
    background: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

.tooltip-badge.risk {
    background: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* ==========================================================================
   DevExpress Chart Overrides
   ========================================================================== */
.dashboard-page :deep(.dxc-tooltip-content),
.location-dashboard-page :deep(.dxc-tooltip-content) {
    background: rgba(30, 41, 59, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
}

.dashboard-page :deep(.dxc-legend-item-text),
.location-dashboard-page :deep(.dxc-legend-item-text) {
    fill: rgba(255, 255, 255, 0.8) !important;
}

.dashboard-page :deep(.dxc-axis-title text),
.location-dashboard-page :deep(.dxc-axis-title text) {
    fill: rgba(255, 255, 255, 0.6) !important;
}

.dashboard-page :deep(.dxc-tick text),
.location-dashboard-page :deep(.dxc-tick text) {
    fill: rgba(255, 255, 255, 0.6) !important;
}

.location-dashboard-page :deep(.dxc-scroll-bar-background) {
    fill: rgba(255, 255, 255, 0.1) !important;
}

.location-dashboard-page :deep(.dxc-scroll-bar) {
    fill: rgba(59, 130, 246, 0.5) !important;
}

/* ==========================================================================
   Location Tabs (ManagerDashboard)
   ========================================================================== */
.location-tabs :deep(.dxbs-tab-text) {
    color: rgba(255, 255, 255, 0.7);
}

.location-tabs :deep(.dxbs-active .dxbs-tab-text) {
    color: #fff;
}

/* ==========================================================================
   Responsive Breakpoints (following MOBILE-GUIDE.md conventions)
   ========================================================================== */

/* XLarge - Wide Desktop */
@media (max-width: 1399.98px) {
    .kpi-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet and below */
@media (max-width: 991.98px) {
    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .dashboard-page,
    .location-dashboard-page {
        padding: 1rem;
    }

    .date-range-section,
    .range-selector-section {
        margin-bottom: 1rem;
    }
}

/* Mobile (Small screens) */
@media (max-width: 767.98px) {
    .kpi-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .header-left {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .section-header h3 {
        font-size: 1rem;
    }

    .glass-card {
        padding: 0.75rem;
        border-radius: 10px;
    }

    .chart-container {
        min-height: 250px;
    }
}

/* XSmall Mobile (Phone) */
@media (max-width: 575.98px) {
    .dashboard-page,
    .location-dashboard-page {
        padding: 0.5rem;
    }

    .kpi-row {
        gap: 0.5rem;
    }

    .charts-row {
        gap: 1rem;
    }

    .chart-section,
    .grid-section {
        margin-bottom: 1rem;
    }

    .section-header h3 {
        font-size: 0.95rem;
    }

    .section-subtitle {
        font-size: 0.75rem;
    }

    .glass-card {
        padding: 0.5rem;
        border-radius: 8px;
    }

    .chart-container {
        min-height: 220px;
    }

    /* Heatmap adjustments for mobile */
    .heatmap-cell {
        width: 18px;
        height: 18px;
    }

    .heatmap-hour-label {
        width: 18px;
        font-size: 0.55rem;
    }

    .heatmap-day-label {
        width: 45px;
        font-size: 0.65rem;
    }

    .heatmap-corner {
        width: 45px;
    }

    .legend-gradient {
        width: 150px;
    }
}
