/* ===================================
   Schedule View Styles
   =================================== */

/* Month Navigation */
.month-navigation {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 6px;
}

.month-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.month-nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.current-month {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0 8px;
}

/* Timeline Container */
.timeline-container {
    background: var(--card-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 24px;
    overflow-x: auto;
}

.timeline-container::-webkit-scrollbar {
    height: 8px;
}

.timeline-container::-webkit-scrollbar-track {
    background: transparent;
}

.timeline-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Week Section */
.week-section {
    margin-bottom: 32px;
}

.week-section:last-child {
    margin-bottom: 0;
}

.week-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Timeline Grid */
.timeline-grid {
    display: grid;
    grid-template-columns: 100px 60px repeat(5, 1fr);
    gap: 0;
    min-width: 800px;
    border-top: 1px solid var(--card-border);
    border-left: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
}

.timeline-header {
    display: contents;
}

.day-header {
    padding: 12px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border-right: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
}

.day-header.today {
    background: rgba(0, 122, 255, 0.1);
    color: var(--accent-blue);
}

.day-header.name-column {
    text-align: left;
    color: var(--text-primary);
    /* No grid-row needed here as it's just one cell in header */
}

/* Timeline Row */
.timeline-row {
    display: contents;
}

.member-cell {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
    grid-row: span 2;
    /* Span AM and PM rows */
}

.period-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
}

.period-cell.am {
    border-bottom: 1px dashed var(--card-border);
    /* Dashed line between AM/PM */
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
}

.member-name {
    font-size: 13px;
    font-weight: 500;
}

/* Day Cell */
.day-cell {
    min-height: 60px;
    /* Reduced height as we have 2 rows now */
    padding: 4px;
    /* Reduced padding */
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.day-cell.am-row {
    border-bottom: 1px dashed var(--card-border);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Event Item */
.event-item {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.event-item:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.event-item.blue {
    background: rgba(0, 122, 255, 0.3);
    border: 1px solid rgba(0, 122, 255, 0.5);
    color: var(--accent-blue);
}

.event-item.purple {
    background: rgba(191, 90, 242, 0.3);
    border: 1px solid rgba(191, 90, 242, 0.5);
    color: var(--accent-purple);
}

.event-item.green {
    background: rgba(52, 199, 89, 0.3);
    border: 1px solid rgba(52, 199, 89, 0.5);
    color: var(--accent-green);
}

.event-item.orange {
    background: rgba(255, 149, 0, 0.3);
    border: 1px solid rgba(255, 149, 0, 0.5);
    color: var(--accent-orange);
}

.event-item.pink {
    background: rgba(255, 45, 85, 0.3);
    border: 1px solid rgba(255, 45, 85, 0.5);
    color: var(--accent-pink);
}

.event-item.gray {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
}

/* ===================================
   Modal System
   =================================== */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal Dialog */
.modal-dialog {
    background: var(--modal-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.3s ease;
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Header */
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Modal Body */
.modal-body {
    padding: 24px;
}

/* Modal Footer */
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Event Form */
.event-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input[type="text"] {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.08);
}

.form-group input[type="text"]::placeholder {
    color: var(--text-secondary);
}

/* Color Picker */
.color-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.color-option:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

.color-option.selected {
    border-color: #ffffff;
    transform: scale(1.1);
}

.color-option.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
}

.color-option.blue {
    background: rgba(0, 122, 255, 0.6);
}

.color-option.purple {
    background: rgba(191, 90, 242, 0.6);
}

.color-option.green {
    background: rgba(52, 199, 89, 0.6);
}

.color-option.orange {
    background: rgba(255, 149, 0, 0.6);
}

.color-option.pink {
    background: rgba(255, 45, 85, 0.6);
}

.color-option.gray {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal Buttons */
.btn-cancel,
.btn-submit,
.btn-delete {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-submit {
    background: var(--accent-blue);
    color: #ffffff;
}

.btn-submit:hover {
    background: rgba(0, 122, 255, 0.8);
}

.btn-delete {
    background: rgba(255, 45, 85, 0.3);
    color: var(--accent-pink);
    border: 1px solid rgba(255, 45, 85, 0.5);
    margin-right: auto;
}

.btn-delete:hover {
    background: rgba(255, 45, 85, 0.4);
}

/* ===================================
   Interaction States
   =================================== */

/* Clickable Day Cells */
.day-cell.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.day-cell.clickable:hover {
    background: rgba(255, 255, 255, 0.05);
}

.day-cell.clickable:empty:hover::after {
    content: '+';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-secondary);
    font-size: 32px;
    font-weight: 300;
    opacity: 0.5;
}

/* Event Item Focus */
.event-item:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Active States */
.event-item:active {
    transform: translateY(0);
}

/* ===================================
   Responsive Adjustments
   =================================== */

@media (max-width: 768px) {
    .modal-dialog {
        width: 95%;
        max-width: none;
        margin: 20px;
    }

    .color-picker {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .btn-cancel,
    .btn-submit,
    .btn-delete {
        width: 100%;
    }

    .btn-delete {
        margin-right: 0;
    }
}