/*  Copyright (c) 2026 Kasper Sjöström. All rights reserved. License: AGPL-3.0 license. www.kswebb.se - Thanks to Gemini for helping me out with this project. */
/* =========================================
   GrundlĂ€ggande layout & reset
   ========================================= */
* { 
    box-sizing: border-box; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
}
body { 
    margin: 0; 
    padding: 0; 
    background-color: #f4f4f9; 
    color: #333; 
    
    /* Flexbox fĂ¶r att hantera hĂ¶jden dynamiskt */
    display: flex;
    flex-direction: column;
    height: 100vh; 
}

/* =========================================
   LĂ€nkar
   ========================================= */
a {
    color: #2980b9;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}
a:hover {
    color: #1c5980;
    text-decoration: underline;
}

/* =========================================
   Header & BehĂ„llare
   ========================================= */
header { 
    background-color: #2c3e50; 
    color: white; 
    padding: 20px; 
    text-align: center; 
    flex-shrink: 0; 
}
header h1 { margin: 0 0 10px 0; }
header p { margin: 0; opacity: 0.8; line-height: 1.4; }

.main-container { 
    display: flex; 
    flex: 1; 
    padding: 20px; 
    gap: 20px; 
    overflow: hidden; 
}

/* =========================================
   SidofĂ€lt (Planeringsverktyg)
   ========================================= */
.sidebar { 
    width: 250px; 
    background: white; 
    padding: 15px; 
    border-radius: 8px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
    overflow-y: auto; 
}
.sidebar a {
    display: block;
    margin-top: 20px;
}
.activity-card { 
    padding: 10px; 
    margin-bottom: 10px; 
    color: #000000; 
    border: 1px solid #333333; 
    border-radius: 4px; 
    cursor: grab; 
    text-align: center; 
    font-weight: bold; 
}
.activity-card:active { 
    cursor: grabbing; 
}

/* =========================================
   Schemadelen, Flikar & Filtrering
   ========================================= */
.schedule-area { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    max-width: 1200px; 
    margin: 0 auto; 
    width: 100%; 
}

.filter-section {
    background: white; 
    padding: 15px; 
    border-radius: 8px; 
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    gap: 10px; 
    flex-wrap: wrap;
}
.filter-section select { 
    padding: 8px 15px; 
    font-size: 16px; 
    border-radius: 4px; 
    border: 1px solid #bdc3c7; 
    background-color: #ecf0f1; 
    cursor: pointer; 
}

.tabs-container { 
    display: flex; 
    gap: 5px; 
    margin-bottom: 10px; 
}
.tab-btn { 
    padding: 10px 20px; 
    background-color: #bdc3c7; 
    border: none; 
    border-radius: 4px 4px 0 0; 
    cursor: pointer; 
    font-size: 16px; 
    font-weight: bold; 
    color: #2c3e50; 
    transition: background-color 0.2s; 
}
.tab-btn:hover { background-color: #95a5a6; }
.tab-btn.active { background-color: white; color: #2c3e50; border-top: 3px solid #2c3e50; }

/* =========================================
   SjĂ€lva Kalendern (Grid)
   ========================================= */
.calendar-wrapper { 
    flex: 1; 
    background: white; 
    border-radius: 0 8px 8px 8px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
    overflow-y: auto; 
    position: relative; 
}
.calendar-header { 
    display: grid; 
    background-color: #ecf0f1; 
    border-bottom: 2px solid #bdc3c7; 
    position: sticky; 
    top: 0; 
    z-index: 10; 
}
.calendar-grid { 
    display: grid; 
    grid-template-rows: repeat(60, 40px); 
    position: relative; 
}
.header-cell { 
    padding: 15px; 
    text-align: center; 
    font-weight: bold; 
    border-right: 1px solid #bdc3c7; 
}
.time-col { 
    border-right: 2px solid #bdc3c7; 
    background-color: #ecf0f1; 
}

/* Tydligare stĂ¶dlinjer */
.grid-cell { 
    border-bottom: 1px dotted #bdc3c7; 
    border-right: 1px solid #ecf0f1; 
}
.grid-cell.hour-border {
    border-bottom: 2px solid #95a5a6; 
}
.time-label { 
    text-align: right; 
    padding-right: 10px; 
    font-size: 0.85em; 
    color: #7f8c8d; 
    border-right: 2px solid #bdc3c7; 
    border-bottom: 1px dotted #bdc3c7; 
    display: flex; 
    align-items: center; 
    justify-content: flex-end; 
}
.time-label.hour-border { 
    border-bottom: 2px solid #95a5a6; 
}

/* =========================================
   Schemalagda Pass (Drop-objekt)
   ========================================= */
.scheduled-session {
    margin: 1px; 
    border-radius: 4px; 
    padding: 5px; 
    color: #000000; 
    border: 1px solid #333333; 
    font-size: 0.9em;
    overflow: hidden; 
    cursor: grab; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.2); 
    transition: transform 0.1s; 
    z-index: 5;
}
.scheduled-session:active { cursor: grabbing; }
.scheduled-session:hover { transform: scale(1.02); z-index: 6; }

/* =========================================
   Modal & Knappar
   ========================================= */
dialog { border: none; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); padding: 0; width: 400px; max-width: 90%; }
dialog::backdrop { background: rgba(0,0,0,0.5); }
.modal-content { padding: 20px; }
.modal-content h2 { margin-top: 0; }

.modal-actions { display: flex; justify-content: space-between; margin-top: 20px; }
.modal-content button { border: none; padding: 10px 15px; border-radius: 4px; cursor: pointer; font-weight: bold; margin-left: 5px; }
.close-btn { background: #bdc3c7; color: #2c3e50; }
.delete-btn { background: #e74c3c; color: white; margin-left: 0; }
.delete-btn:hover { background: #c0392b; }
.save-btn { background: #27ae60; color: white; }
.save-btn:hover { background: #2ecc71; }

.time-edit-group {
    background: #ecf0f1;
    padding: 10px;
    border-radius: 4px;
    display: flex;
    gap: 15px;
    margin: 15px 0;
}
.time-edit-group label {
    display: flex;
    flex-direction: column;
    font-size: 14px;
}
.time-edit-group input {
    margin-top: 5px;
    padding: 8px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
}

/* =========================================
   Sidfot (Versionsnummer)
   ========================================= */
footer {
    background-color: #2c3e50;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 15px;
    font-size: 0.85em;
    width: 100%;
    flex-shrink: 0; 
}
footer p {
    margin: 0;
}

/* =========================================
   Mobilanpassning (Krymper ytor pĂ„ smĂ„ skĂ€rmar)
   ========================================= */
@media (max-width: 768px) {
    header {
        padding: 10px;
    }
    header h1 {
        font-size: 1.2rem;
        margin-bottom: 5px;
    }
    header p {
        font-size: 0.85rem;
    }
    .main-container {
        padding: 10px;
        gap: 10px;
        flex-direction: column; /* LĂ€gger sidofĂ€ltet ovanpĂ„ kalendern i adminvyn */
    }
    .sidebar {
        width: 100%;
        max-height: 200px;
        padding: 10px;
    }
    .filter-section {
        padding: 10px;
    }
    .filter-section select {
        padding: 6px 10px;
        font-size: 14px;
        width: 100%;
    }
    .tab-btn {
        padding: 8px 12px;
        font-size: 14px;
        flex: 1; /* FĂ„r flikarna att fylla bredden jĂ€mnt */
    }
    .header-cell {
        padding: 10px 5px;
        font-size: 0.85em;
    }
    footer {
        padding: 10px;
        font-size: 0.75em;
    }
}
