/**
 * PBC Tournament Manager - Kalender Styles
 */

/* ==========================================================================
   Kalender Container
   ========================================================================== */

.pbc-tournament-calendar-wrapper {
    position: relative;
    margin: 20px 0;
}

.pbc-tournament-calendar {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 15px;
}

/* ==========================================================================
   Kalender Filter
   ========================================================================== */

.pbc-calendar-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.pbc-calendar-filter .pbc-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s;
}

.pbc-calendar-filter .pbc-filter-btn:hover {
    border-color: #0073aa;
    color: #0073aa;
}

.pbc-calendar-filter .pbc-filter-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.pbc-calendar-filter .pbc-filter-btn.active .filter-color-dot {
    border: 2px solid #fff;
}

.filter-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ==========================================================================
   FullCalendar Overrides
   ========================================================================== */

.pbc-tournament-calendar .fc {
    font-family: inherit;
}

.pbc-tournament-calendar .fc-toolbar-title {
    font-size: 1.4em;
    font-weight: 600;
}

.pbc-tournament-calendar .fc-button {
    background: #0073aa;
    border-color: #0073aa;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background 0.2s;
}

.pbc-tournament-calendar .fc-button:hover {
    background: #005a87;
    border-color: #005a87;
}

.pbc-tournament-calendar .fc-button:disabled {
    background: #ccc;
    border-color: #ccc;
}

.pbc-tournament-calendar .fc-button-primary:not(:disabled).fc-button-active {
    background: #005a87;
    border-color: #005a87;
}

.pbc-tournament-calendar .fc-daygrid-day-number {
    padding: 8px;
    font-weight: 500;
}

.pbc-tournament-calendar .fc-daygrid-day.fc-day-today {
    background: rgba(0, 115, 170, 0.1);
}

