/* Universal box-sizing for consistent layout calculations */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px 20px 20px;
    font-family: 'Inter', sans-serif;
    background: #f5f5f5;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden; /* Prevents horizontal scrollbar on the body */
}

/* NEW: Top-left buttons container for search/filter */
.top-left-buttons {
    position: absolute;
    top: 20px; /* Matches body padding */
    left: 20px; /* Matches body padding */
    display: flex;
    gap: 10px; /* Space between elements */
    z-index: 100; /* Ensure they are above other content */
    align-items: center; /* Vertically align items */
}

.top-left-buttons .header-filter-select,
.top-left-buttons .header-search-input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
}
.top-left-buttons .header-search-input {
    flex-grow: 1; /* Allow search input to take more space */
    max-width: 200px; /* Limit max width */
}


/* NEW: Top-right buttons container */
.top-right-buttons {
    position: absolute;
    top: 20px; /* Matches body padding */
    right: 20px; /* Matches body padding */
    display: flex;
    gap: 10px; /* Space between buttons */
    z-index: 100; /* Ensure they are above other content */
}

/* NEW: Style for header buttons (About and Login/Logout) */
.header-button {
    background-color: #3498db; /* Blue */
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
}

.header-button:hover {
    background-color: #2980b9;
}

/* Specific color for the logout button when it's "Login" */
#logoutBtn {
    background-color: #e74c3c; /* Red */
}

#logoutBtn:hover {
    background-color: #c0392b;
}

/* NEW: Style for logged-in username display */
#loggedInUsername {
    font-weight: bold;
    color: #2c3e50;
    margin-right: 10px; /* Space between username and buttons */
    align-self: center; /* Vertically align with buttons */
}


.header-with-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    gap: 15px;
}

.main-logo {
    width: 80px;
    height: auto;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 0;
    font-size: 2.5em;
    font-family: 'Inter', sans-serif;
}

/* --- Auth Section Styles --- */
#authSection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    max-width: 400px;
    margin: 0 auto;
    padding: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.auth-form-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form-container h2 {
    text-align: center;
    color: #34495e;
    margin-top: 0;
    margin-bottom: 15px;
}

.auth-form-container input[type="text"],
.auth-form-container input[type="password"] {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
}

/* NEW: Input error styling */
.auth-form-container input.input-error,
.event-form input.input-error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 1px #e74c3c;
}


.auth-form-container button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    overflow: hidden;
}

.auth-form-container button:hover {
    background-color: #2980b9;
}

/* NEW: Styles for disabled buttons and loading spinners */
.auth-form-container button:disabled,
.event-form button:disabled,
.delete-event:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}

.auth-form-container button.loading,
.event-form button.loading,
.delete-event.loading {
    color: transparent;
}

.auth-form-container button.loading::after,
.event-form button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* NEW: Inline error messages */
.error-message {
    color: #e74c3c;
    font-size: 0.85em;
    margin-top: -15px;
    margin-bottom: 5px;
    height: 1.2em;
    display: block;
}


.auth-toggle-link {
    text-align: center;
    margin-top: 15px;
}

.auth-toggle-link a {
    color: #3498db;
    text-decoration: none;
    cursor: pointer;
}

.auth-toggle-link a:hover {
    text-decoration: underline;
}

/* --- App Content Styles --- */
#appContent {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}

.hidden {
    display: none !important;
}

/* --- Calendar/Picker Styles --- */
.year-picker-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.year-picker-container .year-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.year-picker-container .year-text {
    font-size: 1.5em;
    font-weight: bold;
    color: #2c3e50;
}

.year-picker-container .date-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.year-picker-container .date-section span {
    font-size: 1.5em;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.year-picker-container #todayBtn {
    background-color: #2ecc71;
}

.year-picker-container #todayBtn:hover {
    background-color: #27ae60;
}

#toggleTraditionalBtn,
#toggleEventsBtn {
    background-color: #9b59b6;
}

#toggleTraditionalBtn:hover,
#toggleEventsBtn:hover {
    background-color: #8e44ad;
}


.container {
    display: flex;
    gap: 15px;
    flex-grow: 1;
    min-height: 0;
}

.calendar {
    flex: 1;
    overflow: auto;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* NEW: Loading overlay for calendar sections */
.calendar.loading-overlay {
    position: relative;
}

.calendar.loading-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent white overlay */
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.calendar.loading-overlay::after {
    content: '';
    position: absolute;
    width: 40px; /* Larger spinner for calendars */
    height: 40px;
    top: 50%;
    left: 50%;
    margin: -20px 0 0 -20px; /* Center the spinner */
    border: 5px solid #3498db; /* Blue spinner */
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    z-index: 2;
}


/* Event Panel Styles */
.event-panel {
    flex: 0.8;
    overflow: auto;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* NEW: Loading overlay for event panel (already exists but for completeness) */
.event-panel.loading-overlay {
    position: relative;
}

.event-panel.loading-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.event-panel.loading-overlay::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    top: 50%;
    left: 50%;
    margin: -15px 0 0 -15px;
    border: 4px solid #3498db;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    z-index: 2;
}


.event-panel h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.2em;
    text-align: center;
}

