@font-face {
    font-family: 'Arimo';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/arimo-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Arimo';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/arimo-bold.woff2') format('woff2');
}

@font-face {
    font-family: 'Arimo';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/arimo-italic.woff2') format('woff2');
}

@font-face {
    font-family: 'Arimo';
    font-style: italic;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/arimo-bold-italic.woff2') format('woff2');
}

* {
    box-sizing: border-box;
    font-family: 'Arimo', 'Helvetica Neue', 'Arial Nova', Verdana, Helvetica, Arial, sans-serif;
    margin-top: 0;
    margin-right: 0;
    margin-bottom: 0;
    margin-left: 0;
    padding-top: 0;
    padding-right: 0;
    padding-bottom: 0;
    padding-left: 0;
}

:root {
    --background-color: #fff;
    --background-image: linear-gradient(#7e8b9b, #9ea8b4);
    --color-committee: #2d5a2d;
    --color-day: #c5cedf;
    --color-empty: #c0c0c0;
    --color-function: #e41438;
    --color-holiday: #efdce4;
    --color-meeting: #2c5aa0;
    --color-meeting-bg: #e8f0ff;
    --color-meeting-border: #4a7bc8;
    --color-summons: #8b0000;
    --color-summons-bg: #fff5f5;
    --color-summons-hover: #660000;
    --color-summons-border: #dc2626;
    --color-text: #222;
    --color-today: #ffffa1;
    --color-toggle: #d8dbe0;
}

.dark-mode {
    --background-color: #121212;
    --background-image: linear-gradient(#525d6a, #434c57);
    --color-committee: #6b9b6b;
    --color-day: #313638;
    --color-empty: #3c4143;
    --color-function: #ed3151;
    --color-holiday: #381a26;
    --color-meeting: #a5c9ff;
    --color-meeting-bg: #1a2332;
    --color-meeting-border: #4a7bc8;
    --color-summons: #ff7b7b;
    --color-summons-bg: #2d1818;
    --color-summons-hover: #ff9999;
    --color-summons-border: #dc2626;
    --color-text: #eee;
    --color-today: #515100;
    --color-toggle: #28292c;
}

body {
    background-color: var(--background-color);
    margin-top: 0;
    margin-right: 0;
    margin-bottom: 0;
    margin-left: 0;
}

.main {
    color: var(--color-text);
    min-height: 100vh;
}

.top {
    background-image: var(--background-image);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    font-size: 1.2rem;
    gap: 0.5rem;
    grid-column: 1 / span 7;
    justify-content: center;
    align-items: center;
    padding-top: 8px;
    padding-bottom: 8px;
    padding-left: 4px;
    padding-right: 4px;
}

a:link,
a:visited {
    color: var(--color-text);
}

/* Interactive elements with hover transitions */
.interactive-hover {
    transition: opacity 0.2s ease;
}

.interactive-hover:hover {
    opacity: 0.7;
}

/* Background color hover for pill-style elements */
.bg-hover {
    transition: background-color 0.2s ease;
}

.bg-hover:hover {
    background-color: #cce7ff;
}

.dark-mode .bg-hover:hover {
    background-color: #245d94;
}

.directions {
    display: flex;
    gap: 0.75rem;
}

.direction {
    color: inherit;
    cursor: pointer;
    text-decoration: none;
}



.direction:hover {
    opacity: 0.8;
}

.month-and-year {
    text-align: center;
    width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar {
    display: grid;
    font-size: 0.75rem;
    gap: 1px;
    /* grid-template-columns: repeat(6, minmax(min-content, 1fr)) min-content; */
    grid-template-columns: repeat(7, minmax(min-content, 1fr));
    margin-top: 0;
    margin-right: auto;
    margin-bottom: 0;
    margin-left: auto;
    max-width: 1280px;
    position: relative;
}

.calendar-grid {
    display: contents;
}

.oob-container {
    display: none;
}

.calendar-day {
    border-bottom-right-radius: 4px;
}

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

.calendar-cell {
    text-align: center;
}

.calendar-day {
    padding-left: 2px;
}

.calendar-day,
.calendar-cell {
    background-color: var(--color-day);
    padding-bottom: 2px;
    padding-top: 2px;
}

/* Enhanced meeting day backgrounds */
.calendar-day:has(.description) {
    background-color: var(--color-meeting-bg);
    border: 1px solid var(--color-meeting-border);
    border-radius: 6px;
}

.calendar-day:has(.location.meeting) {
    background-color: var(--color-meeting-bg);
    border: 2px solid var(--color-meeting-border);
    box-shadow: 0 2px 4px rgba(42, 90, 160, 0.15);
}

.calendar-empty,
.calendar-cell {
    border-bottom-right-radius: 8px;
    min-height: 40px;
}

.holiday {
    background-color: var(--color-holiday);
}

.today {
    background-color: var(--color-today);
}

.day-number {
    padding-bottom: 2px;
    font-weight: 600;
}

.description,
.location {
    color: var(--color-meeting);
    display: block;
    word-break: break-word;
    font-weight: 500;
}

.location.meeting {
    font-size: 0.6rem;
    font-style: italic;
    max-height: 1lh;
    overflow: hidden;
    color: var(--color-meeting);
    background-color: rgba(42, 90, 160, 0.1);
    border-radius: 3px;
    margin-top: 1px;
    margin-right: 0;
    margin-bottom: 1px;
    margin-left: 0;
}

/* Enhanced summons styling */
a.location.meeting {
    color: var(--color-summons);
    background-color: var(--color-summons-bg);
    border: 1px solid var(--color-summons-border);
    border-radius: 3px;
    padding-top: 2px;
    padding-right: 4px;
    padding-bottom: 2px;
    padding-left: 4px;
    margin-top: 1px;
    margin-right: 0;
    margin-bottom: 1px;
    margin-left: 0;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.55rem;
    font-style: normal;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(139, 0, 0, 0.15);
    max-height: unset;
    overflow: unset;
    white-space: nowrap;
}

a.location.meeting:hover {
    color: var(--color-summons-hover);
    background-color: var(--color-summons-bg);
    border-color: var(--color-summons-hover);
    box-shadow: 0 2px 6px rgba(139, 0, 0, 0.3);
    transform: translateY(-1px);
}

/* Toned down committee styling */
.location.committee {
    color: var(--color-committee);
    font-size: 0.62rem;
    font-weight: 400;
    background-color: transparent;
    border: none;
    padding-top: 1px;
    padding-right: 2px;
    padding-bottom: 1px;
    padding-left: 2px;
    margin-top: 1px;
    margin-right: 0;
    margin-bottom: 1px;
    margin-left: 0;
    opacity: 0.8;
}

.location.holiday,
.location.function {
    color: var(--color-function);
    max-height: 4lh;
    overflow: hidden;
    background-color: rgba(228, 20, 56, 0.1);
    border-radius: 3px;
    padding-top: 2px;
    padding-right: 4px;
    padding-bottom: 2px;
    padding-left: 4px;
    margin-top: 1px;
    margin-right: 0;
    margin-bottom: 1px;
    margin-left: 0;
}

.toggle-switch {
    font-size: 0;
}

.theme-toggle-btn {
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    height: 32px;
    width: 32px;
}

.icon {
    cursor: pointer;
}

.dark-icon {
    display: block;
}

.light-icon {
    display: none;
}

.dark-mode {
    color-scheme: dark;
}

.dark-mode .dark-icon {
    display: none;
}

.dark-mode .light-icon {
    fill: var(--color-text);
    display: block;
}

.controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.login-link {
    color: var(--color-text);
    font-size: 0.9rem;
    text-decoration: none;
    background-color: #e6f3ff;
    border: 1px solid #0056b3;
    padding-top: 4px;
    padding-right: 12px;
    padding-bottom: 4px;
    padding-left: 12px;
    border-radius: 16px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}

.login-link:hover {
    text-decoration: none;
}

/* Add dark mode styles */
.dark-mode .login-link {
    background-color: #1a4977;
    border-color: #2d7ed6;
}

.today-link {
    padding: 4px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.today-link svg {
    fill: currentColor;
}

/* User profile bubble and dropdown styles */
.user-profile-container {
    position: relative;
    padding-right: 29.73px;
}

.user-profile-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #e6f3ff;
    border: 1px solid #0056b3;
    color: var(--color-text);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.dark-mode .user-profile-bubble {
    background-color: #1a4977;
    border-color: #2d7ed6;
}

/* Dropdown menu */
.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 120px;
    background-color: var(--background-color);
    border: 1px solid #0056b3;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown.show {
    display: block;
}

.dark-mode .user-dropdown {
    border-color: #2d7ed6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding-top: 10px;
    padding-right: 16px;
    padding-bottom: 10px;
    padding-left: 16px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: #e6f3ff;
}

.dark-mode .dropdown-item:hover {
    background-color: #1a4977;
}

.dropdown-item.logout-link {
    color: #dc2626;
}

.dark-mode .dropdown-item.logout-link {
    color: #ff7b7b;
}

/* Loading spinner styles */
.htmx-indicator {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.htmx-indicator.htmx-request {
    display: block;
}

.spinner {
    border: 8px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 8px solid var(--color-text);
    width: 80px;
    height: 80px;
    animation: spin 1s linear infinite;
}

.dark-mode .spinner {
    border: 8px solid rgba(0, 0, 0, 0.3);
    border-top: 8px solid var(--color-text);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Loading overlay */
.loading-overlay {
    position: relative;
}

.loading-overlay.htmx-request::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    z-index: 50;
}

.dark-mode .loading-overlay.htmx-request::after {
    background-color: rgba(0, 0, 0, 0.7);
}

@media all and (min-width: 34em) {

    .top {
        gap: 1rem;
    }

    .directions {
        gap: 1rem;
    }

    .controls {
        gap: 0.5rem;
    }

    .calendar-day[data-long]::after,
    .description[data-long]::after,
    .location[data-long]::after {
        content: attr(data-long);
    }

    .calendar-day>span,
    .description>span,
    .location>span {
        display: none;
    }

    .description,
    .location {
        padding-left: 2px;
        padding-right: 2px;
        word-break: normal;
    }

    .location.meeting,
    .location.holiday,
    .location.function,
    a.location.meeting {
        max-height: unset;
        overflow: unset;
    }
}
