/**
 * Sendeplan - Frontend Styles
 * RadioPlan24 - www.radioplan24.de
 */

.com-sendeplan {
    --sp-dark: #2c3e50;
    --sp-darker: #1a252f;
    --sp-accent: #e8731a;
    --sp-text: #333333;
    --sp-text-light: #666666;
    --sp-bg: #ffffff;
    --sp-border: #e0e0e0;
    --sp-row-alt: #f8f9fa;
    max-width: 1100px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Verdana, sans-serif;
    font-size: 14px;
    color: var(--sp-text);
}

/* Reset template image overrides - nur Moderatorbilder */
.com-sendeplan img.sp-bild {
    width: 120px !important;
    height: 120px !important;
    max-width: 120px !important;
    max-height: 120px !important;
    object-fit: cover !important;
    display: block;
}

/* ===== Tab-Navigation ===== */
.sp-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.sp-tab {
    flex: 1;
    min-width: 100px;
    padding: 10px 8px;
    border: 1px solid var(--sp-border);
    border-bottom: none;
    background: #f0f0f0;
    color: var(--sp-text);
    text-align: center;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.3;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.sp-tab:hover {
    background: #e0e0e0;
}

.sp-tab.active {
    background: var(--sp-dark);
    color: #ffffff;
    border-color: var(--sp-dark);
}

.sp-tab-name {
    font-weight: 700;
    font-size: 13px;
}

.sp-tab-datum {
    font-size: 12px;
    opacity: 0.8;
}

/* ===== Tag-Container ===== */
.sp-day {
    display: none;
    border: 1px solid var(--sp-border);
    border-top: none;
}

.sp-day.active {
    display: block;
    animation: spFadeIn 0.25s ease;
}

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

/* ===== Spaltenüberschriften ===== */
.com-sendeplan .sp-header {
    display: flex;
    background: var(--sp-darker);
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    border-bottom: 2px solid var(--sp-accent);
}

.com-sendeplan .sp-header .sp-col-zeit {
    padding: 10px 16px;
}

.com-sendeplan .sp-header .sp-col-sendung {
    padding: 10px 16px;
}

.com-sendeplan .sp-header .sp-col-moderator {
    padding: 10px 16px;
    text-align: right;
}

/* ===== Spalten-Layout ===== */
.com-sendeplan .sp-col-zeit {
    width: 160px;
    min-width: 130px;
    flex-shrink: 0;
}

.com-sendeplan .sp-col-sendung {
    flex: 1;
    min-width: 0;
}

.com-sendeplan .sp-col-moderator {
    width: 160px;
    min-width: 100px;
    flex-shrink: 0;
    text-align: right;
    overflow: hidden;
}

/* ===== Sendungs-Zeile ===== */
.com-sendeplan .sp-row {
    display: flex;
    padding: 18px 16px;
    border-bottom: 1px solid var(--sp-border);
    align-items: flex-start;
    transition: background 0.15s ease;
}

.com-sendeplan .sp-row:nth-child(odd) {
    background: var(--sp-bg);
}

.com-sendeplan .sp-row:nth-child(even) {
    background: var(--sp-row-alt);
}

.com-sendeplan .sp-row:hover {
    background: #f0f4ff;
}

.com-sendeplan .sp-row:last-child {
    border-bottom: none;
}

/* Zeit */
.sp-zeit {
    font-size: 14px;
    color: var(--sp-text-light);
    white-space: nowrap;
    line-height: 1.6;
}

/* Titel */
.sp-titel {
    margin: 0 0 4px 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--sp-text);
    line-height: 1.3;
}

/* Moderator-Name */
.sp-moderator-name {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--sp-text);
}

.sp-moderator-name strong {
    font-weight: 700;
}

/* Beschreibung */
.sp-beschreibung {
    font-size: 13px;
    color: var(--sp-text-light);
    line-height: 1.6;
    margin-bottom: 6px;
}

.sp-beschreibung p {
    margin: 0 0 6px 0;
}

/* Kategorie */
.sp-kategorie {
    display: inline-block;
    padding: 2px 10px;
    background: var(--sp-dark);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Moderator-Bild */
.com-sendeplan .sp-bild {
    border-radius: 4px;
    border: 2px solid var(--sp-border);
}

/* Leerer Tag */
.sp-leer {
    padding: 40px 20px;
    text-align: center;
    color: var(--sp-text-light);
    font-style: italic;
}

/* ===== Footer ===== */
.sp-footer {
    text-align: center;
    padding: 12px 0 4px;
    margin-top: 12px;
    font-size: 11px;
    color: var(--sp-text-light);
    border-top: 1px solid var(--sp-border);
}

.sp-footer a {
    color: var(--sp-accent);
    text-decoration: none;
    font-weight: 700;
}

.sp-footer a:hover {
    text-decoration: underline;
}

/* ===== On Air ===== */
.com-sendeplan .sp-row.sp-on-air {
    background: linear-gradient(90deg, rgba(232,115,26,0.08) 0%, rgba(232,115,26,0.02) 100%) !important;
    border-left: 4px solid #e8731a;
    position: relative;
}

.sp-on-air-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #c0392b;
    color: #fff;
    font-weight: 700;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-left: 8px;
    vertical-align: middle;
    animation: spOnAirFade 2s ease-in-out infinite;
}

.sp-on-air-dot {
    width: 7px;
    height: 7px;
    background: #ff4444;
    border-radius: 50%;
    animation: spOnAirPulse 1.2s ease-in-out infinite;
}

