:root {
    --bg-green: #1B4332;
    --pink: #FF85B3;
    --white: #FFFFFF;
    --paper: #fcfbf7;
    --font-chunky: 'Titan One', cursive;
    --font-hand: 'Gochi Hand', cursive;
    /* Neue, stabilere Handschrift für Android */
}

/* Android Fix: Erzwungene Schriftarten */
* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    font-family: var(--font-hand);
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
    background-color: var(--bg-green);
}

.programm-container {
    padding: 10px 15px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    max-height: 100dvh;
    width: 100%;
}

/* Scrollbar verstecken für den Papier-Look */
.events-list::-webkit-scrollbar {
    display: none;
}

/* ========================================== */
/* ADMIN-TRIGGER (Repariert & Klickbar!)      */
/* ========================================== */
.admin-trigger {
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 1.5rem;
    opacity: 0.3;
    cursor: pointer;
    z-index: 1000;
    /* Ganz nach oben, damit nichts überlappt! */
    transition: opacity 0.3s;
    user-select: none;
    /* Wichtig für Handys, damit beim Drücken nichts markiert wird */
    -webkit-user-select: none;
}

.admin-trigger.active {
    opacity: 1;
    animation: pulse 1s infinite;
}

/* ========================================== */
/* TAGES-HEADER                      */
/* ========================================== */
.day-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    margin: 10px 0 15px;
    transform: rotate(-1deg);
    /* Leichte Schräglage für den Vibe */
}

.day-nav {
    background: var(--pink);
    color: var(--bg-green);
    border: 3px solid var(--white);
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 3px 3px 0px var(--white);
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-nav:active {
    transform: translate(3px, 3px);
    box-shadow: 0px 0px 0px var(--white);
}

.day-display {
    text-align: center;
}

.day-name {
    font-family: var(--font-chunky) !important;
    font-size: clamp(2rem, 8vw, 3.5rem);
    color: var(--pink);
    text-shadow: 2px 2px 0px var(--white);
    margin: 0;
}

.day-date {
    font-family: var(--font-hand);
    font-size: clamp(1rem, 5vw, 1.5rem);
    color: var(--white);
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 15px;
    border-radius: 20px;
    border: 2px solid var(--pink);
    display: inline-block;
    margin-top: 5px;
}

/* ========================================== */
/* EVENT-LISTE (Der Kassenzettel)    */
/* ========================================== */
.events-list-wrapper {
    flex: 1;
    width: 100%;
    max-width: 450px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.4);
    /* Gezackter Rand unten für den Kassenbon-Effekt */
    clip-path: polygon(0% 0%, 100% 0%, 100% calc(100% - 10px), 95% 100%, 90% calc(100% - 10px), 85% 100%, 80% calc(100% - 10px), 75% 100%, 70% calc(100% - 10px), 65% 100%, 60% calc(100% - 10px), 55% 100%, 50% calc(100% - 10px), 45% 100%, 40% calc(100% - 10px), 35% 100%, 30% calc(100% - 10px), 25% 100%, 20% calc(100% - 10px), 15% 100%, 10% calc(100% - 10px), 5% 100%, 0% calc(100% - 10px));
}

.events-list {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    /* Erlaubt das Scrollen */
    -webkit-overflow-scrolling: touch; /* Flüssiges Scrollen auf iOS */

    /* WICHTIG FÜR FLEXBOX-SCROLLING: */
    min-height: 0;

    display: flex;
    flex-direction: column;
    color: #333;
    /* Dunkle Schrift für das Papier */
    padding: 20px 20px 40px;
}

.empty-state {
    text-align: center;
    font-size: 1.3rem;
    opacity: 0.6;
    margin-top: 40px;
    color: #555;
}


/* ========================================== */
/* KATEGORIE-HEADER (Der echte Kassenbon-Look)*/
/* ========================================== */
.category-header {
    font-family: 'Courier New', Courier, monospace !important;
    background: transparent !important;
    color: #333 !important;
    /* Dunkle Tinte */
    border: none !important;
    /* Pinken Rand zwingend entfernen! */
    border-radius: 0 !important;
    padding: 15px 0 5px 0 !important;
    margin: 15px 0 5px 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.1rem !important;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: none !important;
    transform: none !important;
}

/* Die gestrichelten Linien links und rechts */
.category-header::before,
.category-header::after {
    content: "------";
    color: #999;
    letter-spacing: -1px;
}

.cat-icon {
    font-size: 1.2rem !important;
    filter: grayscale(100%) contrast(150%);
    /* Macht das Emoji schwarz-weiß */
}

.event-card {
    padding: 12px 0;
    border-bottom: 1px dotted #ccc;
    cursor: pointer;
    transition: opacity 0.2s;
    position: relative;
}

.event-card:active {
    opacity: 0.5;
}

.event-time {
    font-family: var(--font-hand);
    font-size: 1rem;
    color: #777;
    font-weight: bold;
    margin-bottom: 2px;
}

.event-title {
    font-family: 'Gochi Hand', cursive, sans-serif !important;
    font-weight: bold;
}

.event-location {
    font-size: 0.95rem;
    opacity: 0.8;
}

.event-card .admin-delete {
    display: none;
    position: absolute;
    right: 0;
    top: 15px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1rem;
}

.admin-mode .event-card .admin-delete {
    display: inline-block;
}

/* ========================================== */
/*          EVENT-POPUP (Detail)               */
/* ========================================== */
.event-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.event-popup.show {
    display: flex;
}

