/* calendar.css - Kalenderstilar */

/* ================================
   Kontroller och navigation
   ================================ */

   .calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calendar-nav h2 {
    margin: 0;
    min-width: 180px;
    text-align: center;
    font-size: 1.2rem;
}

/* ================================
   Månadsvy
   ================================ */

.calendar-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: var(--color-primary);
    color: #fff;
}

.calendar-weekday {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
    min-width: 0;
}

.calendar-weekday.weekend {
    background: rgba(0,0,0,0.1);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-grid.week-view {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

/* ================================
   Dagceller
   ================================ */

.calendar-day {
    min-height: 100px;
    min-width: 0;
    border: 1px solid #eee;
    padding: 0.25rem;
    position: relative;
    background: #fff;
    overflow: hidden;
}

.calendar-day.other-month {
    background: #f9f9f9;
}

.calendar-day.other-month .day-number {
    color: #bbb;
}

.calendar-day.today {
    background: #e8f4fc;
}

.calendar-day.weekend {
    background: #fafafa;
}

.calendar-day.today.weekend {
    background: #e0f0f8;
}

.day-number {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    padding: 0.25rem;
}

.today .day-number {
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================================
   Events i dagceller
   ================================ */

.day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
}

.day-event {
    font-size: 0.75rem;
    padding: 2px 4px;
    background: #3498db;
    color: #fff;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s;
}

.day-event:hover {
    opacity: 0.85;
}

.day-event.past {
    background: #95a5a6;
}

.day-event-more {
    font-size: 0.7rem;
    color: #666;
    padding: 2px 4px;
    cursor: pointer;
}

.day-event-more:hover {
    color: #333;
}

/* ================================
   Veckovy
   ================================ */

.week-view-container {
    display: none;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.week-view-container.active {
    display: block;
}

.week-header {
    display: grid;
    grid-template-columns: 50px repeat(7, minmax(0, 1fr));
    background: var(--color-primary);
    color: #fff;
}

.week-header-cell {
    padding: 0.75rem 0.25rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 1px solid rgba(255,255,255,0.2);
    min-width: 0;
}

.week-header-cell:first-child {
    border-left: none;
}

.week-header-cell.today {
    background: rgba(255,255,255,0.15);
}

/* ================================
   Veckovy - tidsgrid
   ================================ */

.week-body {
    display: block;
    position: relative;
}

.week-row {
    display: grid;
    grid-template-columns: 50px repeat(7, minmax(0, 1fr));
    height: 24px;
}

.week-row:first-child .week-day-cell {
    border-top: none;
}

.week-time-cell {
    font-size: 0.75rem;
    color: #666;
    text-align: right;
    padding-right: 0.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.week-day-cell {
    border-left: 1px solid #eee;
    border-bottom: 1px solid #eee;
    position: relative;
    min-width: 0;
}

.week-day-cell.weekend {
    background: #fafafa;
}

.week-day-cell.today {
    background: #f0f7fc;
}

.week-day-column {
    position: relative;
}

/* ================================
   Veckovy - events
   ================================ */

.week-event {
    position: absolute;
    left: 2px;
    right: 2px;
    background: #3498db;
    color: #fff;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 0.75rem;
    cursor: pointer;
    overflow: hidden;
    z-index: 1;
    min-height: 18px;
}

.week-event:hover {
    opacity: 0.9;
    z-index: 2;
}

.week-event.past {
    background: #95a5a6;
}

.week-event-time {
    font-weight: 600;
}

.week-event-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================================
   Veckovy - heldagsevent
   ================================ */

.week-allday-row {
    display: grid;
    grid-template-columns: 50px repeat(7, minmax(0, 1fr));
    border-bottom: 2px solid #ddd;
    min-height: 30px;
    background: #fff;
}

.week-allday-label {
    font-size: 0.7rem;
    color: #666;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
}

.week-allday-cell {
    border-left: 1px solid #eee;
    padding: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-items: center;
    min-width: 0;
}

.week-allday-event {
    font-size: 0.7rem;
    padding: 1px 4px;
    background: #3498db;
    color: #fff;
    border-radius: 3px;
    cursor: pointer;
}

/* ================================
   Event-modal (kalenderspecifik)
   ================================ */

.event-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.event-modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    position: relative;
}

.event-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.event-modal-close:hover {
    color: #333;
}

.event-modal-content h3 {
    margin: 0 0 1rem;
    color: var(--color-primary);
    padding-right: 2rem;
}

.modal-detail {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.modal-detail-icon {
    width: 20px;
    text-align: center;
}

.modal-description {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    font-size: 0.95rem;
    color: #555;
}

/* ================================
   Responsiv
   ================================ */

@media (max-width: 768px) {
    .calendar-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .calendar-nav {
        justify-content: center;
    }
    
    .view-toggle {
        justify-content: center;
    }
    
    .calendar-day {
        min-height: 50px;
        padding: 2px;
    }
    
    .day-number {
        font-size: 0.8rem;
    }
    
    .calendar-weekday {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
    
    /* Prickar istället för text på mobil */
    .day-events {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 3px;
    }
    
    .day-event {
        width: 8px;
        height: 8px;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
        min-width: 8px;
    }
    
    .day-event-more {
        font-size: 0.6rem;
        padding: 0;
    }
    
    .calendar-day.has-events {
        cursor: pointer;
    }
    
    /* Veckovy mobil */
    .week-header-cell {
        font-size: 0.7rem;
        padding: 0.25rem;
    }
    
    .week-event {
        font-size: 0.65rem;
    }
    
    .week-time-cell {
        font-size: 0.65rem;
        padding-right: 0.25rem;
    }
}