/**
 * Frontend-Styles für WP Termine CalDAV
 * CI: IG T2 – Freunde des VW-Busses 1967–1979 e. V.
 *
 * Primärfarbe Blau: #0077BA (84%)
 * Akzentfarbe Orange: #EF7D00 (16%)
 * Schrift: Nunito (400, 600, 700)
 *
 * @package WP_Termine_CalDAV
 */

/* ==========================================================================
   CSS Custom Properties (CI-Farben)
   ========================================================================== */

:root {
    /* CI-Farben */
    --wptc-primary: #0077BA;
    --wptc-primary-dark: #005a8c;
    --wptc-primary-light: #e6f3fa;
    --wptc-accent: #EF7D00;
    --wptc-accent-dark: #cc6a00;
    --wptc-accent-light: #fff5e6;
    
    /* Text */
    --wptc-text-dark: #222222;
    --wptc-text-medium: #555555;
    --wptc-text-light: #777777;
    
    /* Hintergründe */
    --wptc-bg-white: #ffffff;
    --wptc-bg-light: #f8f9fa;
    --wptc-border: #e0e0e0;
    
    /* Typografie */
    --wptc-font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ==========================================================================
   Termine Liste
   ========================================================================== */

.wptc-termine-shortcode,
.wptc-widget-termine {
    margin: 20px 0;
    font-family: var(--wptc-font-family);
}

.wptc-termine-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wptc-termin-item {
    display: flex;
    flex-direction: column;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    border-left: 4px solid #0077BA !important;
    border-radius: 0 8px 8px 0;
    padding: 15px;
    margin-bottom: 15px;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.wptc-termin-item:hover {
    box-shadow: 0 4px 12px rgba(0, 119, 186, 0.15);
    transform: translateY(-2px);
    border-left-color: #EF7D00 !important;
}

.wptc-termin-item:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   IGT Event Highlighting (VW T2 Bulli)
   ========================================================================== */

/* Hervorgehobene Termine - nur Farben ändern, gleiche Struktur wie normale Termine */
.wptc-termin-item.wptc-igt-event {
    position: relative;
}

.wptc-termin-item.wptc-igt-event::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 50px 50px 0;
    border-top-right-radius: 8px;
    z-index: 1;
}

.wptc-termin-item.wptc-igt-event::after {
    content: attr(data-highlight-label);
    position: absolute;
    top: 4px;
    right: 0px;
    width: 40px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    line-height: 1;
    pointer-events: none;
    transform: rotate(45deg);
    text-align: center;
}

.wptc-igt-badge {
    display: block;
    margin-bottom: 5px;
}

.wptc-bulli-icon {
    width: 50px;
    height: auto;
    display: block;
    margin: 0 auto 5px;
    /* SVG wird über dynamisches CSS eingefärbt */
}

/* SVG-Icon Farbsteuerung (Standard-Farbe als Fallback) */
.wptc-bulli-icon,
.wptc-highlight-svg {
    color: var(--wptc-accent); /* Fallback auf CI-Orange */
}

/* Dynamische Farbe wird via Inline-CSS in wp-termine-caldav.php injiziert */

/* Termin Header */
.wptc-termin-header {
    display: flex;
    gap: 15px;
}

.wptc-termin-date {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--wptc-primary);
    color: #ffffff;
    border-radius: 8px;
    padding: 12px;
    min-width: 70px;
    text-align: center;
}

.wptc-termin-date .wptc-day {
    display: block;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.wptc-termin-date .wptc-month {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    opacity: 0.95;
}

.wptc-termin-date .wptc-year {
    display: block;
    font-size: 11px;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 2px;
}

/* Widget: Kompakte Datumsanzeige */
.wptc-widget-termine .wptc-termin-date {
    min-width: 60px;
    padding: 10px;
}

.wptc-widget-termine .wptc-termin-date .wptc-day {
    font-size: 24px;
}

.wptc-widget-termine .wptc-termin-date .wptc-month {
    font-size: 11px;
}

.wptc-widget-termine .wptc-termin-date .wptc-year {
    font-size: 10px;
}

.wptc-widget-termine .wptc-termin-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #0077BA !important;
}

