/* CB Timetable - Frontend Styles */

#cb-timetable-form-container {
    max-width: 100%;
    margin: 20px 0;
}

#cb-form-controls {
    background: #f9f9f9;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

#cb-form-controls label {
    display: inline-block;
    margin-right: 15px;
    cursor: pointer;
}

/* Availability grid */
.cb-availability-grid {
    margin: 1.25rem 0;
}

.cb-interactive-grid {
    border-collapse: separate;
    border-spacing: 0.125rem;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    font-size: 0.875rem;
}

.cb-interactive-grid th,
.cb-interactive-grid td {
    border: 1px solid #dee2e6;
    text-align: center;
}

.cb-interactive-grid th {
    background: #f8f9fa;
    font-weight: 600;
    padding: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 0.875rem;
}

.cb-interactive-grid td {
    padding: 0.25rem;
}

/* Grid cells */
.cb-grid-cell {
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s;
    background-color: #ffffff;
    width: 3rem;
    height: 2rem;
    min-width: 2.5rem;
    min-height: 1.75rem;
}

.cb-grid-cell:hover {
    box-shadow: inset 0 0 0 2px #0d6efd;
}

.cb-grid-cell.cb-available {
    background-color: #FFD700;
}

.cb-grid-cell.cb-preferred {
    background-color: #90EE90;
}

.cb-grid-cell.cb-drawing {
    opacity: 0.7;
}

.cb-grid-cell.cb-disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Progress bar */
#cb-progress-bar {
    transition: width 0.3s ease;
}

/* Save message */
#cb-save-message {
    padding: 12px;
    border-radius: 4px;
    display: none;
}

#cb-save-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    display: block;
}

#cb-save-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    display: block;
}

/* Additional weeks toggle */
#cb-additional-weeks {
    margin-top: 20px;
}

/* User timetable display */
#cb-user-timetable-container {
    max-width: 100%;
    margin: 1.25rem 0;
}

#cb-user-timetable-container .cb-timetable-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0.125rem;
    margin: 1rem 0;
    font-size: 0.875rem;
}

#cb-user-timetable-container .cb-timetable-grid th,
#cb-user-timetable-container .cb-timetable-grid td {
    border: 1px solid #dee2e6;
    padding: 0.625rem;
    text-align: center;
}

#cb-user-timetable-container .cb-timetable-grid th {
    background: #0d6efd;
    color: white;
    font-weight: 600;
}

/* Mobile responsiveness */
@media screen and (max-width: 768px) {
    .cb-interactive-grid {
        font-size: 0.75rem;
    }
    
    .cb-grid-cell {
        width: 2.5rem !important;
        height: 1.75rem !important;
        min-width: 2rem !important;
        min-height: 1.5rem !important;
        padding: 0.125rem !important;
    }
    
    .cb-interactive-grid th,
    .cb-interactive-grid td {
        padding: 0.25rem 0.125rem;
        font-size: 0.75rem;
    }
    
    #cb-form-controls {
        padding: 0.875rem 0.625rem;
    }
    
    #cb-mobile-instructions {
        display: block !important;
    }
}

/* Small mobile phones */
@media screen and (max-width: 576px) {
    .cb-interactive-grid {
        font-size: 0.7rem;
    }
    
    .cb-grid-cell {
        width: 2rem !important;
        height: 1.5rem !important;
        min-width: 1.75rem !important;
        min-height: 1.25rem !important;
    }
    
    .cb-interactive-grid th,
    .cb-interactive-grid td {
        padding: 0.2rem 0.1rem;
        font-size: 0.7rem;
    }
    
    #cb-user-timetable-container .cb-timetable-grid th,
    #cb-user-timetable-container .cb-timetable-grid td {
        padding: 0.375rem;
        font-size: 0.75rem;
    }
}

/* Tablets */
@media screen and (min-width: 769px) and (max-width: 992px) {
    .cb-grid-cell {
        width: 2.75rem;
        height: 1.875rem;
    }
}

/* Touch device specific */
@media (hover: none) and (pointer: coarse) {
    .cb-grid-cell:hover {
        box-shadow: none;
    }
    
    #cb-mobile-instructions {
        display: block !important;
    }
}

/* Scroll container */
.cb-grid-scroll-container {
    overflow-x: auto;
    margin: 10px 0;
    -webkit-overflow-scrolling: touch;
}

/* Buttons */
.button {
    display: inline-block;
    padding: 8px 15px;
    margin: 5px 5px 5px 0;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    color: #333;
}

.button:hover {
    background: #e0e0e0;
}

.button-primary {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.button-primary:hover {
    background: #005a87;
    border-color: #005a87;
}

.button-large {
    padding: 10px 20px;
    font-size: 16px;
}
