/* ============================================
   assets/css/calendar-style.css
   KALENDER - LYS GRØNN BAKGRUNN
   ============================================ */

/* ============================================
   1. HOVEDCONTAINER - LYS GRØNN BAKGRUNN
   ============================================ */
.calendar-container {
    background: #e8f5e9;
    border-radius: var(--border-radius, 12px);
    padding: 16px;
    box-shadow: var(--box-shadow, 0 2px 8px rgba(0,0,0,0.08));
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

/* ============================================
   2. HEADER
   ============================================ */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-nav-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    border: 1px solid #a5d6a7;
    color: #2e7d32;
    transition: all 0.2s ease;
    cursor: pointer;
    touch-action: manipulation;
}

.calendar-nav-btn:hover {
    background: #ffffff;
    border-color: #66bb6a;
    transform: scale(1.05);
}

.calendar-nav-btn:active {
    transform: scale(0.95);
}

.calendar-title {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
    min-width: 130px;
    text-align: center;
    color: #1b5e20;
}

.calendar-today-btn {
    font-size: 0.8rem;
    padding: 4px 12px;
    background: #ffffff;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
    transition: all 0.2s ease;
    cursor: pointer;
    touch-action: manipulation;
}

.calendar-today-btn:hover {
    background: #66bb6a;
    border-color: #66bb6a;
    color: #ffffff;
    transform: translateY(-1px);
}

.calendar-today-btn:active {
    transform: scale(0.95);
}

/* ============================================
   3. GRID
   ============================================ */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.7rem;
    color: #2e7d32;
    padding: 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   4. DAGER - HVITE KORT PÅ GRØNN BAKGRUNN
   ============================================ */
.calendar-day {
    display: flex;
    flex-direction: column;
    min-height: 60px;
    background: #ffffff;
    border-radius: 6px;
    padding: 4px 5px;
    text-decoration: none !important;
    color: #1b263b !important;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.calendar-day:active {
    transform: scale(0.97);
}

.calendar-day:hover {
    transform: scale(1.03);
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    border: 2px solid #66bb6a;
}

.calendar-day.empty {
    background: transparent;
    box-shadow: none;
    cursor: default;
    min-height: 0;
}

.calendar-day.empty:hover {
    transform: none;
    box-shadow: none;
    border: none;
}

/* ============================================
   5. I DAG
   ============================================ */
.calendar-day.today {
    border: 2px solid #2e7d32;
    background: #e8f5e9;
}

