/* Calendar Styles - Professional Overhaul */
.calendar-wrapper {
    background: var(--bg-darker);
    padding: 0;
    border-radius: 12px;
    border: 1px solid #333;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #252525;
    border-bottom: 1px solid #333;
}

.calendar-header h3 {
    margin: 0;
    color: var(--text-light);
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.calendar-controls {
    display: flex;
    gap: 10px;
}

.btn-nav {
    background: transparent;
    border: 1px solid #444;
    color: var(--text-light);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-nav:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #333;
    /* Border color */
    gap: 1px;
}

.calendar-day-header {
    background: #1e1e1e;
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-day {
    background: var(--bg-darker);
    min-height: 120px;
    padding: 10px;
    position: relative;
    transition: background 0.2s;
}

.calendar-day:hover {
    background: #1e1e1e;
}

.calendar-day-number {
    position: absolute;
    top: 10px;
    right: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.day-today .calendar-day-number {
    background: var(--primary-color);
    color: white;
}

.day-other-month {
    background: #151515;
    opacity: 0.6;
}

.calendar-event {
    margin-top: 5px;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    font-weight: 500;
    position: relative;
    padding-left: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
}

.calendar-event:first-of-type {
    margin-top: 25px;
    /* Clear the number */
}

.calendar-event:hover {
    transform: translateY(-1px);
    z-index: 2;
}

.event-meeting {
    background: rgba(47, 158, 68, 0.2);
    color: #4ecf6e;
    border-left: 3px solid var(--primary-color);
}

.event-match {
    background: rgba(240, 140, 0, 0.2);
    color: #ffb042;
    border-left: 3px solid var(--accent-color);
}

.event-Maintenance {
    background: rgba(34, 139, 230, 0.2);
    color: #4dabf7;
    border-left: 3px solid #228be6;
}

.calendar-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: #252525;
    border-top: 1px solid #333;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
}

/* Mobile Responsive Adjustments - Compact Grid View */
@media (max-width: 768px) {
    .calendar-wrapper {
        border-radius: 8px;
    }

    .calendar-grid {
        min-width: 0;
        /* Allow grid to shrink to screen width */
        gap: 1px;
    }

    .calendar-header {
        padding: 15px 10px;
        flex-direction: row;
        /* Keep headers side-by-side */
    }

    .calendar-header h3 {
        font-size: 1.1rem;
    }

    .btn-nav {
        width: 30px;
        height: 30px;
    }

    .calendar-day-header {
        font-size: 0.7rem;
        padding: 5px 0;
        /* Truncate headers to 1 letter if needed or assume 3 letters fit */
    }

    .calendar-day {
        min-height: 60px;
        /* Much shorter height */
        padding: 4px;
    }

    .calendar-day-number {
        font-size: 0.8rem;
        width: 20px;
        height: 20px;
        right: 4px;
        top: 4px;
    }

    /* Events as Dots */
    .calendar-event {
        height: 8px;
        width: 8px;
        border-radius: 50%;
        padding: 0;
        margin: 2px;
        display: inline-block;
        vertical-align: top;
        border: none;
        text-indent: -9999px;
        /* Hide text */
        overflow: hidden;

        .calendar-event:hover {
            transform: scale(1.5);
        }
    }

    /* Modal Styles */
    .modal {
        display: none;
        position: fixed;
        z-index: 2000;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        overflow: auto;
        background-color: rgba(0, 0, 0, 0.8);
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(5px);
    }

    .modal.active {
        display: flex;
    }

    .modal-content {
        background-color: #252525;
        margin: auto;
        padding: 25px;
        border: 1px solid #444;
        width: 90%;
        max-width: 500px;
        border-radius: 12px;
        box-shadow: 0 5px 30px rgba(0, 0, 0, 0.5);
        position: relative;
        color: var(--text-light);
    }

    .close-modal {
        color: #aaa;
        float: right;
        font-size: 28px;
        font-weight: bold;
        cursor: pointer;
        line-height: 1;
    }

    .close-modal:hover,
    .close-modal:focus {
        color: var(--primary-color);
        text-decoration: none;
    }

    #modalDate {
        margin-top: 0;
        border-bottom: 2px solid var(--primary-color);
        padding-bottom: 10px;
        margin-bottom: 20px;
        color: var(--primary-color);
    }

    .modal-event-item {
        margin-bottom: 15px;
        padding: 10px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.05);
    }

    .modal-event-title {
        font-weight: bold;
        font-size: 1.1rem;
        display: block;
        margin-bottom: 5px;
    }

    .modal-event-time {
        font-size: 0.9rem;
        color: var(--text-muted);
    }

    .modal-no-events {
        color: var(--text-muted);
        font-style: italic;
        text-align: center;
        padding: 20px;
    }