/* Override profile page settings */
html, body {
    height: 100vh !important;
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    margin: 0;
    padding: 0;
}

body {
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    background: #f5f5f5;
}

/* Container som matchar chattrutans stil */
.calendar-container {
    position: fixed;
    top: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: calc(100% - 200px);
    max-width: 1200px;
    height: calc(100vh - 190px);
    display: flex !important;
    flex-direction: column;
    z-index: 10;
}

/* VIKTIG: Container för EN månad (ingen scroll) */
.calendar-scroll-container {
    flex: 1 1 auto;
    overflow: hidden;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Navigationsknappar för månader */
.month-nav-arrow {
    background: transparent;
    color: #4a4a4a;
    border: none;
    border-radius: 10px;
    width: 45px;
    height: 45px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.month-nav-arrow:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

.month-nav-arrow:active {
    background: #e8e8e8;
    transform: scale(0.95);
}

/* Kompakt månadskort */
.calendar-month-card {
    margin-bottom: 40px;
    padding-top: 0;
}

.calendar-month-card:last-child {
    margin-bottom: 20px;
}

/* Månad/år header - DESKTOP (högerställd) */
.calendar-month-header {
    text-align: right;
    margin-bottom: 15px;
    padding-right: 10px;
}

.calendar-month-header h2 {
    color: #999;
    font-size: 16px;
    font-weight: 600;
}

/* Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    max-width: 100%;
    width: 100%;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    color: #999;
    padding: 8px;
    font-size: 13px;
}

/* Datum-celler */
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #e8e8e8;
    position: relative;
}

.calendar-day:active {
    transform: scale(0.95);
    background: #d0d0d0;
}

.calendar-day.empty {
    background: transparent;
    cursor: default;
}

.calendar-day.has-chat::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 5px;
    height: 5px;
    background: #4CAF50;
    border-radius: 50%;
}

.calendar-day.today {
    background: #4a4a4a;
}

.calendar-day.today .day-number {
    color: white;
    font-weight: bold;
}

.calendar-day.today.has-chat::after {
    background: #4CAF50;
}

.calendar-day.future {
    opacity: 0.3;
    cursor: not-allowed;
    background: #f0f0f0;
}

.calendar-day.future:active {
    transform: none;
    background: #f0f0f0;
}

.day-number {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.calendar-day.future .day-number {
    color: #ccc;
}

/* Mobile responsive - SOM I BILDEN */
@media (max-width: 768px) {
    .calendar-container {
        top: 90px;
        left: 0;
        right: 0;
        transform: none;
        width: calc(100% - 40px);
        margin: 0 20px 20px 20px;
        height: calc(100vh - 230px);
        padding: 20px 20px 10px 20px;
        border-radius: 20px;
        display: flex !important;
        flex-direction: column;
    }

    .calendar-scroll-container {
        padding: 0;
        flex: 1 1 auto;
        overflow: hidden;
        display: flex;
        align-items: flex-start;
        justify-content: center;
    }

    .calendar-month-card {
        margin-bottom: 0;
        width: 100%;
        padding-top: 10px;
    }

    /* MÅNAD CENTRERAD MED PILAR PÅ SIDORNA - NÄSTAN HÖGST UPP */
    .calendar-month-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 25px;
        padding: 0;
        text-align: center;
        gap: 10px;
    }

    .calendar-month-header h2 {
        flex: 1;
        text-align: center;
        font-size: 22px;
        font-weight: 700;
        color: #333;
        margin: 0;
    }

    /* PILKNAPPAR - TRANSPARENTA MED TOUCH-FEEDBACK */
    .month-nav-arrow {
        background: transparent;
        color: #4a4a4a;
        width: 45px;
        height: 45px;
        font-size: 22px;
        border-radius: 12px;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent; /* Ta bort iOS blå highlight */
        transition: background 0.2s ease;
    }

    /* Active state - ljusgrå efter klick */
    .month-nav-arrow.active {
        background: #f0f0f0;
    }

    /* Ta bort hover på mobil - fungerar dåligt med touch */
    .month-nav-arrow:hover {
        background: transparent;
    }

    /* Active blir ljusgrå */
    .month-nav-arrow.active:hover {
        background: #f0f0f0;
    }

    /* Använd active för touch-feedback istället */
    .month-nav-arrow:active {
        background: #e0e0e0;
        transition: none; /* Instant feedback */
    }

    /* GRID MED MINDRE GAP SÅ ALLA 7 FÅR PLATS */
    .calendar-grid {
        gap: 6px;
    }

    .calendar-day-header {
        font-size: 12px;
        padding: 8px 2px;
        color: #666;
    }

    /* MINDRE KNAPPAR FÖR DAGARNA SÅ 7 FÅR PLATS */
    .calendar-day {
        padding: 10px 8px;
        border-radius: 12px;
        min-height: 48px;
    }

    .day-number {
        font-size: 17px;
        font-weight: 500;
    }

    .calendar-day.today .day-number {
        font-size: 17px;
        font-weight: bold;
    }

    .calendar-day.has-chat::after {
        width: 5px;
        height: 5px;
        bottom: 5px;
    }
}

@media (max-width: 480px) {
    .calendar-container {
        width: calc(100% - 30px);
        margin: 0 15px 20px 15px;
        padding: 20px 15px 10px 15px;
        height: calc(100vh - 230px);
        border-radius: 20px;
    }

    .calendar-month-header {
        gap: 8px;
    }

    .calendar-month-header h2 {
        font-size: 20px;
    }

    .month-nav-arrow {
        width: 40px;
        height: 40px;
        font-size: 20px;
        -webkit-tap-highlight-color: transparent;
    }

    .month-nav-arrow:hover {
        background: transparent;
    }

    .month-nav-arrow:active {
        background: #e8e8e8;
    }

    .calendar-grid {
        gap: 5px;
    }

    .calendar-day-header {
        font-size: 11px;
        padding: 6px 1px;
    }

    .calendar-day {
        padding: 8px 5px;
        min-height: 42px;
    }

    .day-number {
        font-size: 15px;
    }

    .calendar-day.has-chat::after {
        width: 4px;
        height: 4px;
    }
}