/* ========================================
   Schedule Grid - CSS Grid based schedule
   ======================================== */

/* ========== Panel kontroli widoku ========== */
.view-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px 15px;
    border-radius: 8px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 6px 12px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.control-group label {
    font-size: 0.85em;
    font-weight: bold;
    color: #555;
    white-space: nowrap;
}

.control-group input[type="range"] {
    width: 80px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.control-group span {
    font-size: 0.8em;
    color: #667eea;
    font-weight: bold;
    min-width: 45px;
    text-align: right;
}

.reset-view-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.reset-view-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Mobile view controls */
@media (max-width: 768px) {
    .view-controls {
        padding: 10px;
        gap: 8px;
    }
    
    .control-group {
        flex: 1 1 calc(50% - 10px);
        min-width: 140px;
        padding: 5px 8px;
    }
    
    .control-group label {
        font-size: 0.75em;
    }
    
    .control-group input[type="range"] {
        width: 60px;
    }
    
    .control-group span {
        font-size: 0.7em;
        min-width: 35px;
    }
    
    .reset-view-btn {
        width: 100%;
        padding: 10px;
    }
}

/* ========== Schedule Grid Container ========== */
.schedule-grid-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
}

.schedule-grid-container:active {
    cursor: grabbing;
}

.schedule-grid-container.dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

.schedule-grid {
    display: grid;
    gap: 1px;
    background: #e0e0e0;
    min-width: max-content;
    border-radius: 8px;
    overflow: hidden;
}

/* Nagłówek z godziną i salami */
.schedule-grid-header {
    display: contents;
}

.grid-header-cell {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 8px;
    font-weight: bold;
    text-align: center;
    font-size: 0.85em;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.grid-header-cell.time-header {
    background: #333;
    min-width: 60px;
}

/* Komórka z godziną */
.grid-time-cell {
    background: #f5f5f5;
    padding: 8px 6px;
    font-weight: bold;
    text-align: center;
    font-size: 0.9em;
    border-right: 2px solid #667eea;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    color: #333;
}

/* Pusta komórka (slot czasowy bez wydarzenia) */
.grid-empty-cell {
    background: white;
    min-height: 40px;
}

/* Wydarzenie w gridzie */
.grid-event {
    padding: 8px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
    position: relative;
}

.grid-event:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 5;
}

.grid-event-title {
    font-weight: bold;
    font-size: 0.85em;
    line-height: 1.2;
    margin-bottom: 4px;
}

.grid-event-time {
    font-size: 0.75em;
    opacity: 0.8;
}

.grid-event-host {
    font-size: 0.7em;
    margin-top: 4px;
    opacity: 0.7;
}

.grid-event-desc {
    font-size: 0.7em;
    margin-top: 4px;
    opacity: 0.8;
    line-height: 1.3;
}

/* Full width events */
.grid-event.full-width {
    text-align: center;
    font-size: 1em;
    border: 2px dashed rgba(0,0,0,0.2);
}

/* Cancelled events */
.grid-event.cancelled {
    opacity: 0.6;
    text-decoration: line-through;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(220, 53, 69, 0.1) 5px,
        rgba(220, 53, 69, 0.1) 10px
    ) !important;
}

.cancelled-badge {
    background: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.65em;
    font-weight: bold;
    margin-bottom: 4px;
    display: inline-block;
    text-decoration: none;
}

/* Setup/Cleanup bars */
.grid-event-setup {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        rgba(255,152,0,0.8),
        rgba(255,152,0,0.8) 5px,
        transparent 5px,
        transparent 10px
    );
}

.grid-event-cleanup {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        rgba(76,175,80,0.8),
        rgba(76,175,80,0.8) 5px,
        transparent 5px,
        transparent 10px
    );
}

/* Multi-event cell (overlapping events) */
.grid-multi-event-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px;
    background: #f0f0f0;
}

.grid-multi-event-cell .grid-event {
    flex: 1;
    min-height: 30px;
}