@keyframes spOnAirPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,68,68,0.6); }
    50% { opacity: 0.6; box-shadow: 0 0 0 5px rgba(255,68,68,0); }
}

@keyframes spOnAirFade {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* ===== laut.fm Integration ===== */
.sp-loading {
    padding: 30px 20px;
    text-align: center;
    color: var(--sp-text-light);
    font-size: 14px;
}

.sp-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--sp-border);
    border-top-color: var(--sp-accent);
    border-radius: 50%;
    animation: spSpin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spSpin {
    to { transform: rotate(360deg); }
}

.sp-error {
    color: #c0392b;
    font-style: italic;
}

.sp-lautfm-container {
    min-height: 40px;
}

/* ===== Responsive Tablet ===== */
@media (max-width: 900px) {
    .sp-col-zeit {
        width: 130px;
        min-width: 110px;
    }

    .sp-col-moderator {
        width: 130px;
        min-width: 80px;
    }

    .sp-bild {
        width: 100px;
        height: 100px;
    }

    .sp-titel {
        font-size: 15px;
    }
}

/* ===== Responsive Mobile ===== */
@media (max-width: 768px) {
    .com-sendeplan {
        font-size: 14px;
    }

    /* Tabs: horizontal scroll */
    .sp-tabs {
        gap: 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        scroll-snap-type: x mandatory;
    }

    .sp-tabs::-webkit-scrollbar {
        display: none;
    }

    .sp-tab {
        min-width: 80px;
        flex: 0 0 auto;
        padding: 10px 12px;
        font-size: 12px;
        border-radius: 0;
        border: 1px solid var(--sp-border);
        border-bottom: none;
        scroll-snap-align: start;
    }

    .sp-tab-name {
        font-size: 12px;
    }

    .sp-tab-datum {
        font-size: 10px;
    }

    /* Header ausblenden */
    .com-sendeplan .sp-header {
        display: none;
    }

    /* Zeilen: Karten-Layout */
    .com-sendeplan .sp-row {
        flex-direction: column;
        padding: 0;
        border-bottom: 1px solid var(--sp-border);
        position: relative;
    }

    .com-sendeplan .sp-row:hover {
        background: inherit;
    }

    /* Zeit-Balken oben */
    .com-sendeplan .sp-col-zeit {
        width: 100%;
        background: var(--sp-darker);
        color: #ffffff;
        padding: 8px 14px;
    }

    .com-sendeplan .sp-row.sp-on-air .sp-col-zeit {
        background: #c0392b;
    }

    .sp-zeit {
        font-weight: 700;
        font-size: 13px;
        color: #ffffff;
        white-space: normal;
    }

    /* Sendung + Bild nebeneinander */
    .com-sendeplan .sp-col-sendung {
        width: 100%;
        padding: 12px 14px;
        order: 2;
    }

    .com-sendeplan .sp-col-moderator {
        width: auto;
        position: absolute;
        top: 48px;
        right: 10px;
        text-align: right;
        min-width: auto;
    }

    .com-sendeplan .sp-bild {
        width: 75px !important;
        height: 75px !important;
        max-width: 75px !important;
        border-radius: 50%;
    }

    /* Titel neben Bild Platz lassen */
    .sp-titel {
        font-size: 15px;
        padding-right: 90px;
    }

    .sp-moderator-name {
        padding-right: 90px;
    }

    .sp-beschreibung {
        font-size: 13px;
        margin-top: 4px;
    }
}

/* ===== Responsive kleine Phones ===== */
@media (max-width: 480px) {
    .sp-tab {
        min-width: 58px;
        padding: 8px 6px;
    }

    .sp-tab-datum {
        display: none;
    }

    .sp-tab-name {
        font-size: 11px;
    }

    .com-sendeplan .sp-col-moderator {
        top: 44px;
        right: 8px;
    }

    .com-sendeplan .sp-bild {
        width: 60px !important;
        height: 60px !important;
        max-width: 60px !important;
    }

    .sp-titel {
        font-size: 14px;
        padding-right: 72px;
    }

    .sp-moderator-name {
        font-size: 13px;
        padding-right: 72px;
    }

    .com-sendeplan .sp-col-sendung {
        padding: 10px 12px;
    }

    .com-sendeplan .sp-col-zeit {
        padding: 6px 12px;
    }

    .sp-beschreibung {
        font-size: 12px;
    }
}

/* ===== Responsive ganz kleine Geräte ===== */
@media (max-width: 360px) {
    .sp-tab {
        min-width: 48px;
        padding: 8px 4px;
    }

    .sp-tab-name {
        font-size: 10px;
    }

    .com-sendeplan .sp-bild {
        width: 50px !important;
        height: 50px !important;
        max-width: 50px !important;
    }

    .sp-titel {
        padding-right: 60px;
        font-size: 13px;
    }

    .sp-moderator-name {
        padding-right: 60px;
    }
}

/* Druckoptimierung */
@media print {
    .sp-tabs, .sp-footer {
        display: none !important;
    }
    .sp-day {
        display: block !important;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    .sp-row {
        page-break-inside: avoid;
    }
}

/* Sendung vom Vortag (Mitternacht-Überlauf) */
.com-sendeplan .sp-row-vortag {
    opacity: 0.75;
    border-left: 3px solid var(--sp-accent) !important;
}
.com-sendeplan .sp-vortag-hint {
    display: block;
    font-size: 10px;
    color: var(--sp-accent);
    font-style: italic;
    margin-top: 2px;
}
