.calendar-container {
    background: #22201f;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scroll-snap-type: x mandatory; /* Optional: to make it snap to items if needed */
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    width: 100%;
    color: rgb(255, 255, 255);
}

.calendar-header button {
    background: var(--secondary-color);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(100px, 1fr));
    gap: 2px;
    background-color: var(--background-color);
    max-width: 100%; /* Prevents it from stretching beyond container */
}

.calendar-day {
    min-height: 120px;
    height: 100%;
    border: 1px solid #ddd;
    background-color: #996713;
    display: flex;
    flex-direction: column;
    min-width: 100px;
    font-size: .5rem;
}

.calendar-day.empty {
    background-color: var(--background-color);
}

.calendar-day:hover {
    background-color: var(--hover-color);
}

.weekday {
    text-align: center;
    font-weight: bold;
    padding: 0.5rem;
    background-color: var(--secondary-color);
    color: white;
}

.day-number {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.event-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: var(--secondary-color);
    color: white;
    padding: 0.3rem;
    border-radius: 5px;
    margin-top: 0.15rem;
    cursor: pointer;
}

.event-indicator:hover {
    background: var(--secondary-color-dark);
}

.event-indicator .event-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-indicator .user-count {
    font-size: 0.8em;
    white-space: nowrap;
    opacity: 0.9;
}

.event-indicator .user-count i {
    margin-right: 2px;
}

.event-indicator.more-events {
    text-align: center;
    background: #95a5a6;
}

.event-details p {
    margin-bottom: 0.5rem;
}

.time-slots {
    display: grid;
    gap: 0.5rem;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 10px;
}

.time-slot {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.time-slot-event {
    background: var(--secondary-color);
    color: white;
    padding: 0.5rem;
    border-radius: 5px;
    margin-top: 0.5rem;
    cursor: pointer;
}

.time-slots::-webkit-scrollbar {
    width: 8px;
}

.time-slots::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.time-slots::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

.time-slots::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color-dark);
}

.modal-header .event-header-content {
    display: flex;
    flex-direction: column;
    width: 100%;
}

#eventImage {
    margin: 0;
}

#eventImage img.event-image {
    width: 100%;
    border-radius: 10px 10px 0 0;
    display: block;
}

.event-title-container {
    padding: 0 20px;
    font-weight: bold;
}

.event-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
}

.event-details .label {
    font-weight: 700;
}

.event-details .value {
    word-break: break-word;
}

.event-details-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    overflow: hidden;
}

.event-details-modal .modal-content {
    background: linear-gradient(145deg, #2a2a2a, #363636);
    color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3),
                0 0 0 2px rgba(255, 255, 255, 0.1);
    margin: 5vh auto;
    padding: 0;
    width: auto;
    min-width: 300px;
    max-width: 800px;
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
}


.event-details-modal .modal-header {
    background: linear-gradient(145deg, #3a3a3a, #444444);
    padding: 1rem;
    border-radius: 15px 15px 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.event-details-modal .modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.event-details-modal .close-btn {
    color: #b93131;
    float: right;
    text-align: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.event-details-modal .close-btn:hover {
    color: #ff4444;
}

#calendarLinks, #discordLinks {
    grid-column: 1 / -1;
    margin-top: 1rem;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 10px;
}

#calendarLinks h4, #discordLinks h4 {
    margin-bottom: 0.5rem;
}

.calendar-link, .discord-link {
    display: inline-block;
    margin: 4px 4px 4px 0;
    padding: 4px 8px;
    background: #5865F2;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
}

.calendar-link:hover {
    text-decoration: underline;
}

.discord-link:hover {
    background: #4752C4;
}

.discord-link.app-link {
    background: #36393f;
}

.discord-link.app-link:hover {
    background: #2f3136;
}

#calendarLinks::-webkit-scrollbar,
#discordLinks::-webkit-scrollbar {
    height: 6px;
}

#calendarLinks::-webkit-scrollbar-track,
#discordLinks::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#calendarLinks::-webkit-scrollbar-thumb,
#discordLinks::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 3px;
}

#calendarLinks::-webkit-scrollbar-thumb:hover,
#discordLinks::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color-dark);
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header-nav h3 {
    margin: 0;
    font-family: 'Aclonica';
    font-size: 22px;
}

/* Time slot event styles */
.time-slot-event {
    padding: 0.5rem;
    border-radius: 5px;
    margin-top: 0.5rem;
    cursor: pointer;
    color: white;
    transition: background-color 0.2s ease;
}

/* Discord Time slot event styles */
.time-slot-event.discord-event {
    background: var(--secondary-color, #996713);
    color: #000000;
}

.time-slot-event.discord-event:hover {
    background: var(--secondary-color-dark, #805710);
}

.event-indicator.discord-event {
    color: black;
    display: flex;
    align-items: center;
}

/* Meetup Time slot event styles*/
.event-indicator.usergroup-event {
    background: #1a0147;
    display: flex;
    align-items: center;
}
.event-indicator.usergroup-event:hover {
    background: #4f03dc; /* Lighter purple on hover */
}

.usergroup-link {
    display: inline-block;
    margin: 4px 4px 4px 0;
    padding: 4px 8px;
    background: #9506c9;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
}
.time-slot-event.usergroup-event {
    background: #1a0147;
}

.time-slot-event.usergroup-event:hover {
    background: #4f03dc;
}

/* Twitch Time slot event styles*/
.event-indicator.twitch-event {
    background: #6441a5; /* Twitch purple */
    display: flex;
    align-items: center;
}

.event-indicator.twitch-event:hover {
    background: #7d5bbe; /* Lighter purple on hover */
}

.twitch-link {
    display: inline-block;
    margin: 4px 4px 4px 0;
    padding: 4px 8px;
    background: #6441a5;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
}

.twitch-link:hover {
    background: #7d5bbe;
}

.time-slot-event.twitch-event {
    background: #6441a5;
}

.time-slot-event.twitch-event:hover {
    background: #7d5bbe;
}

/* Media Queries */
@media screen and (max-width: 768px) {
    .calendar-grid {
        gap: 2px;
    }

    .calendar-day {
        min-height: 80px;
        padding: 0.25rem;
        font-size: 0.9rem;
    }

    .weekday {
        padding: 0.25rem;
        font-size: 0.8rem;
    }

    .event-indicator {
        padding: 0.25rem;
        font-size: 0.8rem;
    }

    .calendar-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .calendar-header button {
        width: 100%;
        margin: 2px 0;
    }

    .header-nav {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }

    .header-nav h3 {
        font-size: 18px;
    }

    .modal-content {
        width: 95%;
        margin: 2vh auto;
    }

    .modal-body {
        padding: 0.5rem;
    }

    .event-details {
        grid-template-columns: 1fr;
    }

    .event-details .label {
        margin-top: 0.5rem;
    }

    .calendar-link, .discord-link {
        display: block;
        margin: 0.5rem 0;
        text-align: center;
    }
}

@media screen and (max-width: 480px) {
    .event-indicator .user-count {
        display: none;
    }

    .calendar-day {
        min-height: 60px;
    }

    .day-number {
        font-size: 0.8rem;
    }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Media queries for responsiveness */
@media (max-width: 768px) {
    .event-details-modal .modal-content {
        width: 95%;
        margin: 2vh auto;
    }
}
