/**
 * PLANK Timetable - Ultramodern Styles
 * Soft, elegant, modern design with smooth animations
 */

:root {
    --plank-primary: #e63946;
    --plank-soft-pink: #fdf2f4;
    --plank-soft-blue: #f0f9ff;
    --plank-soft-gray: #f8f9fa;
    --plank-dark: #1f2937;
    --plank-gray: #6b7280;
    --plank-light-gray: #e5e7eb;
    --plank-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --plank-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --plank-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --plank-radius-sm: 6px;
    --plank-radius-md: 10px;
    --plank-radius-lg: 16px;
}

/* ============================================
   WRAPPER & CONTAINER
   ============================================ */

.plank-timetable-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ============================================
   FILTER TABS
   ============================================ */

.plank-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 30px;
    position: relative;
}

/* Desktop tabovi */
.plank-tab {
    flex: 1;
    min-width: 120px;
    padding: 14px 24px;
    background: #ffffff;
    border: none;
    border-radius: var(--plank-radius-md);
    color: var(--plank-dark);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--plank-shadow-sm);
}

.plank-tab:hover {
    color: var(--plank-dark);
    background: #ffffff;
    transform: translateY(-2px);
}

.plank-tab.active {
    background: #ffffff;
    color: var(--plank-primary);
    box-shadow: var(--plank-shadow-sm);
    font-weight: 600;
}

/* Mobile dropdown toggle button */
.plank-filter-toggle {
    display: none;
    width: 100%;
    padding: 14px 20px;
    background: #ffffff;
    border: none;
    border-radius: var(--plank-radius-md);
    color: var(--plank-dark);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--plank-shadow-sm);
    align-items: center;
    justify-content: space-between;
    text-align: left;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.plank-filter-toggle-arrow {
    transition: transform 0.3s ease;
    font-size: 12px;
    color: var(--plank-primary);
}

.plank-filter-toggle.open .plank-filter-toggle-arrow {
    transform: rotate(180deg);
}

/* Mobile dropdown container */
.plank-filter-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: #ffffff;
    border-radius: var(--plank-radius-md);
    box-shadow: var(--plank-shadow-lg);
    z-index: 100;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-overflow-scrolling: touch;
}

.plank-filter-dropdown.open {
    max-height: 400px;
    overflow-y: auto;
}

.plank-filter-dropdown .plank-tab {
    width: 100%;
    flex: none;
    border-radius: 0;
    box-shadow: none;
    border-bottom: 1px solid var(--plank-light-gray);
    transform: none !important;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.plank-filter-dropdown .plank-tab:first-child {
    border-top-left-radius: var(--plank-radius-md);
    border-top-right-radius: var(--plank-radius-md);
}

.plank-filter-dropdown .plank-tab:last-child {
    border-bottom-left-radius: var(--plank-radius-md);
    border-bottom-right-radius: var(--plank-radius-md);
    border-bottom: none;
}

.plank-filter-dropdown .plank-tab:hover {
    background: var(--plank-soft-gray);
}

.plank-filter-dropdown .plank-tab.active {
    background: var(--plank-soft-pink);
    color: var(--plank-primary);
    font-weight: 700;
}


/* ============================================
   LOCATION FILTERS (CHECKBOXES)
   ============================================ */

.plank-location-filters {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, var(--plank-soft-pink) 0%, var(--plank-soft-blue) 100%);
    border-radius: var(--plank-radius-lg);
    box-shadow: var(--plank-shadow-sm);
}

.plank-location-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--plank-radius-md);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.plank-location-checkbox:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
    box-shadow: var(--plank-shadow-sm);
}

.plank-location-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--plank-primary);
}

.plank-location-checkbox span {
    font-size: 15px;
    font-weight: 500;
    color: var(--plank-dark);
}

/* ============================================
   LOCATION TABLE SECTION
   ============================================ */

.plank-timetable-location {
    margin-bottom: 80px;
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.plank-timetable-location.hidden {
    display: none;
}

/* Filter tabovi za svaku lokaciju - malo manji razmak */
.plank-timetable-location .plank-filter-tabs {
    margin-bottom: 20px;
}

.plank-location-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--plank-dark);
    margin-bottom: 20px;
    padding-bottom: 15px;
    position: relative;
}

/* ============================================
   TABLE CONTAINER
   ============================================ */

.plank-table-scroll {
    overflow-x: auto;
    border-radius: var(--plank-radius-lg);
    box-shadow: var(--plank-shadow-md);
    background: var(--plank-table-bg, #ffffff);
}

.plank-timetable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
    margin: 0 !important;
    table-layout: fixed;
}

/* ============================================
   TABLE HEADER
   ============================================ */

