/* OFC Kalendarz Grup M2026 - Grid Calendar Styles */

.ofc-kalendarz-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.ofc-kalendarz-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.ofc-kalendarz-header h2 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 2rem;
    font-weight: 600;
}

.last-updated {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
    font-style: italic;
}

/* Calendar Grid Layout */
.ofc-calendar-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ofc-calendar-grid {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    min-width: 800px;
    background: white;
}

/* Header Row */
.ofc-calendar-header-row {
    display: contents;
}

.ofc-time-column-header {
    background: #34495e;
    color: white;
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    border-right: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 10;
}

.ofc-day-header-cell {
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    position: sticky;
    top: 0;
    z-index: 9;
}

.ofc-day-header-cell:last-child {
    border-right: none;
}

/* Calendar Rows */
.ofc-calendar-row {
    display: contents;
}

.ofc-time-cell {
    background: #f8f9fa;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #eee;
    padding: 0;
    position: relative;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ofc-hour-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.ofc-day-cell {
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    position: relative;
    height: 60px;
    background: #fafbfc;
    transition: background-color 0.2s ease;
    overflow: visible; /* Allow overlapping events to be visible */
}

.ofc-day-cell:hover {
    background: #f0f1f2;
}

.ofc-day-cell:last-child {
    border-right: none;
}

/* Course Blocks */
.ofc-course-block {
    position: absolute;
    top: 0;
    border-radius: 6px;
    padding: 4px 6px;
    color: white;
    font-size: 0.75rem;
    line-height: 1.2;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 5;
    margin: 1px; /* Small margin to prevent touching edges */
    box-sizing: border-box;
}

.ofc-course-block:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.ofc-course-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.ofc-course-title {
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ofc-course-group {
    font-weight: 500;
    font-size: 0.75rem;
    margin-bottom: 1px;
    opacity: 0.9;
}

.ofc-course-type {
    font-weight: 400;
    font-size: 0.7rem;
    margin-bottom: 1px;
    opacity: 0.85;
    font-style: italic;
}

.ofc-course-time-range {
    font-size: 0.7rem;
    opacity: 0.8;
    margin-bottom: 1px;
}

.ofc-course-instructor {
    font-size: 0.65rem;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.ofc-course-link,
.ofc-course-no-link {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    text-decoration: none;
    color: white;
    transition: background-color 0.2s ease;
}

.ofc-course-link:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
}

/* Search and Filter Controls */
.ofc-search-container, .ofc-filter-container {
    margin-bottom: 20px;
    text-align: center;
}

.ofc-search-container input {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    width: 100%;
    max-width: 400px;
    font-size: 16px;
}

.ofc-search-container button, .ofc-filter-container button {
    margin-left: 10px;
    padding: 10px 15px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.ofc-filter-container select {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    margin-right: 10px;
}

/* Narrow blocks for overlapping events */
.narrow-block .ofc-course-title {
    font-size: 0.7rem;
}

.narrow-block .ofc-course-group,
.narrow-block .ofc-course-type {
    font-size: 0.65rem;
}

.narrow-block .ofc-course-time-range,
.narrow-block .ofc-course-instructor {
    font-size: 0.6rem;
}

.narrow-block .ofc-course-link,
.narrow-block .ofc-course-no-link {
    width: 12px;
    height: 12px;
    font-size: 8px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .ofc-calendar-grid {
        min-width: 900px;
    }
    
    .ofc-course-block {
        font-size: 0.7rem;
    }
    
    .ofc-course-title {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .ofc-kalendarz-container {
        padding: 15px;
    }
    
    .ofc-kalendarz-header h2 {
        font-size: 1.5rem;
    }
    
    .ofc-calendar-grid {
        min-width: 100%;
        grid-template-columns: 60px repeat(7, minmax(80px, 1fr));
    }
    
    .ofc-time-column-header,
    .ofc-day-header-cell {
        padding: 10px 5px;
        font-size: 0.8rem;
    }
    
    .ofc-day-cell {
        height: 50px;
    }
    
    .ofc-time-cell {
        height: 50px;
    }
    
    .ofc-course-block {
        font-size: 0.65rem;
        padding: 3px 4px;
    }
    
    .ofc-course-title {
        font-size: 0.7rem;
    }
    
    .ofc-course-group,
    .ofc-course-type {
        font-size: 0.65rem;
    }
    
    .ofc-course-time-range {
        font-size: 0.6rem;
    }
    
    .ofc-course-instructor {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .ofc-kalendarz-container {
        padding: 10px;
    }
    
    .ofc-calendar-grid {
        grid-template-columns: 50px repeat(7, minmax(70px, 1fr));
    }
    
    .ofc-time-column-header,
    .ofc-day-header-cell {
        padding: 8px 3px;
        font-size: 0.7rem;
    }
    
    .ofc-day-cell {
        height: 45px;
    }
    
    .ofc-time-cell {
        height: 45px;
    }
    
    .ofc-hour-label {
        font-size: 0.7rem;
    }
    
    .ofc-course-block {
        font-size: 0.6rem;
        padding: 2px 3px;
    }
    
    .ofc-course-title {
        font-size: 0.65rem;
    }
    
    .ofc-course-group {
        display: none; /* Ukryj grupę na bardzo małych ekranach */
    }
    
    .ofc-course-type {
        font-size: 0.6rem;
    }
    
    .ofc-course-time-range {
        font-size: 0.6rem;
    }
    
    .ofc-course-instructor {
        font-size: 0.55rem;
    }
    
    .ofc-course-link,
    .ofc-course-no-link {
        width: 12px;
        height: 12px;
        font-size: 7px;
    }
}

/* Print styles */
@media print {
    .ofc-kalendarz-container {
        max-width: none;
        margin: 0;
        padding: 10px;
    }
    
    .ofc-search-container,
    .ofc-filter-container {
        display: none !important;
    }
    
    .ofc-calendar-grid {
        min-width: 100%;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .ofc-course-block {
        background: #f0f0f0 !important;
        color: #000 !important;
        border: 1px solid #666 !important;
    }
    
    .ofc-day-header-cell {
        background: #ddd !important;
        color: #000 !important;
    }
    
    .ofc-time-column-header {
        background: #ccc !important;
        color: #000 !important;
    }
}

/* Animation for loading */
.ofc-kalendarz-container.loading {
    opacity: 0.6;
}

.ofc-kalendarz-container.loaded {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Focus styles for accessibility */
.ofc-course-block:focus,
.ofc-course-link:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ofc-course-block {
        border: 2px solid #000 !important;
    }
    
    .ofc-day-header-cell {
        background: #000 !important;
        color: #fff !important;
    }
    
    .ofc-time-column-header {
        background: #000 !important;
        color: #fff !important;
    }
}

/* Tooltip for course details on hover */
.ofc-course-block {
    position: relative;
}

.ofc-course-block:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease-in-out forwards;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(5px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Day cells with multiple overlapping events */
.ofc-day-cell[data-max-overlaps="2"] {
    min-width: 120px;
}

.ofc-day-cell[data-max-overlaps="3"] {
    min-width: 150px;
}

.ofc-day-cell[data-max-overlaps="4"] {
    min-width: 180px;
}

.ofc-day-cell[data-max-overlaps="5"] {
    min-width: 210px;
}