* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.calendar-container {
    background: #2a2a2a;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    max-width: 800px;
    width: 100%;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: rgb(63, 98, 143);
    color: white;
}

.month-year {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.nav-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-button:active {
    background: rgba(255, 255, 255, 0.4);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #404040;
    padding: 1px;
    position: relative;
}

.day-header {
    background: #3a3a3a;
    padding: 16px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #b3b3b3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-days {
    display: contents;
}

.day-cell {
    background: #2a2a2a;
    border: none;
    padding: 66px 8px 0 8px;
    text-align: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #ffffff;
    transition: background-color 0.2s ease;
    min-height: 100px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
}

.day-number {
    padding-top: 4px;
}

.day-number:hover {
    color: #71abe6;
}

.day-cell:hover {
    background-color: #404040;
}

.day-cell.other-month {
    color: #666666;
    background-color: #1a1a1a;
}

.day-cell.today {
    border: 1px solid #0066cc;
    color: white;
    font-weight: 600;
    position: relative;
}

.day-cell.today::after {
    content: '';
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #0066cc;
    z-index: -1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .calendar-container {
        border-radius: 8px;
    }

    .calendar-header {
        padding: 16px 20px;
    }

    .month-year {
        font-size: 1.25rem;
    }

    .nav-button {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .day-header {
        padding: 12px 4px;
        font-size: 0.75rem;
    }

    .day-cell {
        padding: 12px 4px;
        font-size: 0.875rem;
        min-height: 70px;
    }

    .event-bar {
        height: 12px;
    }

    .day-cell.today::after {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .calendar-header {
        padding: 12px 16px;
    }

    .month-year {
        font-size: 1.125rem;
    }

    .nav-button {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    .day-header {
        padding: 8px 2px;
        font-size: 0.6875rem;
    }

    .day-cell {
        padding: 8px 2px;
        font-size: 0.75rem;
        min-height: 60px;
    }

    .event-bar {
        height: 10px;
    }

    .day-cell.today::after {
        width: 24px;
        height: 24px;
    }
}

/* Filter Controls */
.filter-controls {
    padding: 20px 24px;
    background-color: #2a2a2a;
    border-top: 1px solid #404040;
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    color: #e0e0e0;
    font-weight: 500;
    font-size: 0.875rem;
}

.filter-select {
    padding: 8px 32px 8px 12px;
    background-color: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 200px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.filter-select:hover {
    border-color: #0066cc;
}

.filter-select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.filter-select option {
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 8px;
}

/* Focus styles for accessibility */
.nav-button:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.day-cell:focus {
    outline: 2px solid #0066cc;
    outline-offset: -2px;
}

/* Event Bars */
.event-bar {
    margin-top: -18px;
    position: absolute;
    height: 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
    pointer-events: auto;
    text-shadow: 2px 2px 2px #1c1d21;
}

.event-bar:hover {
    opacity: 0.5;
    transform: scaleY(1.1);
}

.event-bar.no-round-left {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.event-bar.no-round-right {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.event-name {
    font-family: Verdana;
    font-weight: bold;
    font-size: 10px;
    text-align: center;
    margin-top: -2px;
}

/* Modal Styles */
.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(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #2a2a2a;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #404040;
}

.modal-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: #b3b3b3;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: #404040;
    color: #ffffff;
}

/* Form Styles */
.event-form {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #e0e0e0;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background-color: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-group input::placeholder {
    color: #666666;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #404040;
}

/* Button Styles */
.button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button-primary {
    background-color: #0066cc;
    color: white;
}

.button-primary:hover {
    background-color: #0056b3;
}

.button-secondary {
    background-color: #404040;
    color: #e0e0e0;
}

.button-secondary:hover {
    background-color: #4a4a4a;
}

.button-danger {
    background-color: #dc3545;
    color: white;
}

.button-danger:hover {
    background-color: #c82333;
}

/* Event Detail Styles */
.event-detail {
    padding: 24px;
}

.event-detail h3 {
    margin: 0 0 16px 0;
    color: #ffffff;
    font-size: 1.25rem;
}

.event-time {
    margin-bottom: 24px;
}

.event-time p {
    margin: 0;
    color: #b3b3b3;
    font-size: 0.875rem;
}

.event-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Color Picker Integration */
.clr-field {
    width: 100%;
}

.clr-field button {
    width: 100%;
    padding: 12px 16px;
    background-color: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.clr-field button:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Event Color Indicator */
.event-color-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.color-label {
    color: #b3b3b3;
    font-size: 0.875rem;
    font-weight: 500;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid #404040;
}

#add-event-for-day-btn {
    margin: 0 20px 20px 0;
}

/* Responsive Filter Controls */
@media (max-width: 768px) {
    .filter-controls {
        padding: 16px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .filter-select {
        width: 100%;
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .filter-controls {
        padding: 12px 16px;
    }

    .filter-label {
        font-size: 0.8125rem;
    }

    .filter-select {
        font-size: 0.8125rem;
        padding: 6px 28px 6px 10px;
    }
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-header h2 {
        font-size: 1.125rem;
    }

    .event-form {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .button {
        width: 100%;
    }

    .event-actions {
        flex-direction: column-reverse;
    }
}

/* Event Overflow Indicator */
.event-overflow-indicator {
    position: absolute;
    font-size: 0.75rem;
    color: #888;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.2s ease;
    pointer-events: auto;
}

.event-overflow-indicator:hover {
    color: #fff;
    text-decoration: underline;
}

/* Day Detail Modal */
.day-detail-event-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 24px;
}

.day-detail-event-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #1a1a1a;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.day-detail-event-item:hover {
    background: #333;
}

.day-detail-event-color {
    width: 4px;
    height: 40px;
    border-radius: 2px;
    margin-right: 12px;
    flex-shrink: 0;
}

.day-detail-event-info {
    flex: 1;
}

.day-detail-event-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: #ffffff;
}

.day-detail-event-time {
    font-size: 0.85rem;
    color: #888;
}

.day-detail-event-category {
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 2px;
}

/* Event Category Display */
.event-category-display {
    margin-bottom: 16px;
}

.category-label {
    color: #b3b3b3;
    font-size: 0.875rem;
    font-weight: 500;
    margin-right: 8px;
}

#detail-event-category {
    color: #ffffff;
    font-size: 0.875rem;
}

/* Responsive Day Detail Modal */
@media (max-width: 768px) {
    .day-detail-event-list {
        max-height: 300px;
        margin: 16px 20px;
    }

    .day-detail-event-item {
        padding: 10px;
    }

    .day-detail-event-color {
        height: 36px;
    }
}
