/**
 * Event List Styles
 * Responsive table for [veranstaltungen] shortcode
 */

/* Popup Overlay */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.popup-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.popup-content {
    background: #fff;
    border-radius: 8px;
    padding: 40px 30px 30px;
    max-width: 600px;
    width: 100%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
}

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

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 32px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: #000;
}

body.no-scroll {
    overflow: hidden;
}

/* Event List Table */
.vilstaler-event-list {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.vilstaler-event-list tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s ease;
}

.vilstaler-event-list tbody tr:last-child {
    border-bottom: none;
}

.vilstaler-event-list tbody tr:hover {
    background-color: #f8f9fa;
}

.vilstaler-event-list td {
    padding: 16px 12px;
    vertical-align: top;
}

.vilstaler-event-list td:first-child {
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
    width: 15%;
    min-width: 80px;
}

.vilstaler-event-list td:nth-child(2) {
    color: #555;
    width: 24%;
    min-width: 140px;
}

.vilstaler-event-list td:nth-child(3) {
    color: #333;
    width: 61%;
}

/* Event Link Styling */
.event-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
}

.event-link:hover {
    color: #1e3f70;
    border-bottom-color: var(--color-primary);
}

/* Cancelled Events */
.vilstaler-event-list s {
    opacity: 0.6;
    text-decoration: line-through;
}

.vilstaler-event-list .cancelled-notice {
    color: #d32f2f;
    font-weight: 600;
    margin-left: 8px;
}

/* Mobile Responsiveness - Tablets */
@media screen and (max-width: 768px) {
    .vilstaler-event-list td {
        padding: 12px 10px;
    }

    .vilstaler-event-list td:first-child {
        width: 20%;
        font-size: 14px;
    }

    .vilstaler-event-list td:nth-child(2) {
        width: 25%;
        font-size: 14px;
    }

    .vilstaler-event-list td:nth-child(3) {
        width: 55%;
        font-size: 14px;
    }

    .popup-content {
        padding: 30px 20px 20px;
        margin: 10px;
    }
}

/* Mobile Responsiveness - Phones */
@media screen and (max-width: 580px) {
    .vilstaler-event-list {
        box-shadow: none;
        border-radius: 0;
    }

    .vilstaler-event-list tbody tr {
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 20px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .vilstaler-event-list tbody tr:hover {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    }

    .vilstaler-event-list td:last-child {
        border-bottom: none;
    }

    /* Day and Date on same line - spanning full width */
    .vilstaler-event-list td:first-child,
    .vilstaler-event-list td:nth-child(2) {
        background-color: #f8f9fa;
        font-size: 15px;
        padding: 12px 15px;
        border-bottom: none;
    }

    .vilstaler-event-list td:first-child {
        flex: 0 0 auto;
        border-radius: 8px 0 0 0;
        font-weight: 600;
        color: var(--color-primary);
        padding-right: 8px;
    }

    .vilstaler-event-list td:nth-child(2) {
        flex: 1;
        border-radius: 0 8px 0 0;
        color: #666;
        padding-left: 8px;
        border-left: 2px solid #e0e0e0;
    }

    .vilstaler-event-list td:nth-child(3) {
        flex: 1 1 100%;
        font-size: 14px;
        line-height: 1.6;
        padding: 12px 15px 15px;
        border-top: 1px solid #e0e0e0;
    }

    .popup-overlay.active {
        padding: 0;
        align-items: flex-start;
    }

    .popup-content {
        border-radius: 0;
        max-height: 100vh;
        width: 100%;
        margin: 0;
    }

    .close-btn {
        font-size: 36px;
        top: 5px;
        right: 10px;
        background: rgba(255, 255, 255, 0.9);
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }
}

/* Loading Animation */
.event-popup-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
}

.loader-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

.event-popup-loader p {
    margin-top: 20px;
    color: #666;
    font-size: 16px;
    font-weight: 500;
}

/* Popup Content Styling */
.popup-preise {
    line-height: 1.8;
}

.popup-preise h2,
.popup-preise h3 {
    color: var(--color-primary);
    margin-top: 0;
    margin-bottom: 15px;
}

.popup-preise p {
    margin: 10px 0;
    line-height: 1.8;
}

.popup-preise strong {
    color: #333;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .popup-content {
        animation: none;
    }

    .vilstaler-event-list tbody tr,
    .event-link,
    .close-btn {
        transition: none;
    }

    .loader-spinner {
        animation: none;
        border-top-color: var(--color-primary);
        border-right-color: var(--color-primary);
    }
}

/* Registration Button */
.vilstaler-registration-btn-wrapper {
    margin-top: 8px;
    display: inline-block;
}

.vilstaler-registration-btn {
    display: inline-block;
    padding: 6px 14px;
    background-color: transparent;
    color: var(--color-primary);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    font-size: 13px;
    border: 1px solid var(--color-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.vilstaler-registration-btn:hover {
    background-color: var(--color-primary);
    color: #ffffff;
}

.vilstaler-registration-btn:active {
    transform: scale(0.98);
}

/* Disabled button styling */
.vilstaler-registration-btn.disabled {
    background-color: transparent;
    color: #999999;
    border-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.vilstaler-registration-btn.disabled:hover {
    background-color: transparent;
    color: #999999;
    transform: none;
}

/* Mobile responsive button */
@media screen and (max-width: 580px) {
    .vilstaler-registration-btn-wrapper {
        margin-top: 10px;
    }

    .vilstaler-registration-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Print styles */
@media print {
    .popup-overlay {
        display: none !important;
    }

    .vilstaler-event-list {
        box-shadow: none;
    }

    .event-link {
        color: #000;
        border: none;
        text-decoration: underline;
    }

    .vilstaler-registration-btn-wrapper {
        display: none;
    }
}
