/* --- Refined Greek-Inspired Calendar --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --aegean-blue: #0070f3;
    --deep-blue: #0059cc;
    --white: #ffffff;
    --off-white: #f8fafc;
    --light-blue: #eef5ff;
    --accent-blue: #00b4ff;
    --greek-terracotta: #e57373;
    --greek-olive: #7cb342;
    --greek-sand: #fff8e1;
    --greek-stone: #e0e0e0;
    --text-dark: #1a202c;
    --text-medium: #4a5568;
    --text-light: #718096;
    --shadow: rgba(0, 112, 243, 0.08);
    --border-radius: 12px;
}

/* Import refined font */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');

/* Page background with subtle pattern */
body {
    font-family: 'Lato', sans-serif;
    background-color: var(--off-white);
    background-image: 
        radial-gradient(var(--light-blue) 1px, transparent 1px),
        radial-gradient(var(--light-blue) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    padding: 32px;
    min-height: 100vh;
    font-weight: 400;
    letter-spacing: 0.01em;
}

/* Enhanced containers with layered shadows */
.calendar-container, .sidebar {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.02),
        0 6px 20px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(224, 224, 224, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.calendar-container:hover, .sidebar:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.06),
        0 12px 40px rgba(0, 0, 0, 0.04);
}

/* Greek flag inspired top border */
.calendar-container::before, .sidebar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px; /* Adjusted height for 5 stripes */
    background-image: linear-gradient(
        to bottom,
        var(--aegean-blue) 0%, var(--aegean-blue) 20%,
        var(--white) 20%, var(--white) 40%,
        var(--aegean-blue) 40%, var(--aegean-blue) 60%,
        var(--white) 60%, var(--white) 80%,
        var(--aegean-blue) 80%, var(--aegean-blue) 100%
    );
    opacity: 0.9; /* Adjusted opacity slightly */
    z-index: 2;
}

/* Enhanced calendar header */
.calendar-header h2 {
    position: relative;
    padding-bottom: 8px;
    display: inline-block;
}

.calendar-header h2::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 25%;
    width: 50%;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--aegean-blue), transparent);
}

/* Enhanced day cells */
.day-cell {
    background-color: var(--off-white);
    border: 1px solid rgba(224, 224, 224, 0.5);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

.day-cell:hover {
    background-color: var(--light-blue);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 14px rgba(0, 112, 243, 0.12);
    z-index: 2;
}

/* Current day with decorative element */
.day-cell.current-day {
    background-color: var(--greek-sand);
    border: none;
}

.day-cell.current-day::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 16px 16px 0;
    border-color: transparent var(--aegean-blue) transparent transparent;
}

/* Enhanced buttons with animated hover */
.calendar-header button, #sidebar-add-event-container button, #clear-selection-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    letter-spacing: 0.08em;
    font-weight: 400;
    z-index: 1;
}

.calendar-header button::before, #sidebar-add-event-container button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.6s ease;
    z-index: -1;
}

.calendar-header button:hover::before, #sidebar-add-event-container button:hover::before {
    left: 100%;
}

/* Custom scrollbar with Greek motif */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--off-white);
}

::-webkit-scrollbar-thumb {
    background: var(--aegean-blue);
    border-radius: 4px;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(255, 255, 255, 0.4) 4px,
        rgba(255, 255, 255, 0.4) 8px
    );
}

/* Person color indicators with improved aesthetics */
.event-display-in-cell {
    font-size: 0.75rem;
    line-height: 1.4;
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.event-display-in-cell:hover {
    transform: translateX(2px);
    background-color: rgba(255, 255, 255, 0.9);
}

/* Styled person selector */
#person-select {
    transition: all 0.3s ease;
    border: 1px solid rgba(224, 224, 224, 0.6);
    background-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

#person-select:hover {
    border-color: var(--accent-blue);
}

/* Styled logout button */
.logout-container {
    margin-top: 20px;
    text-align: center;
}

.logout-button {
    display: inline-block;
    background-color: var(--light-blue);
    color: var(--aegean-blue);
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    letter-spacing: 0.04em;
    position: relative;
    overflow: hidden;
}

.logout-button::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--aegean-blue), transparent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.logout-button:hover {
    background-color: rgba(255, 241, 241, 0.7);
    color: #e53e3e;
}

