/* Calendar Mode Styles */

.calendar-container {
    padding: 20px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.calendar-header h3 {
    margin: 0;
    min-width: 200px;
    text-align: center;
}

.calendar-actions {
    display: flex;
    gap: 10px;
}

.calendar-grid {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #007bff;
    color: white;
}

.calendar-weekday {
    padding: 10px;
    text-align: center;
    font-weight: 600;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.calendar-weekday:last-child {
    border-right: none;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    min-height: 100px;
    border: 1px solid #e0e0e0;
    padding: 8px;
    position: relative;
    background: white;
    transition: background-color 0.2s;
}

.calendar-day:hover:not(.empty) {
    background: #f8f9fa;
}

.calendar-day.weekend {
    background: #fafafa;
}

.calendar-day.today {
    background: #e3f2fd;
    border: 2px solid #2196f3;
    box-shadow: 0 0 0 1px #2196f3 inset;
}

.calendar-day.today.weekend {
    background: #f2edff;
    border: 1px solid #654caf;
    box-shadow: 0 0 0 1px #654caf inset;
}

.calendar-day.today .calendar-day-number {
    color: #6519d2;
    font-weight: 700;
    position: relative;
}

.calendar-day.today .calendar-day-number::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #9592c7
}

.calendar-day.empty {
    background: #f5f5f5;
    cursor: default;
}

.calendar-day-number {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.calendar-day-assignments {
    font-size: 12px;
}

.calendar-assignment {
    padding: 3px 6px;
    margin: 2px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-assignment.assigned {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.calendar-assignment.assigned:hover {
    background: #c3e6cb;
}

.calendar-assignment.unassigned {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
}

.calendar-assignment.unassigned:hover {
    background: #ffeeba;
}

.window-label {
    font-weight: 600;
    margin-right: 5px;
}

.agent-label {
    flex: 1;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: none;
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-content h3 {
    margin-top: 0;
    color: #333;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

#assignmentDetails {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

#assignmentDetails p {
    margin: 5px 0;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Mode Toggle Styles */
.mode-toggle {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.mode-toggle label {
    font-weight: 600;
    margin-right: 10px;
}

.mode-switch {
    display: inline-flex;
    background: white;
    border: 2px solid #007bff;
    border-radius: 25px;
    overflow: hidden;
}

.mode-option {
    padding: 8px 20px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    color: #007bff;
    border: none;
    font-weight: 500;
}

.mode-option.active {
    background: #007bff;
    color: white;
}

.mode-option:hover:not(.active) {
    background: #e7f1ff;
}

.fallback-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fallback-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calendar-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .calendar-header h3 {
        order: 1;
        min-width: auto; /* allow title to shrink on small screens */
        font-size: 18px;
    }
    
    .calendar-actions {
        order: 2;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Make month grid comfortably scrollable horizontally */
    .calendar-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .calendar-weekdays,
    .calendar-days {
        /* 7 columns × 120px min keeps cells readable */
        min-width: 840px;
        display: grid;
        grid-template-columns: repeat(7, minmax(120px, 1fr));
    }
    
    .calendar-day {
        min-height: 88px;
        padding: 6px;
    }
    
    .calendar-assignment {
        font-size: 12px;
        /* Stack window + agent for readability */
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        white-space: normal;
    }
    .calendar-assignment .window-label { font-weight: 600; opacity: 0.9; }
    .calendar-assignment .agent-label { text-align: left; width: 100%; }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
}
