/* Import Rubik towards 4human guidelines */
@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&display=swap');

/* ============================================= */
/* CSS Custom Properties - 4human Theme          */
/* ============================================= */
:root {
    /* Background - Rich Mesh Gradient */
    --bg-primary: #0f172a;
    --bg-mesh: radial-gradient(at 0% 0%, #033580 0, transparent 50%),
               radial-gradient(at 50% 0%, #155AC3 0, transparent 50%),
               radial-gradient(at 100% 0%, #022860 0, transparent 50%);
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-highlight: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    
    /* Typography */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    
    /* Accent Colors - 4human Apple Green */
    --apple-green: #7EBD7F; /* 4human Green hmn-dark-green-100 */
    --status-green: #7EBD7F; /* Changed to 4human green */
    --status-yellow: #f59e0b;
    --status-red: #ef4444;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

/* ============================================= */
/* Global Styles                                 */
/* ============================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* Rich Mesh Gradient Background */
    background: var(--bg-mesh);
    background-color: #000; /* Fallback */
    background-attachment: fixed;
    background-size: cover;
    
    /* Rubik Typography */
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    /*max-width: 1200px;*/
    max-width: 900px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* ============================================= */
/* Dashboard Header                              */
/* ============================================= */
.dashboard-header {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--glass-border);
    position: relative;
}

/* 4human Logo - positioned before title */
.dashboard-header::before {
    content: "";
    display: block;
    width: 151px;
    height: 48px;
    /*margin: 25px auto 18px auto;*/
    margin: 25px auto 18px 0px;
    background: url('https://4human.no/wp-content/uploads/2024/08/Logo_4human.svg') no-repeat center;
    background-size: contain;
}

.dashboard-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.dashboard-header .footer {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: var(--spacing-xs);
}

/* ============================================= */
/* Status Legend                                 */
/* ============================================= */
.status-legend {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
    font-size: 13px;
    color: var(--text-muted);
}

.status-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* ============================================= */
/* Monitor Groups                                */
/* ============================================= */
.monitor-group {
    margin-bottom: var(--spacing-xl);
}

.group-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: var(--spacing-xs) 0;
    transition: background-color 0.2s ease;
    width: 100%;
    border-radius: 18px;
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.group-header:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.group-header-content {
    display: flex;
    align-items: center;
    min-width: 200px;
    padding-right: var(--spacing-md);
    flex-shrink: 0;
}

.toggle-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--spacing-sm);
    font-size: 16px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: 10px;
}

.group-collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.group-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: var(--spacing-xs) 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ============================================= */
/* Monitor Rows                                  */
/* ============================================= */
.monitor-rows {
    /* Wrapper for individual monitor rows */
}

.monitor-row {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--glass-border);
    transition: background-color 0.2s ease;
}

.monitor-row:hover {
    background: var(--glass-bg);
    border-radius: 8px;
}

.monitor-row:last-child {
    border-bottom: none;
}

.monitor-name {
    width: 200px;
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    padding-right: var(--spacing-md);
    font-weight: 500;
    letter-spacing: -0.02em;
}

/* ============================================= */
/* Timeline & Day Blocks                         */
/* ============================================= */
.timeline {
    display: grid;
    grid-template-columns: repeat(90, 5px);
    gap: 2px;
    justify-content: flex-end;
    position: relative;
    overflow: hidden;
}

.combined-timeline {
    display: none;
    grid-template-columns: repeat(90, 5px);
    gap: 2px;
    /*justify-content: flex-end;*/
    position: relative;
    overflow: hidden;
}

.group-collapsed .combined-timeline {
    display: grid;
}

.day-block {
    width: 5px;
    height: 25px;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease;
    will-change: transform;
    transform: translateZ(0);
}

.day-block:hover {
    transform: scale(1.2);
    z-index: 10;
}

.timeline::-webkit-scrollbar {
    height: 4px;
}

.timeline::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 2px;
}

.timeline::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.combined-timeline {
    display: none;
    flex: 1;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    touch-action: pan-x;
}

.group-collapsed .combined-timeline {
    display: inline-flex;
    flex: 1;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    touch-action: pan-x;
}

.group-collapsed .combined-timeline {
    display: flex;
}

.combined-timeline::-webkit-scrollbar {
    height: 4px;
}

.combined-timeline::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 2px;
}

.day-block {
    flex: 0 0 5px;
    height: 25px;
    border-radius: 3px;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease;
    scroll-snap-align: start;
    will-change: transform;
    transform: translateZ(0);
}

.day-block:hover {
    transform: scale(1.2);
    z-index: 10;
}

/* ============================================= */
/* Tooltips                                      */
/* ============================================= */
.tooltip-container {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    min-width: 150px;
    text-align: center;
    line-height: 1.4;
    max-width: 300px;
    white-space: normal;
    word-wrap: break-word;
    font-family: 'Rubik', sans-serif;
}

.tooltip-container.visible {
    opacity: 1;
}

.tooltip-container::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--glass-border);
}

.tooltip-container.below::after {
    border-top-color: transparent;
    border-bottom-color: var(--glass-border);
    bottom: auto;
    top: -6px;
}

/* ============================================= */
/* Collapse/Expand Animation                     */
/* ============================================= */
.group-collapsed .monitor-rows {
    display: none;
}

/* ============================================= */
/* Page Footer                                   */
/* ============================================= */
.page-footer {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    opacity: 0.6;
}

/* ============================================= */
/* Responsive Design                             */
/* ============================================= */
@media (max-width: 768px) {
    .container {
        padding: var(--spacing-md);
    }
    
    .monitor-name {
        width: 100%;
        margin-bottom: var(--spacing-xs);
    }
    
    .timeline {
        grid-template-columns: repeat(90, 5px);
        gap: 2px;
    }
    
    .day-block {
        width: 5px;
        height: 25px;
    }
    
    .dashboard-header h1 {
        font-size: 24px;
    }
    
    .group-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .group-header-content {
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }
}

/* ============================================= */
/* Scrollbar Styling                             */
/* ============================================= */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}
