/* Schedule Page Styles */

/* Hero Section */
.schedule-hero {
    background: #3A84C5;
    color: white;
    padding: 80px 0 60px;
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Calendar Section */
.calendar-section {
    padding: 60px 0;
    background: #DEE2E5;
}

/* Calendar Controls */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.view-controls {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #e5e7eb;
    background: white;
    color: #6b7280;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.view-btn.active {
    background: #3A84C5;
    border-color: #3A84C5;
    color: white;
}

.calendar-navigation {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: #3A84C5;
    color: white;
}

.date-selector {
    display: flex;
    gap: 0.5rem;
}

.date-select {
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
}

.calendar-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #e5e7eb;
    background: white;
    color: #6b7280;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Filter Panel */
.filter-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.filter-panel.active {
    max-height: 80vh; /* allow more space when expanded */
    overflow-y: auto; /* enable scrolling if content is taller */
}

.filter-content {
    padding: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-group label {
    font-weight: 600;
    color: #374151;
}

.filter-select,
.filter-input {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.filter-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Calendar Container */
.calendar-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow: hidden;
}

.calendar-header {
    padding: 1.5rem;
    background: #DEE2E5;
    border-bottom: 1px solid #e5e7eb;
}

.calendar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

/* Calendar Views */
.calendar-view {
    display: none;
    padding: 1.5rem;
}

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

/* Month View */
.calendar-weekdays {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 1px;
    background: #DEE2E5;
    margin-bottom: 1px;
}

.weekday {
    background: #DEE2E5;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: #6b7280;
    font-size: 0.875rem;
}

.weekday.week-number-header {
    background: #d8dee6;
    color: #374151;
}

.calendar-grid {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 1px;
    background: #DEE2E5;
}

.week-number-cell {
    background: #f3f4f6;
    color: #374151;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.calendar-day {
    background: white;
    min-height: 120px;
    padding: 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    position: relative;
}

.calendar-day:hover {
    background: #DEE2E5;
}

.calendar-day.other-month {
    background: #f9fafb;
    color: #9ca3af;
}

.calendar-day.today {
    background: #eff6ff;
    border: 2px solid #3b82f6;
}

.calendar-day.has-sessions {
    border-left: 4px solid #10b981;
}

.calendar-day.non-working {
    background: #fff1f2; /* light red */
}

.day-number {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.day-sessions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.session-indicator {
    background: #3A84C5;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-indicator:hover {
    transform: translateY(-1px);
}

.session-indicator.safety { background: #10b981; }
.session-indicator.medical { background: #EE7527; }
.session-indicator.survival { background: #ef4444; }
.session-indicator.offshore { background: #8b5cf6; }
.session-indicator.specialized { background: #6366f1; }

.session-indicator.full {
    opacity: 0.7;
    text-decoration: line-through;
}

.calendar-day.empty-day { cursor: pointer; }
.calendar-day.empty-day:hover {
    background: #f9fafb;
    box-shadow: inset 0 0 0 1px #e5e7eb;
}

.empty-day-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    display: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 150ms ease, transform 150ms ease;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.2;
    z-index: 2000;
    pointer-events: none; /* allow hover to remain on the day cell */
    max-width: 260px;
}

.empty-day-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Week View */
.week-header {
    display: grid;
    grid-template-columns: 80px 80px 1fr; /* week number | time column | days header */
    border-bottom: 1px solid #e5e7eb;
}

.time-column {
    background: #DEE2E5;
    border-right: 1px solid #e5e7eb;
}

.week-number-header {
    background: #d8dee6;
    border-right: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 700;
    color: #374151;
}

.week-number-header .week-number-value {
    display: inline-block;
    min-width: 2ch;
}

.week-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #DEE2E5;
}

.week-day {
    background: #DEE2E5;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: #6b7280;
}

.week-day.non-working {
    background: #fee2e2; /* lighter red in header */
}

.week-content {
    display: grid;
    grid-template-columns: 80px 80px 1fr; /* week number | time slots | week grid */
    max-height: 600px;
    overflow-y: auto;
}

.time-slots {
    background: #DEE2E5;
    border-right: 1px solid #e5e7eb;
}

.week-number-box {
    background: #f3f4f6;
    color: #374151;
    border-right: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.time-slot {
    height: 60px;
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.75rem;
    color: #6b7280;
    display: flex;
    align-items: center;
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
}

.week-column {
    background: white;
    position: relative;
}

.week-column.non-working {
    background: #fff7f8; /* very subtle */
}

.week-hour {
    height: 60px;
    border-bottom: 1px solid #f3f4f6;
    position: relative;
}

/* Day View */
.day-header {
    padding: 1rem 1.5rem;
    background: #DEE2E5;
    border-bottom: 1px solid #e5e7eb;
}

.day-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.day-content {
    display: grid;
    grid-template-columns: 80px 1fr;
    max-height: 600px;
    overflow-y: auto;
}

.day-grid {
    background: white;
    position: relative;
}

.day-hour {
    height: 60px;
    border-bottom: 1px solid #f3f4f6;
    position: relative;
}

/* Session Cards */
.session-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin: 0.25rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #3b82f6;
    cursor: pointer;
    transition: all 0.3s ease;
    position: absolute;
    left: 4px;
    right: 4px;
    z-index: 1;
}

.session-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.session-card.safety { border-left-color: #10b981; }
.session-card.medical { border-left-color: #EE7527; }
.session-card.survival { border-left-color: #ef4444; }
.session-card.offshore { border-left-color: #8b5cf6; }
.session-card.specialized { border-left-color: #6366f1; }

.session-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.session-time {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.session-instructor {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.session-capacity {
    font-size: 0.75rem;
    font-weight: 500;
}

.session-capacity.available {
    color: #10b981;
}

.session-capacity.full {
    color: #ef4444;
}

.session-capacity.limited {
    color: #EE7527;
}

/* Legend */
.calendar-legend {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    padding: 1rem 1.25rem;
    margin-top: 2rem;
}

.calendar-legend h3 {
    margin: 0 0 1rem 0;
    color: #1f2937;
    font-size: 1.125rem;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-size: 0.875rem;
    color: #6b7280;
}

.legend-item span:last-child {
    display: inline-block;
    line-height: 16px;
}

.legend-color {
    width: 16px;
    height: 16px;
    display: inline-block;
    border-radius: 4px;
}

.legend-color.safety { background: #10b981; }
.legend-color.medical { background: #EE7527; }
.legend-color.survival { background: #ef4444; }
.legend-color.offshore { background: #8b5cf6; }
.legend-color.specialized { background: #6366f1; }

/* History Section */
.history-section {
    padding: 60px 0;
    background: white;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.history-filters {
    background: #DEE2E5;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.filter-row {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.history-list {
    display: grid;
    gap: 1rem;
}

.history-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.history-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.history-item-title {
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.history-item-date {
    color: #6b7280;
    font-size: 0.875rem;
}

.history-item-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.history-pagination {
    text-align: center;
    margin-top: 2rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px rgba(0,0,0,0.15);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

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

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Session Details */
.session-details {
    display: grid;
    gap: 1.5rem;
}

.detail-group {
    display: grid;
    gap: 0.5rem;
}

.detail-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.detail-value {
    color: #6b7280;
}

.detail-value.price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #059669;
}

.detail-value.status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.detail-value.status.available {
    background: #d1fae5;
    color: #065f46;
}

.detail-value.status.full {
    background: #fee2e2;
    color: #991b1b;
}

.detail-value.status.booking_closed {
    background: #fef3c7;
    color: #92400e;
}

/* Registration Form */
.registration-form {
    display: grid;
    gap: 1.5rem;
}

.form-group {
    display: grid;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #374151;
}

.form-group input,
.form-group textarea {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #3A84C5;
    border-color: #3A84C5;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255,255,255,0.9);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-spinner.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.btn-primary {
    background: #3A84C5;
    color: white;
}

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

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-outline {
    background: transparent;
    border: 2px solid #e5e7eb;
    color: #6b7280;
}

.btn-outline:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Duplicate Session Modal */
.duplicate-preview {
    margin-bottom: 12px;
    color: #444;
}


.duplicate-calendar-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

#dupMonthLabel {
    font-weight: 600;
}

.duplicate-calendar-legend {
    font-size: 12px;
    color: #666;
}

.duplicate-calendar-legend .legend-item {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 6px;
    border-radius: 2px;
    vertical-align: middle;
}

.duplicate-calendar-legend .legend-item-label {
    margin: 0 12px 0 0;
}

.duplicate-calendar-legend .legend-item.busy {
    background: #DEE2E5;
}

.duplicate-calendar-legend .legend-item.free {
    background: #10b981;
}

.duplicate-calendar-legend .legend-item.past {
    background: #d1d5db;
}

.duplicate-calendar-legend .legend-item.selected {
    background: #3A84C5;
}

.duplicate-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.dup-day {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.dup-day.disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

.dup-day.busy {
    background: #DEE2E5;
    color: #6b7280;
    cursor: not-allowed;
}

.dup-day.selected {
    outline: 2px solid #3b82f6;
    background: #dbeafe;
}

.dup-weekday {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    margin-bottom: 4px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .calendar-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-controls,
    .calendar-navigation,
    .calendar-actions {
        justify-content: center;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .legend-items {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    /* Enable horizontal scrolling for calendar in mobile */
    .calendar-container {
        overflow-x: auto;
    }
    
    .calendar-weekdays,
    .calendar-grid {
        min-width: 600px; /* Ensure calendar is wide enough to scroll */
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 0.25rem;
    }
    
    .session-indicator {
        font-size: 0.625rem;
        padding: 0.125rem 0.25rem;
    }
    
    /* Week view horizontal scroll */
    .week-header,
    .week-content {
        min-width: 700px;
    }
    
    .week-header {
        grid-template-columns: 60px 60px 1fr;
    }
    .week-content,
    .day-content {
        grid-template-columns: 60px 60px 1fr;
    }
    
    .time-slot {
        height: 40px;
        font-size: 0.625rem;
    }
    
    .week-hour,
    .day-hour {
        height: 40px;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .history-item-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .history-item-details {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .calendar-section,
    .history-section {
        padding: 30px 0;
    }
    
    .view-controls {
        flex-direction: column;
    }
    
    .calendar-weekdays,
    .calendar-grid {
        grid-template-columns: 48px repeat(7, 1fr);
        gap: 0;
    }
    
    .weekday {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .weekday.week-number-header {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 0.125rem;
    }
    
    .calendar-day.has-sessions::after {
        content: '•';
        position: absolute;
        bottom: 0.25rem;
        right: 0.25rem;
        color: #10b981;
        font-size: 1.5rem;
    }
}