.logout-button:hover::after {
    transform: scaleX(1);
    background: linear-gradient(to right, transparent, #e53e3e, transparent);
}

/* Event list items with improved visual hierarchy */
#sidebar-event-list li {
    background-color: var(--off-white);
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    border-left: 3px solid transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

#sidebar-event-list li:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

#sidebar-event-list li .delete-event-btn {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
}

#sidebar-event-list li:hover .delete-event-btn {
    opacity: 1;
    transform: scale(1);
}

/* Add Event container enhancement */
#sidebar-add-event-container {
    background: linear-gradient(135deg, var(--light-blue), var(--off-white));
    padding: 20px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

#sidebar-add-event-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.6) 1px, transparent 1px),
        radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.6) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
    border-radius: 12px;
    z-index: 0;
}

#sidebar-add-event-container input[type="text"] {
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(224, 224, 224, 0.6);
    padding: 14px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

/* Animation for selection */
.day-cell.selected {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 112, 243, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(0, 112, 243, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 112, 243, 0);
    }
}

/* Login form enhancement */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: linear-gradient(135deg, var(--white), var(--off-white));
    border-radius: var(--border-radius);
    box-shadow: 
        0 10px 25px var(--shadow),
        0 20px 40px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    padding: 40px;
    transform: translateY(0);
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.login-container:hover {
    transform: translateY(-6px);
    box-shadow: 
        0 14px 30px var(--shadow),
        0 24px 50px rgba(0, 0, 0, 0.05);
}

.login-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--aegean-blue), var(--accent-blue));
}

.login-form input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(224, 224, 224, 0.6);
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-dark);
    transition: all 0.3s ease;
    font-family: 'Lato', sans-serif;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--aegean-blue);
    box-shadow: 0 0 0 3px rgba(0, 112, 243, 0.15);
    transform: translateY(-2px);
}

.login-form button {
    position: relative;
    overflow: hidden;
    background: linear-gradient(to right, var(--aegean-blue), var(--accent-blue));
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 400;
    transition: all 0.3s ease;
    font-family: 'Lato', sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(0, 112, 243, 0.2);
}

.login-form button:hover {
    background: linear-gradient(to right, var(--deep-blue), var(--aegean-blue));
    box-shadow: 0 6px 14px rgba(0, 112, 243, 0.3);
    transform: translateY(-2px);
}

.login-form button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: all 0.6s ease;
}

.login-form button:hover::before {
    left: 100%;
}

/* --- Main Layout --- */
.main-content-wrapper {
    display: flex;
    gap: 24px;
    width: 100%;
    max-width: 1400px;
}

.calendar-container {
    flex-grow: 1;
    padding: 32px;
    display: flex;
    flex-direction: column;
}

.sidebar {
    width: 340px;
    flex-shrink: 0;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Blue line indicators inspired by Greek flag - REMOVED as ::before now handles this motif */
/*
.calendar-container::after,
.sidebar::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--aegean-blue);
}
*/

/* --- Calendar Header --- */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.calendar-header h2 {
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--text-dark);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.calendar-header button {
    background-color: var(--light-blue);
    color: var(--aegean-blue);
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 400;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Lato', sans-serif;
    letter-spacing: 0.04em;
}

.calendar-header button:hover {
    background-color: var(--aegean-blue);
    color: var(--white);
}

/* --- Calendar Grid --- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    flex-grow: 1;
}

.day-name {
    font-weight: 400;
    text-align: center;
    padding-bottom: 12px;
    color: var(--text-medium);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.day-cell, .empty-cell {
    border-radius: 8px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    padding: 8px;
    transition: all 0.25s ease;
    position: relative;
}

.day-cell {
    background-color: var(--off-white);
    cursor: pointer;
}

.day-cell:hover {
    background-color: var(--light-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.empty-cell {
    background-color: transparent;
}

/* --- Day Cell Content --- */
.day-cell-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.day-number {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 8px;
    color: var(--text-dark);
    letter-spacing: 0.03em;
}

/* Current day highlighting */
.day-cell.current-day .day-number {
    color: var(--aegean-blue);
    font-weight: 600;
}

.day-cell.current-day::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--aegean-blue);
}

/* --- Selection Styling --- */
.day-cell.selected {
    background-color: rgba(0, 112, 243, 0.08);
    border: 1px solid var(--aegean-blue);
}

.day-cell.selected-range {
    background-color: rgba(0, 112, 243, 0.05);
}

.day-cell.selected-range-start,
.day-cell.selected-range-end {
    background-color: rgba(0, 112, 243, 0.12);
    border: 1px solid var(--aegean-blue);
}