/* Termin Informationen */
.wptc-termin-info {
    flex: 1;
}

.wptc-termin-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    color: #0077BA !important;
    line-height: 1.4;
    font-family: var(--wptc-font-family);
}

.wptc-termin-time,
.wptc-termin-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 400;
    color: var(--wptc-text-medium);
    margin-bottom: 5px;
    line-height: 1.5;
}

.wptc-termin-time .dashicons,
.wptc-termin-location .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
    color: var(--wptc-accent);
}

/* Navigation-Link für Standort */
.wptc-location-link {
    color: #ef7d00;
    text-decoration: none !important;
    transition: color 0.2s ease;
}

.wptc-location-link:hover {
    color: var(--wptc-accent) !important;
    text-decoration: underline !important;
}

.wptc-location-link .dashicons-external {
    font-size: 12px;
    width: 12px;
    height: 12px;
    vertical-align: middle;
    margin-left: 2px;
    opacity: 0.7;
}

.wptc-termin-description {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--wptc-border);
    font-size: 14px;
    font-weight: 400;
    color: var(--wptc-text-dark);
    line-height: 1.7;
}

.wptc-termin-description p {
    margin: 0 0 10px 0;
}

.wptc-termin-description p:last-child {
    margin-bottom: 0;
}

/* Ausklappbare Beschreibung */
.wptc-termin-description-toggle {
    margin-top: 10px;
}

.wptc-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid var(--wptc-primary);
    color: var(--wptc-primary);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--wptc-font-family);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.wptc-toggle-btn .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
    transition: transform 0.3s ease;
}

.wptc-termin-description-toggle.is-open .wptc-toggle-btn .dashicons {
    transform: rotate(180deg);
}

.wptc-termin-description.wptc-collapsible {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    transition: all 0.3s ease;
}

.wptc-termin-description-toggle.is-open .wptc-termin-description.wptc-collapsible {
    max-height: 500px;
    opacity: 1;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--wptc-border);
}

/* Keine Termine */
.wptc-no-events {
    padding: 25px 20px;
    text-align: center;
    background: var(--wptc-bg-light);
    border: 2px dashed var(--wptc-border);
    border-radius: 8px;
    color: var(--wptc-text-light);
    font-size: 14px;
    font-weight: 400;
    font-style: italic;
}

/* ==========================================================================
   Kalenderansicht
   ========================================================================== */

.wptc-calendar {
    margin: 20px 0;
    background: var(--wptc-bg-white);
    border: 1px solid var(--wptc-border);
    border-radius: 8px;
    padding: 20px;
    font-family: var(--wptc-font-family);
}

.wptc-calendar-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--wptc-primary);
}

.wptc-calendar-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--wptc-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wptc-calendar-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.wptc-calendar-table thead th {
    padding: 12px 5px;
    background: var(--wptc-primary);
    color: #ffffff;
    font-weight: 600;
    text-align: center;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.wptc-calendar-table thead th:first-child {
    border-radius: 6px 0 0 0;
}

.wptc-calendar-table thead th:last-child {
    border-radius: 0 6px 0 0;
}

.wptc-calendar-table td {
    padding: 8px 5px;
    vertical-align: top;
    border: 1px solid var(--wptc-border);
    height: 100px;
    position: relative;
}

.wptc-calendar-empty {
    background: var(--wptc-bg-light);
}

.wptc-calendar-day {
    background: var(--wptc-bg-white);
    transition: background-color 0.2s ease;
}

.wptc-calendar-day:hover {
    background: var(--wptc-primary-light);
}

.wptc-calendar-day.is-today {
    background: var(--wptc-accent-light);
    border-color: var(--wptc-accent);
}

.wptc-calendar-day.has-events {
    background: var(--wptc-primary-light);
}

.wptc-day-number {
    font-weight: 700;
    color: var(--wptc-text-dark);
    margin-bottom: 5px;
    font-size: 14px;
}

.wptc-calendar-day.is-today .wptc-day-number {
    color: var(--wptc-accent);
}

.wptc-day-events {
    font-size: 11px;
}

.wptc-day-event {
    padding: 3px 5px;
    margin-bottom: 2px;
    background: var(--wptc-primary);
    color: #ffffff;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
    font-weight: 400;
}

.wptc-day-event:hover {
    background: var(--wptc-primary-dark);
}

.wptc-event-time {
    font-weight: 600;
    margin-right: 3px;
}

.wptc-event-title {
    opacity: 0.95;
}

/* ==========================================================================
   Kalender-Abonnement Link
   ========================================================================== */

.wptc-subscribe {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--wptc-border);
    text-align: center;
}