.event-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

/* NEW: Event Category Tag */
.event-category-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
    color: white;
    margin-left: 10px;
    vertical-align: middle;
}

/* Styles for specific categories (matching eventCategories in utils.js) */
.category-General { background-color: #6c757d; }
.category-Work { background-color: #007bff; }
.category-Personal { background-color: #28a745; }
.category-Important { background-color: #dc3545; }
.category-Holiday { background-color: #ffc107; }
.category-Appointment { background-color: #6f42c1; }
/* NEW: Style for Recurrence Tag */
.category-Recurrence { background-color: #6200EE; } /* A distinct purple for recurrence */


/* --- REVISED: Styles for individual event items --- */
.event-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fff;
}

.event-list li.no-events {
    color: #7f8c8d;
    font-style: italic;
    text-align: center;
    padding: 20px;
    display: block;
    background: none;
    border: none;
    box-shadow: none;
}

/*
.event-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    padding: 5px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    justify-content: center;
}

.event-controls .filter-select,
.event-controls .search-input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    flex: 1;
    min-width: 120px;
}
.event-controls .search-input {
    flex: 2;
}
*/


/* NEW: Styles for the row containing event title and icons */
.event-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

/* Ensure paragraph within header doesn't have extra margins */
.event-header-row p {
    margin: 0;
    flex-grow: 1;
    padding-right: 10px;
}

/* Styles for the event actions container */
.event-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Style for the view icon */
.view-event-icon {
    color: #28a745;
    cursor: pointer;
    font-size: 1.1em;
}

.view-event-icon:hover {
    color: #218838;
}

/* Style for the edit icon */
.edit-event-icon {
    color: #007bff;
    cursor: pointer;
    font-size: 1.1em;
}

.edit-event-icon:hover {
    color: #0056b3;
}

/* Style for the delete button */
.delete-event {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.9em;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    transition: background-color 0.2s;
    position: relative;
    overflow: hidden;
}

.delete-event:hover {
    background-color: #c82333;
}

.event-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Removed padding-top and border-top to raise it higher */
}

.event-form input[type="text"],
.event-form textarea,
.event-form select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    width: auto; /* Default for inputs and selects */
    resize: vertical;
}

/* NEW: Make textarea span full width and increase height */
.event-form textarea {
    width: 100%;
    height: 120px; /* Doubled height from 60px to 120px */
}

/* NEW: Styles for category options container in forms */
.category-options {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.category-options label {
    font-weight: bold;
    color: #555;
    flex-shrink: 0; /* Prevent label from shrinking */
    min-width: 70px; /* Aligns with Repeats label */
    text-align: left; /* Changed to left-align */
}

.category-options select {
    flex-grow: 1; /* Allow select to take remaining space */
}


/* NEW: Styles for recurrence options container in forms */
.recurrence-options {
    display: flex;
    flex-direction: column; /* Changed to column to stack children */
    gap: 8px; /* Adjusted gap for vertical spacing */
    margin-top: 5px;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.recurrence-pattern-group { /* NEW: Style for the new wrapper div */
    display: flex;
    align-items: center;
    gap: 10px; /* Maintain horizontal gap for label and select */
    width: 100%; /* Ensure it takes full width */
}

.recurrence-options label {
    font-weight: bold;
    color: #555;
    min-width: 70px; /* Aligns with Category label */
    text-align: left; /* Changed to left-align */
}

.recurrence-options select,
.recurrence-options input[type="number"] { /* Changed type */
    flex-grow: 1;
    min-width: 100px; /* Adjust as needed */
}


.event-form button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
    position: relative;
    overflow: hidden;
}

.event-form button:hover {
    background-color: #2980b9;
}

/* Event Marker on Calendar Days - MODIFIED */
.day.has-events::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background-color: #f39c12;
    border-radius: 5px 5px 0 0;
    z-index: 1;
}

/* NEW: Tooltip for event markers */
.day-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.75em;
    white-space: nowrap;
    z-index: 50;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s;
}

.day.has-events:hover .day-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}


/* Traditional Calendar */
.traditional-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.month {
    padding: 8px;
    border: 1px solid #ddd;
    background: #fff;
    break-inside: avoid;
}

.month h3 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 0.9em;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid #eee;
    font-size: 0.7em;
    padding: 0;
    cursor: pointer;
    position: relative;
}

/* Style for the selected day in either calendar */
.selected-day {
    box-shadow: inset 0 0 0 2px #32CD32;
}

/* Style for day of week headers (these are for the traditional calendar or general use now) */
.day-of-week-header {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.7em;
    font-weight: bold;
    color: #555;
    background-color: #f0f0f0;
    border: 1px solid #eee;
}

/* New Calendar (Phase Calendar) */
.phase-group {
    margin-bottom: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 10px; /* Reduced from 15px */
    border: 1px solid #ddd;
}

.phase-header {
    margin: 0 0 10px 0;
    font-weight: bold;
    color: #34495e;
    font-size: 1.1em;
    text-align: center;
}

.phase-row {
    display: flex;
    gap: 10px; /* Reduced from 15px */
    margin-bottom: 15px;
}

.new-month-container {
    flex: 1;
}

.month-title {
    text-align: center;
    margin: 5px 0 8px 0;
    font-size: 0.9em;
    color: #2c3e50;
    font-weight: bold;
}

.new-month {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    border: 1px solid #ecf0f1;
    padding: 2px;
}

/* --- REVISED HIGHLIGHT CLASS - REMOVED RED DOT --- */
.highlight {
    background: transparent !important;
    box-shadow: inset 0 0 0 2px red !important;
    font-weight: bold;
    position: relative;
}

.highlight::after {
    content: none; /* Explicitly remove any generated content */
}

/* --- NEW ROW COLOR CLASSES FOR PHASE CALENDAR --- */

/* Row 1 (R) - Red Tints */
.new-month .day.row-color-red:nth-child(7n + 2),
.new-month .day.row-color-red:nth-child(7n + 3),
.new-month .day.row-color-red:nth-child(7n + 4),
.new-month .day.row-color-red:nth-child(7n + 5) {
    background-color: #FFD9D9 !important;
}
.new-month .day.row-color-red:nth-child(7n + 6),
.new-month .day.row-color-red:nth-child(7n + 7) {
    background-color: #FFA5A5 !important;
}

/* Row 2 (G) - Green Tints */
.new-month .day.row-color-green:nth-child(7n + 2),
.new-month .day.row-color-green:nth-child(7n + 3),
.new-month .day.row-color-green:nth-child(7n + 4),
.new-month .day.row-color-green:nth-child(7n + 5) {
    background-color: #D9FFD9 !important;
}
.new-month .day.row-color-green:nth-child(7n + 6),
.new-month .day.row-color-green:nth-child(7n + 7) {
    background-color: #A5FFA5 !important;
}

/* Row 3 (B) - Blue Tints */
.new-month .day.row-color-blue:nth-child(7n + 2),
.new-month .day.row-color-blue:nth-child(7n + 3),
.new-month .day.row-color-blue:nth-child(7n + 4),
.new-month .day.row-color-blue:nth-child(7n + 5) {
    background-color: #E3E9FB !important;
}
.new-month .day.row-color-blue:nth-child(7n + 6),
.new-month .day.row-color-blue:nth-child(7n + 7) {
    background-color: #BDCBF5 !important;
}

/* Row 4 (C) - Cyan Tints */
.new-month .day.row-color-cyan:nth-child(7n + 2),
.new-month .day.row-color-cyan:nth-child(7n + 3),
.new-month .day.row-color-cyan:nth-child(7n + 4),
.new-month .day.row-color-cyan:nth-child(7n + 5) {
    background-color: #D9FFFF !important;
}
.new-month .day.row-color-cyan:nth-child(7n + 6),
.new-month .day.row-color-cyan:nth-child(7n + 7) {
    background-color: #A5FFFF !important;
}

/* Row 5 (Y) - Yellow Tints */
.new-month .day.row-color-yellow:nth-child(7n + 2),
.new-month .day.row-color-yellow:nth-child(7n + 3),
.new-month .day.row-color-yellow:nth-child(7n + 4),
.new-month .day.row-color-yellow:nth-child(7n + 5) {
    background-color: #FFFFD9 !important;
}
.new-month .day.row-color-yellow:nth-child(7n + 6),
.new-month .day.row-color-yellow:nth-child(7n + 7) {
    background-color: #FFFFA5 !important;
}

/* Row 6 (V) - Violet Tints */
.new-month .day.row-color-violet:nth-child(7n + 2),
.new-month .day.row-color-violet:nth-child(7n + 3),
.new-month .day.row-color-violet:nth-child(7n + 4),
.new-month .day.row-color-violet:nth-child(7n + 5) {
    background-color: #f0ddfc !important;
}
.new-month .day.row-color-violet:nth-child(7n + 6),
.new-month .day.row-color-violet:nth-child(7n + 7) {
    background-color: #ddb0f9 !important;
}

/* --- CRITICAL CHANGES FOR CO-DAY SIZING --- */
.co-day-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    /* padding-top and border-top have been removed */
}