/* --- Person Selector --- */
.person-selector-container {
    margin-bottom: 12px;
}

.person-selector-container label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: var(--text-medium);
    font-weight: 500;
}

#person-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-dark);
    background-color: var(--white);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%230070f3' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    font-family: 'Lato', sans-serif;
    letter-spacing: 0.03em;
}

#person-select:focus {
    outline: none;
    border-color: var(--aegean-blue);
    box-shadow: 0 0 0 3px rgba(0, 112, 243, 0.1);
}

/* --- Sidebar Divider --- */
.sidebar-divider {
    border: none;
    height: 2px; /* Adjusted for two stripes */
    background-image: linear-gradient(
        to bottom,
        var(--aegean-blue) 0%, var(--aegean-blue) 50%,
        var(--white) 50%, var(--white) 100%
    );
    margin: 16px 0;
}

/* --- Sidebar Selection Info --- */
#sidebar-selection-info {
    margin-bottom: 16px;
}

#sidebar-selected-date-display {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-dark);
    letter-spacing: 0.04em;
}

/* --- Clear Selection Button --- */
#clear-selection-button {
    background-color: #fff1f1;
    color: #e53e3e;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 400;
    margin-bottom: 16px;
    transition: all 0.2s ease;
    font-family: 'Lato', sans-serif;
    letter-spacing: 0.04em;
}

#clear-selection-button:hover {
    background-color: #fed7d7;
}

/* --- Event List --- */
#sidebar-event-list-container {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 150px;
    margin-bottom: 16px;
}

#sidebar-event-list {
    list-style: none;
}

#sidebar-event-list li {
    background-color: var(--off-white);
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    position: relative;
    border-left: 3px solid transparent; /* Will be colored by person color */
}

#sidebar-event-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.04);
}

#sidebar-event-list li .event-details {
    flex-grow: 1;
    margin-right: 12px;
    font-size: 0.875rem;
    color: var(--text-dark);
    letter-spacing: 0.02em;
}

#sidebar-event-list li .event-details strong {
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

#sidebar-event-list li .delete-event-btn {
    background-color: transparent;
    color: var(--text-light);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    visibility: visible !important;
    opacity: 1 !important;
}

#sidebar-event-list li .delete-event-btn:hover {
    background-color: #e53e3e;
    color: white;
}

#no-events-message {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    padding: 24px 0;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
}

/* --- Add Event Container --- */
#sidebar-add-event-container {
    background-color: var(--light-blue);
    padding: 18px;
    border-radius: 10px;
    position: relative;
}

#sidebar-add-event-container input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-dark);
    transition: all 0.2s ease;
    font-family: 'Lato', sans-serif;
}

#sidebar-add-event-container input[type="text"]:focus {
    outline: none;
    border-color: var(--aegean-blue);
    box-shadow: 0 0 0 3px rgba(0, 112, 243, 0.1);
}

#sidebar-add-event-container button {
    background-color: var(--aegean-blue);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 400;
    width: 100%;
    transition: all 0.2s ease;
    font-family: 'Lato', sans-serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#sidebar-add-event-container button:hover {
    background-color: var(--deep-blue);
}

/* --- Person Colors --- */
.day-cell[style*="background-color"] {
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.5) 100%);
    border: none;
}

.day-cell[style*="background-color"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.06);
}

/* Greek meander pattern for visual interest - REMOVED to avoid conflict with new flag border */
/*
.calendar-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(to right, var(--aegean-blue), var(--accent-blue));
    opacity: 0.9;
}
*/

/* Tooltip styling (browser default, but can be enhanced if needed) */
[title] {
    /* Basic styling for consistency if you want to override defaults */
    /* For more advanced tooltips, a JS library would be better */
}

/* Visibility control (JS will primarily handle this by adding/removing 'hidden' class or setting display directly) */
.hidden {
    display: none !important;
}