.pbc-tournament-calendar .fc-event {
    cursor: pointer;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.8em;
    border: none;
    transition: transform 0.1s, box-shadow 0.1s;
    /* Kompakte einzeilige Darstellung */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    min-height: auto;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.pbc-tournament-calendar .fc-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pbc-tournament-calendar .fc-daygrid-event {
    margin: 2px 4px;
}

/* ==========================================================================
   Kompakte Event-Darstellung: Zeit + Kurzname einzeilig
   ========================================================================== */

/* Kompakter Container */
.pbc-tournament-calendar .pbc-event-compact {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    overflow: hidden;
}

/* Uhrzeit - kompakt, fett */
.pbc-tournament-calendar .pbc-event-time {
    font-weight: 700;
    font-size: 1em;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Titel - einzeilig, abgeschnitten */
.pbc-tournament-calendar .pbc-event-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Fallback für Standard FullCalendar Klassen */
.pbc-tournament-calendar .fc-event-main {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    overflow: hidden;
}

.pbc-tournament-calendar .fc-event-time {
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.pbc-tournament-calendar .fc-event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* DayGrid spezifisch - kompakte Darstellung */
.pbc-tournament-calendar .fc-daygrid-day-events {
    min-height: auto;
}

.pbc-tournament-calendar .fc-daygrid-event-harness {
    margin-bottom: 2px;
}

/* Block-Display kompakt */
.pbc-tournament-calendar .fc-daygrid-block-event .fc-event-main {
    padding: 1px 4px;
}

/* Dot-Events kompakt */
.pbc-tournament-calendar .fc-daygrid-dot-event {
    padding: 2px 6px;
}

.pbc-tournament-calendar .fc-daygrid-dot-event .fc-event-time {
    font-weight: 700;
}

.pbc-tournament-calendar .fc-daygrid-dot-event .fc-event-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Listenansicht */
.pbc-tournament-calendar .fc-list {
    border: 1px solid #ddd;
    border-radius: 8px;
}

.pbc-tournament-calendar .fc-list-day-cushion {
    background: #f8f9fa;
    padding: 10px 15px;
    font-weight: 600;
}

.pbc-tournament-calendar .fc-list-event {
    cursor: pointer;
}

.pbc-tournament-calendar .fc-list-event td {
    padding: 12px 15px;
    vertical-align: middle;
}

.pbc-tournament-calendar .fc-list-event:hover td {
    background: rgba(0, 115, 170, 0.1);
}

.pbc-tournament-calendar .fc-list-event-title {
    font-weight: 500;
    font-size: 1em;
}

.pbc-tournament-calendar .fc-list-event-title a {
    color: inherit;
    text-decoration: none;
}

.pbc-tournament-calendar .fc-list-event-time {
    font-weight: 600;
    color: #333;
}

/* Farbmarkierung in Listenansicht */
.pbc-tournament-calendar .fc-list-event-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* ==========================================================================
   Event Status Farben
   ========================================================================== */

.pbc-calendar-event.pbc-event-registered {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
}

.pbc-calendar-event.pbc-event-waitlist {
    background-color: #ffc107 !important;
    border-color: #ffc107 !important;
    color: #212529 !important;
}

/* ==========================================================================
   Event Popup
   ========================================================================== */

.pbc-calendar-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pbc-popup-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 100%;
    padding: 24px;
    position: relative;
    animation: popupFadeIn 0.2s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pbc-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.pbc-popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

.pbc-popup-title {
    margin: 0 0 16px 0;
    font-size: 1.3em;
    color: #333;
    padding-right: 30px;
}

.pbc-popup-meta {
    margin-bottom: 20px;
}

.pbc-popup-meta p {
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #555;
}

.pbc-popup-meta .dashicons {
    color: #0073aa;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.pbc-popup-meta .value {
    flex: 1;
}

.pbc-popup-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pbc-popup-link {
    flex: 1;
    text-align: center;
    min-width: 120px;
}

/* ==========================================================================
   Add to Calendar Dropdown
   ========================================================================== */

.pbc-add-to-calendar-wrapper {
    margin: 15px 0;
}

.pbc-add-to-calendar-dropdown {
    position: relative;
    display: inline-block;
}

.pbc-add-to-calendar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: border-color 0.2s, background 0.2s;
}

.pbc-add-to-calendar-btn:hover {
    border-color: #0073aa;
    background: #f8f9fa;
}

.pbc-add-to-calendar-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.pbc-add-to-calendar-btn .dashicons-arrow-down-alt2 {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.pbc-calendar-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.pbc-add-to-calendar-dropdown.open .pbc-calendar-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pbc-calendar-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
}

.pbc-calendar-dropdown-menu a:first-child {
    border-radius: 8px 8px 0 0;
}

.pbc-calendar-dropdown-menu a:last-child {
    border-radius: 0 0 8px 8px;
}

.pbc-calendar-dropdown-menu a:hover {
    background: #f5f5f5;
}

/* Calendar Icons */
.pbc-cal-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.pbc-cal-google-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234285f4' d='M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z'/%3E%3Cpath fill='%2334a853' d='M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z'/%3E%3Cpath fill='%23fbbc05' d='M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z'/%3E%3Cpath fill='%23ea4335' d='M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z'/%3E%3C/svg%3E");
}

.pbc-cal-apple-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23333' d='M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z'/%3E%3C/svg%3E");
}

.pbc-cal-outlook-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%230078d4' d='M24 7.387v10.478c0 .23-.08.424-.238.576-.158.154-.352.23-.58.23h-8.547v-6.959l1.6 1.229c.102.086.227.13.377.13.148 0 .277-.044.383-.13l6.62-5.088c.07-.056.14-.106.21-.152.069-.044.168-.066.295-.066h.006v-.006c.182 0 .34.06.475.18.133.12.2.254.2.406h-.001zM24 5.5c0 .196-.045.37-.132.52-.088.152-.21.3-.367.444l-7.318 5.638c-.102.08-.233.117-.393.117h-.012c-.159 0-.29-.038-.393-.117L8.93 7.04v10.27c0 .23.08.422.238.576.159.152.35.23.578.23h13.636c.227 0 .42-.076.58-.23.158-.152.238-.346.238-.576V5.5h-.2zM0 6.99v10.02c0 .333.112.62.336.86.224.24.5.36.824.36h6.35V6.15L.17 6.76c-.113.032-.17.107-.17.23zm7.51 11.24H1.16c-.324 0-.6-.12-.824-.36-.224-.24-.336-.527-.336-.86V6.99c0-.123.057-.198.17-.23l7.34-.61v11.08H7.51zm6.77-13.39L7.51 3.91V.765L21.23.08v4.76h-6.95z'/%3E%3C/svg%3E");
}

.pbc-cal-ics-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23666' d='M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11zM9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z'/%3E%3C/svg%3E");
}

/* Buttons Style */
.pbc-add-to-calendar-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pbc-add-to-calendar-label {
    font-weight: 500;
    color: #555;
    margin-right: 4px;
}

.pbc-cal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