.wptc-subscribe-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--wptc-accent);
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--wptc-font-family);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.wptc-subscribe-link:hover {
    background: var(--wptc-accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 125, 0, 0.35);
    color: #ffffff !important;
    text-decoration: none !important;
}

.wptc-subscribe-icon {
    font-size: 16px;
}

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

@media (max-width: 768px) {
    .wptc-termin-header {
        flex-direction: row;
        gap: 12px;
    }
    
    .wptc-termin-date {
        min-width: 60px;
        padding: 10px;
    }
    
    .wptc-termin-date .wptc-day {
        font-size: 24px;
    }
    
    .wptc-termin-title {
        font-size: 16px;
    }
    
    .wptc-calendar-table td {
        height: 80px;
        font-size: 11px;
    }
    
    .wptc-day-event {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .wptc-calendar-table thead th {
        font-size: 11px;
        padding: 8px 3px;
    }
    
    .wptc-calendar-table td {
        height: 60px;
        padding: 4px 2px;
    }
    
    .wptc-day-number {
        font-size: 12px;
    }
    
    .wptc-day-events {
        font-size: 9px;
    }
    
    .wptc-day-event {
        padding: 2px 3px;
    }
    
    .wptc-event-time {
        display: none;
    }
    
    .wptc-subscribe-link {
        padding: 10px 18px;
        font-size: 13px;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .wptc-termin-item {
        background: #2a2a2a !important;
        border-color: #404040 !important;
        border-left-color: #0077BA !important;
    }

    .wptc-termin-item:hover {
        border-left-color: #EF7D00 !important;
    }

    /* Hervorgehobene Termine werden durch dynamisches CSS gesteuert (siehe wp-termine-caldav.php) */

    .wptc-termin-title {
        color: #4da6d9 !important; /* Helleres Blau für Dark Mode */
    }

    .wptc-termin-time,
    .wptc-termin-location {
        color: #b0b0b0 !important;
    }

    .wptc-termin-description {
        color: #e0e0e0 !important;
        border-top-color: #404040 !important;
    }

    .wptc-calendar {
        background: #2a2a2a !important;
        border-color: #404040 !important;
    }

    .wptc-calendar-header h3 {
        color: #4da6d9 !important;
    }

    .wptc-calendar-table td {
        border-color: #404040 !important;
    }

    .wptc-calendar-day {
        background: #2a2a2a !important;
    }

    .wptc-calendar-day:hover {
        background: #1a3a4d !important;
    }

    .wptc-calendar-empty {
        background: #1e1e1e !important;
    }

    .wptc-day-number {
        color: #e0e0e0 !important;
    }

    .wptc-no-events {
        background: #2a2a2a !important;
        border-color: #404040 !important;
        color: #888888 !important;
    }

    .wptc-subscribe {
        border-top-color: #404040 !important;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .wptc-termin-item {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        border-left-color: #0077BA;
    }
    
    .wptc-termin-item:hover {
        transform: none;
    }
    
    .wptc-termin-date {
        background: #0077BA !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .wptc-termin-title {
        color: #0077BA !important;
    }
    
    .wptc-subscribe {
        display: none;
    }
    
    .wptc-calendar-table thead th {
        background: #0077BA !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