.plank-timetable thead th {
    background: var(--plank-header-bg, #f9fafb);
    color: var(--plank-dark);
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 20px 16px;
    text-align: center !important;
    border-bottom: 2px solid var(--plank-border-color, #e5e7eb);
    position: sticky;
    top: 0;
    z-index: 10;
}

.plank-timetable thead th:first-child {
    border-top-left-radius: var(--plank-radius-lg);
    text-align: center !important;
    width: 80px;
    min-width: 80px;
    max-width: 80px;
}

.plank-timetable thead th:not(:first-child) {
    width: calc((100% - 80px) / 6);
}

.plank-timetable thead th:last-child {
    border-top-right-radius: var(--plank-radius-lg);
}

/* ============================================
   TABLE BODY CELLS
   ============================================ */

.plank-timetable tbody tr {
    transition: background 0.2s ease;
}

.plank-timetable tbody tr:hover {
    background: var(--plank-soft-gray);
}

.plank-timetable tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--plank-border-color, #e5e7eb);
    border-right: 1px solid var(--plank-border-color, #e5e7eb);
    vertical-align: top;
    min-height: var(--plank-row-height, 80px);
    height: var(--plank-row-height, 80px);
    position: relative;
}

.plank-timetable tbody td:first-child {
    border-left: 1px solid var(--plank-border-color, #e5e7eb);
}

.plank-time-cell {
    font-weight: 600;
    color: var(--plank-gray);
    font-size: 14px;
    white-space: nowrap;
    background: var(--plank-soft-gray);
    position: sticky;
    left: 0;
    z-index: 5;
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    text-align: center;
}

.plank-timetable tbody td:not(.plank-time-cell) {
    width: calc((100% - 80px) / 6);
}

.plank-event-cell {
    padding: 0;
    position: relative;
    overflow: visible;
}

/* Poseban stil za pozicionirane ćelije */
.plank-event-cell-positioned {
    position: relative;
    height: var(--plank-row-height, 80px);
}

/* ============================================
   EVENT CARDS
   ============================================ */

.plank-event {
    height: 100%;
    border-radius: var(--plank-border-radius, 8px);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--plank-shadow-sm);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    z-index: 1;
}

/* Pozicionirani eventi (sa točnim vremenom) */
.plank-event-positioned {
    position: absolute;
    left: 0;
    right: 0;
    padding: 8px;
    min-height: 50px;
}

.plank-event:hover {
    transform: scale(1.05);
    box-shadow: var(--plank-shadow-lg);
    z-index: 15;
}

.plank-event-content {
    text-align: center;
    position: relative;
    z-index: 1;
    width: 100%;
}

.plank-event-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--plank-event-text, #ffffff);
    margin-bottom: 6px;
    line-height: 1.1;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.plank-event-time {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.3px;
    line-height: 1.1;
}

/* ============================================
   MODAL POPUP
   ============================================ */

body.plank-modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

html:has(body.plank-modal-open) {
    overflow: hidden !important;
}

.plank-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    overflow: hidden;
    touch-action: none;
}

.plank-modal.active {
    display: flex;
}

.plank-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
    overflow: hidden;
    touch-action: none;
}

.plank-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: var(--plank-radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 40px;
    box-shadow: var(--plank-shadow-lg);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.plank-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--plank-soft-gray);
    border-radius: 50%;
    font-size: 24px;
    color: var(--plank-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
}

.plank-modal-close:hover {
    background: var(--plank-primary);
    color: #ffffff;
    transform: rotate(90deg);
}

.plank-modal-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--plank-dark);
    margin-bottom: 20px;
    line-height: 1.2;
    padding-right: 40px;
}

.plank-modal-body {
    font-size: 16px;
    line-height: 1.8;
    color: var(--plank-dark);
}

.plank-modal-body p {
    margin-bottom: 16px;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .plank-timetable-wrapper {
        padding: 30px 15px;
    }

    .plank-location-title {
        font-size: 24px;
    }

    /* Prebaci na dropdown za tablet i mobile */
    .plank-filter-tabs {
        flex-direction: column;
        gap: 0;
    }

    /* Sakrij desktop tabove na mobile */
    .plank-filter-tabs > .plank-tab {
        display: none;
    }

    /* Prikaži toggle button */
    .plank-filter-toggle {
        display: flex;
    }

    /* Prikaži dropdown container */
    .plank-filter-dropdown {
        display: block;
    }
}

@media (max-width: 768px) {
    .plank-location-filters {
        flex-direction: column;
        gap: 12px;
    }

    .plank-timetable thead th {
        padding: 16px 12px;
        font-size: 12px;
    }

    .plank-event-title {
        font-size: 13px;
    }

    .plank-event-time {
        font-size: 11px;
    }

    .plank-modal-content {
        padding: 30px 20px;
    }

    .plank-modal-title {
        font-size: 24px;
    }

    .plank-modal-body {
        font-size: 15px;
    }

    /* Improved touch targets for iPhone */
    .plank-filter-toggle {
        padding: 16px 20px;
        font-size: 16px;
        -webkit-tap-highlight-color: transparent;
    }

    .plank-filter-dropdown .plank-tab {
        padding: 16px 20px;
        -webkit-tap-highlight-color: transparent;
    }
}

@media (max-width: 480px) {
    .plank-timetable-wrapper {
        padding: 20px 10px;
    }

    .plank-location-title {
        font-size: 20px;
    }

    .plank-event {
        padding: 8px;
    }

    .plank-event-title {
        font-size: 12px;
    }

    .plank-event-time {
        font-size: 10px;
    }

    /* Extra large touch targets for iPhone */
    .plank-filter-toggle {
        padding: 18px 20px;
        min-height: 50px;
    }

    .plank-filter-dropdown .plank-tab {
        padding: 18px 20px;
        min-height: 50px;
    }

    .plank-filter-toggle-arrow {
        font-size: 14px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .plank-filter-tabs,
    .plank-location-filters {
        display: none;
    }

    .plank-event:hover {
        transform: none;
        box-shadow: none;
    }
}