/* Add subtle Greek key pattern to buttons on hover */
.calendar-header button:hover::after,
#sidebar-add-event-container button:hover::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: repeating-linear-gradient(
        to right,
        rgba(255, 255, 255, 0.7) 0px,
        rgba(255, 255, 255, 0.7) 6px,
        transparent 6px,
        transparent 12px
    );
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    body {
        padding: 16px; /* Reduce body padding on smaller screens */
    }

    .main-content-wrapper {
        flex-direction: column;
        gap: 16px; /* Adjust gap for vertical layout */
    }

    .calendar-container,
    .sidebar {
        width: 100%;
        padding: 16px; /* Reduce container padding */
        margin-bottom: 16px; /* Add some margin between stacked items */
    }

    .sidebar {
        width: 100%; /* Ensure sidebar takes full width */
        max-width: none; /* Override any max-width if previously set for larger screens */
        flex-shrink: 1; /* Allow sidebar to shrink if necessary, though width: 100% is dominant */
        margin-bottom: 0; /* Reset bottom margin if last item */
    }

    .calendar-header {
        flex-direction: column;
        gap: 16px;
        margin-bottom: 16px;
    }

    .calendar-header h2 {
        font-size: 1.5rem; /* Slightly smaller header text */
        text-align: center;
    }

    .calendar-header button {
        width: 48%; /* Make prev/next buttons take up more space */
        justify-content: center;
    }
    
    .calendar-header div:nth-child(2) { /* Target the h2 container if it's wrapped */
        order: -1; /* Move month/year display to the top in column layout */
    }

    .day-cell, .empty-cell {
        min-height: 80px; /* Reduce min-height of day cells */
        padding: 6px;
    }

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

    .event-display-in-cell {
        font-size: 0.7rem;
        padding: 2px 4px;
    }

    #sidebar-add-event-container input[type="text"],
    #sidebar-add-event-container button {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    /* Adjust login container for smaller screens */
    .login-container {
        margin: 40px auto;
        padding: 24px;
    }

    /* When sidebar is active on mobile, it takes over the screen */
    .sidebar.sidebar-active-mobile {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw; /* Full viewport width */
        height: 100vh; /* Full viewport height */
        z-index: 1000; /* Ensure it's on top */
        background-color: var(--white); /* Ensure it has a solid background */
        overflow-y: auto; /* Allow scrolling within the sidebar if content is long */
        padding: 20px; /* Adjust padding for full screen */
        padding-bottom: 90px; /* Extra padding at the bottom for the fixed "Clear Selection" button */
        display: flex; /* It's already flex, but ensure it */
        flex-direction: column;
        box-sizing: border-box; /* Ensure padding is included in width/height */
        /* Override any transform that might have been applied for hiding */
        transform: translateY(0) !important; 
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* When sidebar is active on mobile, hide the calendar container */
    .main-content-wrapper.sidebar-focused .calendar-container {
        display: none;
    }

    /* Adjustments for elements inside the fullscreen sidebar */
    .sidebar.sidebar-active-mobile #sidebar-event-list-container {
        flex-grow: 1; /* Allow event list to take available space */
        min-height: 200px; /* Ensure it has some minimum height */
    }

    .sidebar.sidebar-active-mobile #clear-selection-button {
        position: absolute; /* Positioned relative to the .sidebar-active-mobile container */
        bottom: 20px;       /* Space from bottom of viewport */
        left: 20px;         /* Space from left of viewport */
        right: 20px;        /* Space from right of viewport */
        width: auto;        /* Let left/right define width based on padding */
        background-color: var(--greek-terracotta); /* More prominent color */
        color: var(--white);
        padding: 15px;
        font-size: 1rem;
        font-weight: 700; /* Bolder text */
        z-index: 10; /* Above other sidebar content if it scrolls under */
        border-radius: var(--border-radius); /* Use root variable */
        text-align: center;
        box-sizing: border-box;
        margin-top: 0; /* Remove any top margin it might have */
        margin-bottom: 0; /* Remove any bottom margin it might have */
    }
    .sidebar.sidebar-active-mobile #clear-selection-button:hover {
        background-color: #d32f2f; /* Darker red on hover */
    }

    /* Ensure the add event container in mobile fullscreen is styled appropriately */
    .sidebar.sidebar-active-mobile #sidebar-add-event-container {
        margin-top: 16px; /* Add some space above it if event list is scrollable */
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .calendar-container,
    .sidebar {
        padding: 12px;
    }

    .calendar-header {
        gap: 12px;
    }
     .calendar-header button {
        width: 100%; /* Stack prev/next buttons */
        margin-bottom: 8px;
    }
    .calendar-header button:last-of-type {
        margin-bottom: 0;
    }

    .day-name {
        font-size: 0.65rem;
        padding-bottom: 8px;
    }

    .day-cell, .empty-cell {
        min-height: 70px;
    }
}