/* Room color header */
.grid-header-cell.room-header {
    background: var(--room-color, #667eea);
    color: var(--room-text-color, white);
}

/* Day separator */
.grid-day-title {
    grid-column: 1 / -1;
    background: #333;
    color: white;
    padding: 12px 20px;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
}

/* ========================================
   Mobile responsiveness
   ======================================== */

@media (max-width: 900px) {
    .schedule-grid-container {
        padding: 0 5px;
    }
    
    .grid-header-cell {
        padding: 6px 4px;
        font-size: 0.7em;
    }
    
    .grid-time-cell {
        padding: 4px 3px;
        font-size: 0.75em;
        min-width: 45px;
    }
    
    .grid-event {
        padding: 4px;
    }
    
    .grid-event-title {
        font-size: 0.7em;
    }
    
    .grid-event-time {
        font-size: 0.65em;
    }
    
    .grid-event-host,
    .grid-event-desc {
        display: none;
    }
}

@media (max-width: 600px) {
    .grid-header-cell {
        padding: 4px 3px;
        font-size: 0.65em;
        white-space: nowrap;
    }
    
    .grid-time-cell {
        font-size: 0.65em;
        min-width: 35px;
    }
    
    .grid-event-title {
        font-size: 0.6em;
    }
    
    .grid-event-time {
        font-size: 0.55em;
    }
}

/* ========================================
   Print styles
   ======================================== */

@media print {
    .schedule-grid-container,
    .schedule-table-container {
        overflow: visible;
    }
    
    .schedule-grid {
        min-width: 100%;
    }
    
    .grid-header-cell,
    .schedule-table th {
        background: #667eea !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .grid-event,
    .schedule-table .event-cell {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .grid-event:hover,
    .schedule-table .event-cell:hover {
        transform: none;
        box-shadow: none;
    }
}

/* ========================================
   KLASYCZNA TABELA HTML - Schedule Table
   ======================================== */

.schedule-table-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 600px;
}

.schedule-table th,
.schedule-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    vertical-align: top;
}

/* Nagłówek z godzinami */
.schedule-table .time-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    font-size: 0.9em;
    width: 70px;
    min-width: 70px;
    position: sticky;
    left: 0;
    z-index: 10;
}

/* Nagłówki sal */
.schedule-table .room-header {
    font-weight: bold;
    font-size: 0.9em;
    padding: 12px 8px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    min-width: 120px;
}

/* Komórka z godziną */
.schedule-table .time-cell {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: bold;
    font-size: 0.85em;
    color: #495057;
    width: 70px;
    min-width: 70px;
    position: sticky;
    left: 0;
    z-index: 5;
}

/* Pusta komórka */
.schedule-table .empty-cell {
    background: #fafafa;
    min-height: 40px;
}

/* Komórka z wydarzeniem */
.schedule-table .event-cell {
    padding: 10px 8px;
    vertical-align: middle;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.schedule-table .event-cell:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 20;
}

.schedule-table .event-cell .event-title {
    font-weight: bold;
    font-size: 0.95em;
    margin-bottom: 4px;
    line-height: 1.2;
}

.schedule-table .event-cell .event-time {
    font-size: 0.8em;
    opacity: 0.85;
    margin-bottom: 4px;
}

.schedule-table .event-cell .event-host {
    font-size: 0.75em;
    opacity: 0.9;
    margin-top: 4px;
}

/* Full-width event */
.schedule-table .full-width-cell {
    background: linear-gradient(135deg, var(--event-color, #ff69b4) 0%, #ff1493 100%) !important;
    font-weight: bold;
}

/* Cancelled event */
.schedule-table .event-cell.cancelled {
    opacity: 0.6;
    text-decoration: line-through;
}

.schedule-table .cancelled-badge {
    display: inline-block;
    background: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: bold;
    margin-bottom: 4px;
}

/* Day section title */
.day-schedule-section {
    margin-bottom: 30px;
}

.day-schedule-title {
    background: linear-gradient(135deg, #e91e63, #9c27b0);
    color: white;
    padding: 12px 20px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 10px 10px 0 0;
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .schedule-table {
        font-size: 0.85em;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 6px 4px;
    }
    
    .schedule-table .time-header,
    .schedule-table .time-cell {
        width: 55px;
        min-width: 55px;
        font-size: 0.8em;
    }
    
    .schedule-table .room-header {
        min-width: 90px;
        font-size: 0.8em;
    }
    
    .schedule-table .event-cell .event-title {
        font-size: 0.85em;
    }
    
    .schedule-table .event-cell .event-time {
        font-size: 0.7em;
    }
}

@media (max-width: 480px) {
    .schedule-table {
        font-size: 0.75em;
    }
    
    .schedule-table .time-header,
    .schedule-table .time-cell {
        width: 45px;
        min-width: 45px;
    }
    
    .schedule-table .room-header {
        min-width: 70px;
    }
}

/* ========================================
   Simple-DataTables Customization
   ======================================== */

.datatable-wrapper {
    margin: 0;
}

.datatable-top {
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
}

.datatable-search {
    display: flex;
    align-items: center;
    gap: 10px;
}

.datatable-input {
    padding: 10px 15px;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 1em;
    min-width: 250px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.datatable-input:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.datatable-info {
    padding: 10px 15px;
    background: #f8f9fa;
    color: #666;
    font-size: 0.9em;
}

.datatable-container {
    overflow-x: auto;
}

/* Zachowaj nasze style tabeli */
.datatable-table.schedule-table {
    width: 100%;
    border-collapse: collapse;
}

.datatable-table.schedule-table th,
.datatable-table.schedule-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    vertical-align: top;
}

/* Ukryj selector ilości wierszy - nie używamy paginacji */
.datatable-selector {
    display: none;
}

/* Highlight szukanych wyników */
.datatable-table mark {
    background: #ffeb3b;
    padding: 0 2px;
    border-radius: 2px;
}

/* Responsive DataTables */
@media (max-width: 768px) {
    .datatable-input {
        min-width: 150px;
        font-size: 0.9em;
    }
    
    .datatable-top {
        padding: 10px;
    }
}