.pbc-cal-btn .pbc-cal-icon {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Mein Kalender
   ========================================================================== */

.pbc-my-calendar-wrapper {
    margin: 20px 0;
}

.pbc-my-calendar-header {
    margin-bottom: 20px;
}

.pbc-my-calendar-header h3 {
    margin: 0 0 15px 0;
}

.pbc-calendar-feed-info {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.pbc-calendar-feed-info p {
    margin: 0 0 10px 0;
}

.pbc-calendar-feed-info .description {
    font-size: 0.9em;
    color: #666;
    margin-top: 10px;
}

.pbc-feed-url-wrapper {
    display: flex;
    gap: 8px;
}

.pbc-feed-url {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    background: #fff;
}

.pbc-copy-feed-url {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
}

.pbc-copy-feed-url .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Legende */
.pbc-calendar-legend {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #555;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-registered .legend-color {
    background: #28a745;
}

.legend-waitlist .legend-color {
    background: #ffc107;
}

/* Login Notice */
.pbc-calendar-login-notice {
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    text-align: center;
    color: #666;
}

/* ==========================================================================
   Kalender Abonnieren
   ========================================================================== */

.pbc-calendar-subscribe {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.pbc-subscribe-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #333;
}

.pbc-subscribe-header .dashicons {
    color: #0073aa;
}

.pbc-subscribe-description {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 0.95em;
}

.pbc-subscribe-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.pbc-subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.pbc-subscribe-btn .pbc-cal-icon {
    font-size: 16px;
}

.pbc-subscribe-google {
    background: #fff;
    color: #4285f4;
    border-color: #4285f4;
}

.pbc-subscribe-google:hover {
    background: #4285f4;
    color: #fff;
}

.pbc-subscribe-apple {
    background: #fff;
    color: #333;
    border-color: #333;
}

.pbc-subscribe-apple:hover {
    background: #333;
    color: #fff;
}

.pbc-subscribe-outlook {
    background: #fff;
    color: #0078d4;
    border-color: #0078d4;
}

.pbc-subscribe-outlook:hover {
    background: #0078d4;
    color: #fff;
}

.pbc-subscribe-url {
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.pbc-subscribe-url label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #666;
}

.pbc-subscribe-hint {
    margin: 15px 0 0 0;
    padding-top: 10px;
    border-top: 1px solid #dee2e6;
}

.pbc-subscribe-hint small {
    color: #888;
    font-style: italic;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .pbc-calendar-filter {
        padding: 10px;
        gap: 6px;
    }

    .pbc-calendar-filter .pbc-filter-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .pbc-tournament-calendar {
        padding: 10px;
    }

    .pbc-tournament-calendar .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .pbc-tournament-calendar .fc-toolbar-title {
        font-size: 1.2em;
    }

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

    .pbc-popup-actions {
        flex-direction: column;
    }

    .pbc-popup-link {
        width: 100%;
    }

    .pbc-add-to-calendar-dropdown {
        width: 100%;
    }

    .pbc-add-to-calendar-btn {
        width: 100%;
        justify-content: center;
    }

    .pbc-calendar-dropdown-menu {
        width: 100%;
    }

    .pbc-feed-url-wrapper {
        flex-direction: column;
    }

    .pbc-feed-url {
        width: 100%;
    }

    .pbc-calendar-legend {
        flex-direction: column;
        gap: 10px;
    }

    /* Kalender-Abo auf Mobile */
    .pbc-calendar-subscribe {
        padding: 15px;
    }

    .pbc-subscribe-buttons {
        flex-direction: column;
    }

    .pbc-subscribe-btn {
        width: 100%;
        justify-content: center;
    }

    /* Events auf Mobilgeräten - kompakt */
    .pbc-tournament-calendar .fc-event {
        padding: 2px 4px;
        font-size: 0.75em;
        min-height: auto;
    }

    .pbc-tournament-calendar .pbc-event-time,
    .pbc-tournament-calendar .fc-event-time {
        font-size: 0.9em;
        font-weight: 700;
    }

    .pbc-tournament-calendar .pbc-event-title,
    .pbc-tournament-calendar .fc-event-title {
        font-size: 0.85em;
    }

    .pbc-tournament-calendar .fc-daygrid-day-events {
        min-height: auto;
    }

    /* Listenansicht auf Mobile */
    .pbc-tournament-calendar .fc-list-event td {
        padding: 10px 12px;
    }

    .pbc-tournament-calendar .fc-list-event-title {
        font-size: 0.95em;
    }
}