.popup-content {
    background: var(--white);
    color: var(--bg-green);
    padding: 25px;
    border-radius: 15px;
    border: 4px solid var(--pink);
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.5);
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--pink);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 1rem;
}

.popup-content h2 {
    font-family: var(--font-chunky);
    color: var(--pink);
    margin: 0 0 10px;
    padding-right: 30px;
}

.popup-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.popup-meta span {
    background: var(--bg-green);
    color: var(--white);
    padding: 3px 10px;
    border-radius: 10px;
}

.popup-content p {
    line-height: 1.5;
    white-space: pre-line;
}

/* ========================================== */
/*          ADMIN-PANEL                        */
/* ========================================== */
.admin-panel {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 80vh;
    background: #1B4332 !important;
    /* Absolut deckendes Waldgrün */
    border-top: 5px solid var(--pink);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
    border-radius: 25px 25px 0 0;
    box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.8);
}

.admin-panel.show {
    display: block;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-family: var(--font-chunky);
    color: var(--pink);
    font-size: 1.2rem;
}

.admin-close {
    background: var(--pink);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 1rem;
}

.admin-form {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid var(--pink);
    padding: 15px;
    border-radius: 12px;
}

.admin-form h3 {
    color: var(--pink);
    margin: 0 0 10px;
    font-family: var(--font-chunky);
}

.admin-form select,
.admin-form input,
.admin-form textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border: 2px solid var(--pink);
    border-radius: 8px;
    background: var(--white);
    color: var(--bg-green);
    font-family: var(--font-hand);
    font-size: 1rem;
}

.time-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.time-row input {
    flex: 1;
    margin-bottom: 0;
}

.time-row span {
    color: var(--white);
}

.admin-btn.save {
    background: var(--pink);
    color: var(--bg-green);
    border: 3px solid var(--white);
    padding: 10px;
    width: 100%;
    border-radius: 8px;
    font-family: var(--font-chunky);
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 3px 3px 0px var(--white);
}

.admin-btn.save:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.admin-existing {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
}

.admin-existing h3 {
    color: var(--pink);
    margin: 0 0 10px;
    font-family: var(--font-chunky);
}

.admin-event-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: var(--white);
}

.admin-event-item button {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1rem;
}

/* ========================================== */
/*          ZURÜCK-BUTTON                      */
/* ========================================== */
.back-link {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-chunky);
    background: var(--pink);
    color: var(--bg-green);
    border: 3px solid var(--white);
    padding: 10px 20px;
    text-decoration: none;
    font-size: clamp(0.8rem, 2.5vh, 1rem);
    border-radius: 10px;
    box-shadow: 4px 4px 0px var(--white);
    z-index: 20;
}

.back-link:active {
    transform: translateX(-50%) translate(4px, 4px);
    box-shadow: none;
}

/* ========================================== */
/*          ANIMATIONEN                        */
/* ========================================== */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* ========================================== */
/*          DESKTOP                             */
/* ========================================== */
@media (min-width: 768px) and (pointer: fine) and (hover: hover) {
    .programm-container {
        padding: 20px 30px 100px;
    }

    .day-nav:hover {
        transform: translate(-2px, -2px);
        box-shadow: 5px 5px 0px var(--white);
    }

    .event-card:hover {
        transform: scale(1.02) rotate(0deg);
        box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.3);
    }

    .back-link:hover {
        transform: translateX(-50%) translate(-3px, -3px);
        box-shadow: 7px 7px 0px var(--white);
    }

    .popup-content {
        max-width: 500px;
    }
}

/* ========================================== */
/* SVG-ICONS & LÖSCHEN-BUTTON                 */
/* ========================================== */

/* Macht das Disco-SVG genauso groß wie ein Text-Emoji und schwarz! */
.cat-icon-svg {
    width: 1.2em;
    height: 1.2em;
    vertical-align: middle;
    filter: grayscale(100%) contrast(150%);
    /* Schwarze Tinte! */
}

/* Runder roter Kreis mit sauberem X */
.admin-delete,
.admin-event-item button {
    background: #ff4444 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    cursor: pointer;
    font-size: 1.4rem !important;
    /* X etwas größer machen */
    font-family: Arial, sans-serif !important;
    /* Erzwungene saubere Schrift für das X */
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    line-height: 1 !important;
}

/* Link-Styling für Orte und Beschreibungen */
.location-link,
.desc-link {
    color: var(--bg-green);
    text-decoration: underline;
    font-weight: bold;
    transition: opacity 0.2s;
}

.location-link:hover,
.desc-link:hover {
    opacity: 0.6;
}

/* Link-Styling im Event-Popup-Meta (dunkler Hintergrund) */
.popup-meta span a {
    color: inherit;
    text-decoration: underline;
}

.popup-meta span a:hover {
    color: var(--pink);
    opacity: 1;
}

/* Edit-Modus Styles */
.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.admin-btn.cancel {
    background: #ff4444;
    color: var(--bg-green);
    border: 3px solid var(--white);
    padding: 10px;
    flex: 1;
    border-radius: 8px;
    font-family: var(--font-chunky);
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 3px 3px 0px var(--white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.admin-btn.cancel:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.admin-event-item .admin-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-event-item button.admin-edit-btn {
    background: #ffab00 !important; /* Orange/Gold für Edit */
    color: var(--bg-green) !important;
    border: 3px solid var(--white) !important;
    font-size: 1.1rem !important;
}