.day-number.today-number {
    background: #2e7d32;
    color: #ffffff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

/* ============================================
   6. VALGT DAG
   ============================================ */
.calendar-day.selected {
    border: 2px solid #2e7d32;
    background: #c8e6c9;
    transform: scale(1.02);
}

/* ============================================
   7. FARGEKODER - VENSTRE KANT
   ============================================ */
.calendar-day.has-red {
    border-left: 4px solid #ef476f;
}
.calendar-day.has-yellow {
    border-left: 4px solid #ffd166;
}
.calendar-day.has-blue {
    border-left: 4px solid #118ab2;
}
.calendar-day.has-gray {
    border-left: 4px solid #adb5bd;
}

/* Både i dag og har avtale - bruk avtale-farge */
.calendar-day.today.has-red {
    border-color: #ef476f;
}
.calendar-day.today.has-yellow {
    border-color: #ffd166;
}
.calendar-day.today.has-blue {
    border-color: #118ab2;
}
.calendar-day.today.has-gray {
    border-color: #adb5bd;
}

/* ============================================
   8. DAGNUMMER
   ============================================ */
.day-number {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 2px;
    line-height: 1.4;
    color: #1b5e20;
}

/* ============================================
   9. AVTALER I DAG
   ============================================ */
.day-appointments {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
}

.day-appointment {
    font-size: 0.6rem;
    padding: 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 3px;
    line-height: 1.3;
}

.appointment-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Fargekoder for prikker */
.appointment-red .appointment-dot { background: #ef476f; }
.appointment-yellow .appointment-dot { background: #ffd166; }
.appointment-blue .appointment-dot { background: #118ab2; }
.appointment-gray .appointment-dot { background: #adb5bd; }

/* Farger for selve avtale-teksten i kalenderen */
.appointment-red .appointment-title-small { color: #ef476f; }
.appointment-yellow .appointment-title-small { color: #b8860b; }
.appointment-blue .appointment-title-small { color: #118ab2; }
.appointment-gray .appointment-title-small { color: #6c757d; }

.day-appointment.more {
    color: #6c757d;
    font-style: italic;
    font-size: 0.55rem;
}

/* ============================================
   10. DAGDETALJER
   ============================================ */
.day-detail {
    border-top: 2px solid #a5d6a7;
    padding-top: 16px;
    margin-top: 16px;
}

.day-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.day-detail-header h5 {
    margin: 0;
    font-size: 1rem;
    color: #1b5e20;
}

.day-appointments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ============================================
   11. LOADING STATE
   ============================================ */
.calendar-loading {
    grid-column: 1 / 8;
    text-align: center;
    padding: 40px 0;
}

/* ============================================
   12. RESPONSIV - MOBIL
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
    .calendar-container {
        padding: 10px;
    }
    
    .calendar-day {
        min-height: 50px;
        padding: 3px 4px;
    }
    
    .calendar-day-header {
        font-size: 0.6rem;
        padding: 2px 0;
    }
    
    .day-number {
        font-size: 0.75rem;
        margin-bottom: 1px;
    }
    
    .day-number.today-number {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }
    
    .day-appointment {
        font-size: 0.5rem;
        padding: 1px 3px;
    }
    
    .day-appointment .appointment-title-small {
        display: none;
    }
    
    .day-appointment:first-child .appointment-title-small {
        display: inline;
        font-size: 0.5rem;
    }
    
    .day-appointment.more {
        font-size: 0.5rem;
    }
    
    .calendar-day.has-red,
    .calendar-day.has-yellow,
    .calendar-day.has-blue,
    .calendar-day.has-gray {
        border-left-width: 3px;
    }
    
    .calendar-title {
        font-size: 0.85rem;
        min-width: 100px;
    }
    
    .calendar-nav-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
}

/* Mobil */
@media (max-width: 480px) {
    .calendar-container {
        padding: 6px;
    }
    
    .calendar-grid {
        gap: 2px;
    }
    
    .calendar-day {
        min-height: 40px;
        padding: 2px 3px;
        border-radius: 4px;
    }
    
    .day-number {
        font-size: 0.65rem;
    }
    
    .day-number.today-number {
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
    }
    
    .calendar-day-header {
        font-size: 0.5rem;
        padding: 1px 0;
    }
    
    /* Skjul alle avtaler unntatt den første */
    .day-appointment {
        display: none !important;
    }
    
    .day-appointment:first-child {
        display: flex !important;
        font-size: 0.45rem;
        padding: 0 2px;
    }
    
    .day-appointment:first-child .appointment-title-small {
        display: none;
    }
    
    .calendar-day.has-red,
    .calendar-day.has-yellow,
    .calendar-day.has-blue,
    .calendar-day.has-gray {
        border-left-width: 2px;
    }
    
    .calendar-title {
        font-size: 0.75rem;
        min-width: 80px;
    }
    
    .calendar-nav-btn {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }
    
    .calendar-today-btn {
        font-size: 0.65rem;
        padding: 2px 8px;
    }
    
    .day-detail-header h5 {
        font-size: 0.85rem;
    }
}

/* Liten mobil */
@media (max-width: 380px) {
    .calendar-day {
        min-height: 35px;
        padding: 1px 2px;
    }
    
    .day-number {
        font-size: 0.55rem;
    }
    
    .calendar-day-header {
        font-size: 0.45rem;
    }
}

/* ============================================
   13. ANIMATIONER
   ============================================ */

.calendar-day {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calendar-day:hover {
    transition: all 0.15s ease;
}

/* ============================================
   14. SCROLLBAR
   ============================================ */

.calendar-grid::-webkit-scrollbar {
    width: 3px;
}

.calendar-grid::-webkit-scrollbar-thumb {
    background: #66bb6a;
    border-radius: 10px;
}

.calendar-grid::-webkit-scrollbar-track {
    background: #e8f5e9;
}

/* ============================================
   15. DARK MODE
   ============================================ */

@media (prefers-color-scheme: dark) {
    .calendar-container {
        background: #1b3a1b;
    }
    
    .calendar-day {
        background: #2a4a2a;
        color: #e8f5e9 !important;
    }
    
    .calendar-day:hover {
        border-color: #66bb6a;
    }
    
    .calendar-day.today {
        background: #1b5e20;
    }
    
    .calendar-day.selected {
        background: #2e7d32;
    }
    
    .calendar-title {
        color: #a5d6a7;
    }
    
    .calendar-day-header {
        color: #a5d6a7;
    }
    
    .day-number {
        color: #c8e6c9;
    }
    
    .day-number.today-number {
        background: #66bb6a;
        color: #1b3a1b;
    }
    
    .calendar-nav-btn {
        background: rgba(255,255,255,0.1);
        border-color: #2e7d32;
        color: #a5d6a7;
    }
    
    .calendar-nav-btn:hover {
        background: rgba(255,255,255,0.2);
        border-color: #66bb6a;
    }
    
    .calendar-today-btn {
        background: #2e7d32;
        border-color: #2e7d32;
        color: #e8f5e9;
    }
    
    .calendar-today-btn:hover {
        background: #66bb6a;
        border-color: #66bb6a;
        color: #1b3a1b;
    }
    
    .day-detail {
        border-top-color: #2e7d32;
    }
    
    .day-detail-header h5 {
        color: #a5d6a7;
    }
    
    .calendar-grid::-webkit-scrollbar-track {
        background: #1b3a1b;
    }
}

/* ============================================
   16. SKRIVER UT (PRINT)
   ============================================ */

@media print {
    .calendar-container {
        background: #e8f5e9 !important;
        box-shadow: none !important;
    }
    
    .calendar-day {
        background: #ffffff !important;
        border: 1px solid #a5d6a7 !important;
        box-shadow: none !important;
    }
    
    .calendar-day.today {
        background: #e8f5e9 !important;
    }
    
    .calendar-nav-btn,
    .calendar-today-btn {
        display: none !important;
    }
}