/* Schema Color Variables - Easy to modify */
:root {
    --schema-status-denied-color: #6b7280;    /* Dark gray for denied status */
    --schema-status-pending-color: #9ca3af;   /* Gray for non-accepted status (new, etc.) */
    --schema-status-sick-color: #374151;      /* Dark gray for sick status */
    --schema-default-bar-color: #22ab94;      /* Default teal for accepted status */
}

/* Base font styling to match dashboard and tider pages */
body {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Schema Section Styles */
.schema-section {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 24px;
    overflow: hidden;
}

/* Schema section on dashboard and tider pages should match card width (1400px max) */
.dashboard-container .schema-section,
.tider-container .schema-section {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.schema-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.schema-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.schema-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-round {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    background: #ffffff;
    color: #1f2937;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.btn-round:hover {
    background: #f3f4f6;
}

.schema-grid-wrap {
    padding: 0;
    overflow: visible;
}

.schema-grid {
    display: grid;
    grid-template-columns: 98px repeat(14, 1fr);
    grid-auto-rows: 48px;
    gap: 0;
    border: none;
    background: #ffffff;
    min-width: 1200px;
}

.schema-grid.weeks-1 { grid-template-columns: 98px repeat(7, 1fr) }
.schema-grid.weeks-2 { grid-template-columns: 98px repeat(14, 1fr) }
.schema-grid.weeks-3 { grid-template-columns: 98px repeat(21, 1fr) }
.schema-grid.weeks-4 { grid-template-columns: 98px repeat(28, 1fr) }
.schema-grid.weeks-5 { grid-template-columns: 98px repeat(35, 1fr) }
.schema-grid.weeks-6 { grid-template-columns: 98px repeat(42, 1fr) }

.hcell {
    background: #f1f5f9;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
}

.ucell {
    background: #fafafa;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    padding: 4px 6px;
    font-weight: 400;
}

.cell {
    position: relative;
    min-height: 25px;
    border-right: 1px dashed #e5e7eb;
    border-bottom: 1px solid #f1f5f4;
    background: #ffffff;
}

.cell:last-child {
    border-right: 0;
}

.stack {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.block {
    position: relative;
    border-radius: 0;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    box-shadow: none;
    flex: 1 1 0%;
}

/* Swedish helgdagar styling */
.helgdag-red {
    color: #dc2626 !important;
    font-weight: 600 !important;
}

.hcell.helgdag-red {
    color: #dc2626 !important;
    font-weight: 600 !important;
}

.cell.helgdag-red {
    color: #dc2626 !important;
    font-weight: 600 !important;
}

/* Force red color on all helgdag elements */
.helgdag-red,
.helgdag-red * {
    color: #dc2626 !important;
    font-weight: 600 !important;
}

/* More specific selectors for schema grid */
.hcell.helgdag-red div {
    color: #dc2626 !important;
    font-weight: 600 !important;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    /* Allow normal page scrolling on dashboard; standalone schema page manages its own layout */
    
    /* Ensure schema section is visible on mobile in dashboard */
    .schema-section {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin: 16px !important;
        width: calc(100% - 32px) !important;
        background: #ffffff !important;
        border-radius: 8px !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    }
    
    .schema-header {
        display: flex !important;
        padding: 12px 16px !important;
        border-bottom: 1px solid #e5e7eb !important;
        background: #f8fafc !important;
    }
    
    .schema-header h2 {
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #111827 !important;
        margin: 0 !important;
    }
    
    .schema-toolbar {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }
    
    .schema-grid-wrap {
        overflow: hidden !important;
        padding: 0 !important;
        height: calc(100vh - 200px) !important;
        max-height: 400px !important;
    }
    
    /* Show dynamic number of days on mobile (3-7) */
    .schema-grid {
        grid-template-columns: 60px repeat(3, 1fr) !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        overflow: hidden !important;
    }
    .schema-grid.weeks-1,
    .schema-grid.weeks-2,
    .schema-grid.weeks-3,
    .schema-grid.weeks-4,
    .schema-grid.weeks-5,
    .schema-grid.weeks-6 {
        grid-template-columns: 60px repeat(3, 1fr) !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        overflow: hidden !important;
    }
    
    /* Dynamic day count classes for mobile */
    .schema-grid.mobile-days-3 { grid-template-columns: 60px repeat(3, 1fr) !important; }
    .schema-grid.mobile-days-4 { grid-template-columns: 60px repeat(4, 1fr) !important; }
    .schema-grid.mobile-days-5 { grid-template-columns: 60px repeat(5, 1fr) !important; }
    .schema-grid.mobile-days-6 { grid-template-columns: 60px repeat(6, 1fr) !important; }
    .schema-grid.mobile-days-7 { grid-template-columns: 60px repeat(7, 1fr) !important; }
    
    /* Ensure schema grid is properly contained within dashboard on mobile */
    .dashboard-container .schema-grid {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        overflow: hidden !important;
    }
    
    .dashboard-container .schema-grid-wrap {
        overflow: hidden !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Make name column smaller on mobile */
    .ucell {
        padding: 2px 3px !important;
        font-size: 10px !important;
        line-height: 1.1 !important;
    }
    
    /* Show week count selector on mobile - positioned beside navigation buttons */
    #weekCountContainer {
        display: flex !important;
        align-items: center !important;
        gap: 2px !important;
        margin-left: 4px !important;
    }
    
    /* Ensure dashboard schema section is properly positioned on mobile */
    .dashboard-container .schema-section {
        margin: 16px !important;
        width: calc(100% - 32px) !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Override any conflicting styles from user.css */
    .dashboard-container {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }
    
    .dashboard-container .schema-section {
        margin: 16px !important;
        width: calc(100% - 32px) !important;
        max-width: none !important;
    }
    
    #weekCountContainer span {
        font-size: 9px !important;
        white-space: nowrap !important;
    }
    
    #weekCount {
        font-size: 9px !important;
        padding: 2px 3px !important;
        width: 30px !important;
        min-width: 30px !important;
    }
    
    /* Ensure exit button is visible on mobile - match kalender page exactly */
    #exitToDashboard {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
        z-index: 1001 !important;
        position: relative !important;
    }
    
    /* Ensure the exit button container is visible on mobile */
    div[style*="position:fixed"][style*="top:14px"][style*="right:20px"] {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1001 !important;
    }
    
    /* Make day headers smaller on mobile */
    .hcell {
        padding: 4px 2px !important;
        font-size: 10px !important;
        line-height: 1.1 !important;
        text-align: center !important;
    }
    
    /* Make event blocks smaller text on mobile - default for 3 days */
    .schema-grid.mobile-days-3 .block,
    .block {
        font-size: 9px !important;
        padding: 0 2px !important;
        line-height: 1.1 !important;
    }
    
    /* Smaller text in bars when displaying 4-7 days - must come after default */
    .schema-grid.mobile-days-4 .block,
    .schema-grid.mobile-days-5 .block,
    .schema-grid.mobile-days-6 .block,
    .schema-grid.mobile-days-7 .block {
        font-size: 7px !important;
        padding: 0 1px !important;
        line-height: 1.0 !important;
    }
    
    /* Adjust toolbar for mobile */
    .schema-toolbar {
        gap: 4px !important;
    }
    
    .btn-round {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }
}

/* Additional mobile breakpoints for better responsiveness */
@media (max-width: 480px) {
    .schema-grid {
        grid-template-columns: 60px repeat(3, 1fr) !important;
    }
    .schema-grid.weeks-1,
    .schema-grid.weeks-2,
    .schema-grid.weeks-3,
    .schema-grid.weeks-4,
    .schema-grid.weeks-5,
    .schema-grid.weeks-6 {
        grid-template-columns: 60px repeat(3, 1fr) !important;
    }
    /* Ensure equal-width columns for dynamic mobile day counts on very small screens */
    .schema-grid.mobile-days-3 { grid-template-columns: 60px repeat(3, 1fr) !important; }
    .schema-grid.mobile-days-4 { grid-template-columns: 60px repeat(4, 1fr) !important; }
    .schema-grid.mobile-days-5 { grid-template-columns: 60px repeat(5, 1fr) !important; }
    .schema-grid.mobile-days-6 { grid-template-columns: 60px repeat(6, 1fr) !important; }
    .schema-grid.mobile-days-7 { grid-template-columns: 60px repeat(7, 1fr) !important; }
    
    .ucell {
        padding: 1px 2px !important;
        font-size: 9px !important;
    }
    
    .hcell {
        padding: 3px 1px !important;
        font-size: 9px !important;
    }
    
    /* Default for 3 days on very small screens */
    .schema-grid.mobile-days-3 .block,
    .block {
        font-size: 8px !important;
        padding: 0 1px !important;
    }
    
    /* Even smaller text in bars when displaying 4-7 days on very small screens */
    .schema-grid.mobile-days-4 .block,
    .schema-grid.mobile-days-5 .block,
    .schema-grid.mobile-days-6 .block,
    .schema-grid.mobile-days-7 .block {
        font-size: 6px !important;
        padding: 0 1px !important;
        line-height: 1.0 !important;
    }
    
    .btn-round {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
    }
    
    #exitToDashboard {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
    }
}
