/* Calendar Styles */

.calendar-section {
    padding: 40px 20px;
    background: #f8f9fa;
    min-height: 100vh;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.calendar-header h1 {
    font-size: 2rem;
    color: #2c3e50;
}

.calendar-status {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.status-badge {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
}

.status-badge.locked {
    background: #ffebee;
    color: #c62828;
}

.window-info {
    font-size: 0.85rem;
    color: #666;
}

/* Calendar Controls */
.calendar-controls {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.view-switcher {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.view-btn {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.view-btn.active {
    background: #59c9b3;
    color: white;
    border-color: #59c9b3;
}

.view-btn:hover:not(.active) {
    border-color: #59c9b3;
    color: #59c9b3;
}

.calendar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.calendar-nav h2 {
    font-size: 1.5rem;
    min-width: 200px;
    text-align: center;
    color: #2c3e50;
}

.nav-btn, .today-btn {
    padding: 10px 20px;
    border: none;
    background: #59c9b3;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.nav-btn:hover, .today-btn:hover {
    background: #4db8a2;
    transform: translateY(-2px);
}

.calendar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Month View */
.month-calendar {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    /* On narrow screens the 7-column grid is given a usable min-width (see the
       mobile media query) and this box scrolls horizontally — the weekday
       header row and the day grid live in here together, so they scroll in
       sync and stay aligned. Harmless on desktop, where everything fits. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.weekday-headers {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.weekday {
    text-align: center;
    font-weight: 700;
    color: #59c9b3;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

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

.day-cell {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    min-height: 150px;
    padding: 10px;
    transition: all 0.3s;
    cursor: pointer;
}

.day-cell:hover {
    border-color: #59c9b3;
    box-shadow: 0 5px 15px rgba(89, 201, 179, 0.2);
    transform: translateY(-2px);
}

.day-cell.other-month {
    opacity: 0.3;
}

.day-cell.today {
    border-color: #ff6b6b;
    background: #fff5f5;
}

.day-number {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

.shifts-summary {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.shift-item {
    font-size: 0.75rem;
    padding: 5px;
    border-radius: 5px;
    background: #f8f9fa;
}

.shift-item.team-slot {
    background: #e3f2fd;
    border-left: 3px solid #1976d2;
}

.shift-item.assigned-slot {
    background: #e8f5e9;
    border-left: 3px solid #388e3c;
}

.shift-item.tbd-slot {
    background: #fff3e0;
    border-left: 3px solid #f57c00;
}

.shift-item.locked-slot {
    background: #f5f5f5;
    border-left: 3px solid #9e9e9e;
    opacity: 0.6;
}

.shift-time {
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}

/* Volunteer name colors on calendar */
.volunteer-name-text {
    color: #1b5e20; /* Dark green for volunteer names */
    font-weight: 600;
}

.volunteer-tbd {
    color: #c62828; /* Red for TBD */
    font-weight: 600;
}

/* Week View */
.week-grid {
    display: grid;
    grid-template-columns: 100px repeat(7, 1fr);
    gap: 2px;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.time-label {
    padding: 20px 10px;
    font-weight: 600;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.week-day {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    font-weight: 700;
    border-radius: 8px;
    color: #59c9b3;
}

.week-shift {
    padding: 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.week-shift:hover {
    border-color: #59c9b3;
    transform: scale(1.02);
}

.volunteer-name {
    display: block;
    padding: 5px;
    margin: 2px 0;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Day View */
.day-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.day-shifts {
    display: grid;
    gap: 20px;
}

.shift-card {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.shift-card:hover {
    border-color: #59c9b3;
    box-shadow: 0 5px 15px rgba(89, 201, 179, 0.2);
}

.shift-card h3 {
    color: #59c9b3;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.volunteer-slot {
    padding: 10px;
    margin: 5px 0;
    border-radius: 8px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.volunteer-slot.team {
    background: #e3f2fd;
}

.volunteer-slot.tbd {
    background: #fff3e0;
    font-style: italic;
}

.volunteer-slot.tbd strong {
    color: #c62828;
    font-weight: 700;
}

/* Legend */
.calendar-legend {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.calendar-legend h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.legend-items {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-color {
    width: 30px;
    height: 20px;
    border-radius: 4px;
}

.legend-color.team-slot {
    background: #e3f2fd;
    border-left: 3px solid #1976d2;
}

.legend-color.assigned-slot {
    background: #e8f5e9;
    border-left: 3px solid #388e3c;
}

.legend-color.tbd-slot {
    background: #fff3e0;
    border-left: 3px solid #f57c00;
}

.legend-color.locked-slot {
    background: #f5f5f5;
    border-left: 3px solid #9e9e9e;
}

/* 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.5);
}

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

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 0;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s;
}

.modal-content.large {
    max-width: 900px;
}

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

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

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
}

.close {
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.shift-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.shift-info h3 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.shift-info p {
    color: #666;
    margin: 0;
}

.volunteers-list {
    margin-bottom: 20px;
}

.volunteers-list h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: #59c9b3;
}

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

.locked-message {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.locked-message p {
    font-weight: 600;
    margin-bottom: 10px;
}

.locked-message ul {
    margin-left: 20px;
}

/* Admin Propagate Section */
.admin-only {
    background: #fff9e6;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

.propagate-option {
    display: flex;
    align-items: center;
}

.propagate-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.propagate-option label {
    font-size: 0.95rem;
}

#propagateDayShift {
    color: #59c9b3;
    font-weight: 700;
}

.propagate-warning {
    margin-top: 10px;
    padding: 10px;
    background: #fff3cd;
    border-left: 4px solid #ff6b6b;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #856404;
}

/* Team Manager */
.team-description {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    color: #1565c0;
}

.day-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.day-btn {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s;
    color: #2c3e50;
}

.day-btn:hover {
    border-color: #59c9b3;
    color: #59c9b3;
    transform: translateY(-2px);
}

.day-btn.active {
    background: #59c9b3;
    color: white;
    border-color: #59c9b3;
}

.team-day-config {
    margin-bottom: 20px;
}

.team-day-config h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.shift-config-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    margin-bottom: 15px;
}

.shift-config-card h4 {
    color: #59c9b3;
    margin-bottom: 15px;
    font-size: 1.05rem;
}

.volunteer-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.volunteer-select-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.volunteer-select-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.volunteer-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    transition: all 0.3s;
    background: white;
    cursor: pointer;
}

.volunteer-select:focus {
    outline: none;
    border-color: #59c9b3;
}

.volunteer-select:valid:not([value=""]) {
    background: #e8f5e9;
    border-color: #4caf50;
    font-weight: 600;
}

.volunteer-select option {
    padding: 10px;
}

.volunteer-select option[value=""] {
    color: #999;
}

.volunteer-select option[value="EMPTY"] {
    color: #999;
    font-style: italic;
}

/* Buttons */
.btn-primary {
    background: #59c9b3;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #4db8a2;
    transform: translateY(-2px);
}

.btn-secondary {
    background: white;
    color: #59c9b3;
    padding: 12px 24px;
    border: 2px solid #59c9b3;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #f0f0f0;
}

.btn-add-slot {
    background: #3498db;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    width: 100%;
}

.btn-add-slot:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-add-team-slot {
    background: #3498db;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    width: 100%;
    margin-top: 10px;
}

.btn-add-team-slot:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-delete-team-slot {
    background: #ff6b6b;
    color: white;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
    margin-left: 10px;
}

.btn-delete-team-slot:hover {
    background: #ff5252;
    transform: scale(1.05);
}

.volunteer-select-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.volunteer-select-group label {
    min-width: 100px;
    font-weight: 600;
}

.volunteer-select-group select {
    flex: 1;
}

.btn-admin {
    background: #666;
    color: white;
    padding: 12px 24px;
    border: 2px solid #666;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.btn-admin:hover {
    background: #555;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-logout {
    background: #ff6b6b;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #ff5252;
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#currentUser {
    font-size: 0.9rem;
    color: #666;
}

/* Calendar View Toggle */
.calendar-view {
    display: none;
}

.calendar-view.active {
    display: block;
}

/* Responsive */
@media (max-width: 1024px) {
    .month-grid {
        gap: 5px;
    }

    /* Keep the weekday header columns aligned with the day cells: both grids
       must use the same gap, or the 7 equal columns land in different places. */
    .weekday-headers {
        gap: 5px;
    }

    .day-cell {
        min-height: 120px;
        padding: 5px;
    }

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

    .shift-item {
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    /* Keep the day cells readable instead of crammed: give the grid a usable
       minimum width and let .month-calendar scroll horizontally. Both grids get
       the same min-width so their columns stay aligned. */
    .month-calendar {
        padding: 10px;
    }
    .weekday-headers,
    .month-grid {
        min-width: 640px;
    }

    .weekday-headers .weekday {
        font-size: 0.8rem;
        padding: 10px 5px;
    }

    .calendar-nav h2 {
        font-size: 1.2rem;
    }

    .teams-grid {
        grid-template-columns: 1fr;
    }

    .week-grid {
        grid-template-columns: 80px repeat(7, 1fr);
        font-size: 0.85rem;
    }
}

/* Roster Manager Styles */
.roster-section {
    margin-bottom: 20px;
}

.roster-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.add-volunteer-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volunteer-list {
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px;
    background: #f8f9fa;
}

.volunteer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 2px solid #e0e0e0;
    transition: all 0.2s;
}

.volunteer-item:hover {
    border-color: #59c9b3;
    box-shadow: 0 2px 8px rgba(89, 201, 179, 0.2);
}

.volunteer-name {
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
}

.volunteer-actions {
    display: flex;
    gap: 8px;
}

.volunteer-name-edit {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
}

.btn-edit {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-edit:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.btn-save {
    background: #48bb78;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-save:hover {
    background: #38a169;
    transform: translateY(-1px);
}

.btn-cancel {
    background: #999;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #777;
    transform: translateY(-1px);
}

.btn-delete {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #ff5252;
    transform: translateY(-1px);
}

.empty-roster {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

#volunteerCount {
    color: #59c9b3;
    font-weight: 700;
}