.co-day {
    width: calc((100% - (6 * 3px)) / 7);
    aspect-ratio: 1;
    background: #f8ccac;
    font-size: 0.8em;
    color: #000000;
    border: 1px solid #f8ccac;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

/* Styles for the inline event notes when expanded */
.event-notes-inline {
    margin-top: 5px;
    padding: 10px;
    background-color: #f9f9f9;
    border-left: 4px solid #007bff;
    font-size: 0.9em;
    color: #555;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.4;
    transition: all 0.3s ease-in-out;
    overflow: auto;
    max-height: 200px;
}

/* Class to hide the notes */
.event-notes-inline.hidden {
    display: none;
}

/* --- NEW: Toast Notification Styles --- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: #333;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeInOut 3s forwards;
    min-width: 200px;
    text-align: center;
}

.toast.success { background-color: #28a745; }
.toast.error { background-color: #e74c3c; } /* Updated from previous incomplete line */
.toast.info { background-color: #3498db; }

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-20px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* --- Modal Overlay Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px; /* Add padding for smaller screens */
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    text-align: center;
    max-height: 90vh; /* Limit height to viewport */
    overflow-y: auto; /* Enable scrolling if content overflows */
}

.modal-content h2 {
    color: #34495e;
    margin-top: 0;
    margin-bottom: 20px;
}

.modal-content p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: left;
}

.modal-content ul {
    text-align: left;
    margin-bottom: 15px;
    padding-left: 20px;
}

.modal-content li {
    margin-bottom: 5px;
    color: #555;
}


.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.confirm-button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
}

.confirm-yes {
    background-color: #28a745;
    color: white;
}

.confirm-yes:hover {
    background-color: #218838;
}

.confirm-no {
    background-color: #6c757d;
    color: white;
}

.confirm-no:hover {
    background-color: #5a6268;
}

/* --- Media Queries for Responsiveness --- */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
    }

    .calendar,
    .event-panel {
        flex: none; /* Remove flex-grow in column layout */
        width: 100%; /* Take full width */
        max-width: none; /* No max width */
    }

    .traditional-grid {
        grid-template-columns: 1fr; /* Stack months vertically */
    }

    .top-left-buttons,
    .top-right-buttons {
        position: static; /* Remove absolute positioning */
        margin-bottom: 10px; /* Add some space below them */
        justify-content: center; /* Center align buttons */
        flex-wrap: wrap; /* Allow buttons to wrap */
        padding: 0 10px; /* Add horizontal padding */
    }

    .top-left-buttons {
        margin-top: 10px; /* Space from header */
    }

    .header-with-logo {
        flex-direction: column;
        text-align: center;
    }

    .year-picker-container {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .year-picker-container .year-controls,
    .year-picker-container .date-section {
        flex: none;
        width: 100%;
        justify-content: center;
    }

    .year-picker-container button {
        flex-grow: 1; /* Allow buttons to take available space */
    }

    h1 {
        font-size: 2em;
    }
    .main-logo {
        width: 60px;
    }

    .auth-form-container {
        padding: 20px;
    }

    .toast {
        right: 10px;
        left: 10px;
        transform: translateY(-10px);
    }
}

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

    .header-with-logo {
        gap: 10px;
    }

    h1 {
        font-size: 1.8em;
    }

    .main-logo {
        width: 50px;
    }

    .year-picker-container .date-section span {
        font-size: 1.2em;
    }

    .month-grid .day, .new-month .day {
        font-size: 0.6em;
    }
    .day-of-week-header {
        font-size: 0.6em;
    }

    .event-panel h3 {
        font-size: 1.1em;
    }

    .event-form button, .event-form input, .event-form select, .event-form textarea {
        font-size: 0.85em;
        padding: 6px;
    }

    .modal-content {
        padding: 15px;
    }
    .modal-content p, .modal-content li {
        font-size: 0.9em;
    }

    .confirm-button {
        padding: 8px 15px;
        font-size: 0.9em;
    }
}
/* NEW: Icon for Modified Instances */
.modified-instance-icon {
    color: #f39c12; /* Orange color */
    margin-left: 5px;
    font-size: 0.9em; /* Slightly smaller than recurring-instance-icon */
}

/* Add a margin to the recurring instance icon for better spacing with new modified icon */
.recurring-instance-icon {
    margin-left: 5px;
}

/* Fix for linked header on blog pages */
.header-with-logo a,
.header-with-logo a:visited {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 15px;
}