/* ============================================================
   Mondphase Plugin Styles (1.4.0)

   Farbschemata (Einstellungen → Lesen → Mondphase → Farben):
   .mondphase-farben-theme   Standard. Übernimmt Schrift- und Hintergrundfarbe
                             des Themes, Flächen sind halbtransparent getönt.
   .mondphase-farben-hell    Feste helle Farben
   .mondphase-farben-dunkel  Feste dunkle Farben
   .mondphase-farben-system  Hell oder dunkel nach prefers-color-scheme

   Alle Farben lassen sich im Theme über die --mp-*-Variablen überschreiben.
   ============================================================ */

.mondphase-container {
    --mp-akzent-voll: #e0a21c;
    --mp-akzent-neu: currentColor;
    --mp-akzent-viertel: #7d8fa8;
    --mp-flaeche: rgba(128, 128, 128, 0.08);
    --mp-flaeche-voll: rgba(224, 162, 28, 0.12);
    --mp-flaeche-neu: rgba(128, 128, 128, 0.12);
    --mp-flaeche-viertel: rgba(125, 143, 168, 0.12);
    --mp-text: currentColor;
    --mp-text-leise: currentColor;
    --mp-mond-licht: #f3e2a9;
    --mp-mond-schatten: #3b3d48;
    --mp-mond-rand: rgba(128, 128, 128, 0.5);
    --mp-hinweis: #b4321e;
    --mp-hinweis-flaeche: rgba(180, 50, 30, 0.1);
    --mp-schatten: 0 1px 6px rgba(0, 0, 0, 0.08);

    color: var(--mp-text);
    margin-bottom: 0.6em;
}

/* Fester heller Stil */
.mondphase-farben-hell {
    --mp-akzent-neu: #333;
    --mp-flaeche: #f7f7f9;
    --mp-flaeche-voll: #fffbee;
    --mp-flaeche-neu: #f2f2f7;
    --mp-flaeche-viertel: #f1f4f8;
    --mp-text: #222;
    --mp-text-leise: #555;
}

/* Fester dunkler Stil */
.mondphase-farben-dunkel {
    --mp-akzent-voll: #f0b429;
    --mp-akzent-neu: #aaa;
    --mp-flaeche: #2a2a2e;
    --mp-flaeche-voll: #2e2a1a;
    --mp-flaeche-neu: #1e1e24;
    --mp-flaeche-viertel: #22262e;
    --mp-text: #eee;
    --mp-text-leise: #bbb;
    --mp-mond-schatten: #15161b;
    --mp-hinweis: #ff8a70;
    --mp-hinweis-flaeche: rgba(255, 138, 112, 0.14);
    --mp-schatten: 0 1px 6px rgba(0, 0, 0, 0.4);
}

/* Nach Systemeinstellung: hell als Basis, dunkel per Media Query */
.mondphase-farben-system {
    --mp-akzent-neu: #333;
    --mp-flaeche: #f7f7f9;
    --mp-flaeche-voll: #fffbee;
    --mp-flaeche-neu: #f2f2f7;
    --mp-flaeche-viertel: #f1f4f8;
    --mp-text: #222;
    --mp-text-leise: #555;
}

@media (prefers-color-scheme: dark) {
    .mondphase-farben-system {
        --mp-akzent-voll: #f0b429;
        --mp-akzent-neu: #aaa;
        --mp-flaeche: #2a2a2e;
        --mp-flaeche-voll: #2e2a1a;
        --mp-flaeche-neu: #1e1e24;
        --mp-flaeche-viertel: #22262e;
        --mp-text: #eee;
        --mp-text-leise: #bbb;
        --mp-mond-schatten: #15161b;
        --mp-hinweis: #ff8a70;
        --mp-hinweis-flaeche: rgba(255, 138, 112, 0.14);
        --mp-schatten: 0 1px 6px rgba(0, 0, 0, 0.4);
    }
}

/* Reserve-Termine bleiben versteckt, bis das Skript sie einblendet.
   Nötig, weil display:flex das hidden-Attribut sonst überschreibt. */
.mondphase-widget[hidden] {
    display: none !important;
}

/* -----------------------------------------------------------
   Einzelner Termin
   ----------------------------------------------------------- */
.mondphase-widget {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35em 1em;
    padding: 0.8em 1.2em;
    border-radius: 8px;
    line-height: 1.4;
    background: var(--mp-flaeche);
    border-left: 4px solid var(--mp-akzent-viertel);
}

.mondphase-vollmond {
    background: var(--mp-flaeche-voll);
    border-left-color: var(--mp-akzent-voll);
}

.mondphase-neumond {
    background: var(--mp-flaeche-neu);
    border-left-color: var(--mp-akzent-neu);
}

.mondphase-erstes_viertel,
.mondphase-letztes_viertel {
    background: var(--mp-flaeche-viertel);
    border-left-color: var(--mp-akzent-viertel);
}

.mondphase-icon {
    display: inline-flex;
    font-size: 2em;
    line-height: 1;
    flex-shrink: 0;
}

.mondphase-name {
    font-weight: 700;
    font-size: 1.05em;
    flex: 1 1 auto;
}

.mondphase-hinweise {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em;
    flex-basis: 100%;
}

.mondphase-hinweis {
    display: inline-block;
    padding: 0.1em 0.6em;
    border-radius: 999px;
    font-size: 0.78em;
    font-weight: 600;
    color: var(--mp-hinweis);
    background: var(--mp-hinweis-flaeche);
}

.mondphase-hinweis-supermond,
.mondphase-hinweis-minimond {
    color: inherit;
    background: var(--mp-flaeche-voll);
}

.mondphase-datum {
    font-size: 0.95em;
}

.mondphase-countdown {
    font-size: 0.88em;
    font-style: italic;
    color: var(--mp-text-leise);
    opacity: 0.8;
}

.mondphase-kalender-link,
.mondphase-abo a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.15em;
    opacity: 0.85;
}

.mondphase-kalender-link:hover,
.mondphase-kalender-link:focus,
.mondphase-abo a:hover,
.mondphase-abo a:focus {
    opacity: 1;
}

.mondphase-kalender-link {
    font-size: 0.82em;
    margin-left: auto;
}

/* Zeilenumbruch: Datum und Countdown unter Symbol und Name */
.mondphase-stil-standard .mondphase-name {
    flex-basis: calc(100% - 4em);
}

/* SVG-Mond */
.mondphase-svg {
    display: block;
}
.mondphase-svg-schatten {
    fill: var(--mp-mond-schatten);
}
.mondphase-svg-licht {
    fill: var(--mp-mond-licht);
}
.mondphase-svg-rand {
    fill: none;
    stroke: var(--mp-mond-rand);
    stroke-width: 2;
}

/* -----------------------------------------------------------
   Kompakter Stil
   ----------------------------------------------------------- */
.mondphase-stil-kompakt.mondphase-widget {
    padding: 0.4em 0.8em;
    gap: 0.3em 0.6em;
    border-radius: 4px;
}

.mondphase-stil-kompakt .mondphase-icon {
    font-size: 1.3em;
}
.mondphase-stil-kompakt .mondphase-svg {
    width: 1.4em;
    height: 1.4em;
}

.mondphase-stil-kompakt .mondphase-name {
    font-size: 0.9em;
    flex: 0 0 auto;
}

.mondphase-stil-kompakt .mondphase-datum {
    font-size: 0.85em;
}

.mondphase-stil-kompakt .mondphase-countdown {
    font-size: 0.8em;
}

/* -----------------------------------------------------------
   Karten-Stil
   ----------------------------------------------------------- */
.mondphase-stil-karte.mondphase-widget {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5em;
    border-left: none;
    border-top: 4px solid var(--mp-akzent-viertel);
    box-shadow: var(--mp-schatten);
}

.mondphase-stil-karte.mondphase-vollmond {
    border-top-color: var(--mp-akzent-voll);
}

.mondphase-stil-karte.mondphase-neumond {
    border-top-color: var(--mp-akzent-neu);
}

.mondphase-stil-karte .mondphase-icon {
    font-size: 3em;
    margin-bottom: 0.2em;
}

.mondphase-stil-karte .mondphase-name {
    font-size: 1.2em;
    flex: 0 0 auto;
}

.mondphase-stil-karte .mondphase-hinweise {
    justify-content: center;
}

.mondphase-stil-karte .mondphase-kalender-link {
    margin-left: 0;
}

/* -----------------------------------------------------------
   Liste mehrerer Termine
   ----------------------------------------------------------- */
.mondphase-liste {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
}

.mondphase-abo {
    margin: 0.3em 0 0;
    font-size: 0.85em;
}

/* -----------------------------------------------------------
   Ansicht „heute“
   ----------------------------------------------------------- */
.mondphase-heute {
    display: flex;
    align-items: center;
    gap: 1.2em;
    padding: 1em 1.2em;
    border-radius: 8px;
    background: var(--mp-flaeche);
}

.mondphase-heute .mondphase-name {
    display: block;
    font-size: 1.2em;
    margin-bottom: 0.3em;
}

.mondphase-fakten {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15em 0.9em;
    margin: 0;
    font-size: 0.92em;
}

.mondphase-fakten dt {
    color: var(--mp-text-leise);
    opacity: 0.8;
}

.mondphase-fakten dd {
    margin: 0;
}

.mondphase-bis {
    display: block;
    font-size: 0.85em;
    color: var(--mp-text-leise);
    opacity: 0.75;
}

.mondphase-erklaerung {
    margin: 0.5em 0 0;
    font-size: 0.8em;
    line-height: 1.4;
    color: var(--mp-text-leise);
}

.mondphase-erklaerung summary {
    cursor: pointer;
    opacity: 0.75;
    width: fit-content;
}

.mondphase-erklaerung summary:hover,
.mondphase-erklaerung summary:focus-visible {
    opacity: 1;
}

.mondphase-erklaerung-zeile {
    display: block;
    margin-top: 0.3em;
    opacity: 0.8;
}

.mondphase-heute.mondphase-stil-karte {
    flex-direction: column;
    text-align: center;
    padding: 1.5em;
    box-shadow: var(--mp-schatten);
}

.mondphase-heute.mondphase-stil-karte .mondphase-fakten {
    text-align: left;
    justify-content: center;
}

.mondphase-heute.mondphase-stil-kompakt {
    gap: 0.8em;
    padding: 0.6em 0.9em;
}

@media (max-width: 480px) {
    .mondphase-heute {
        flex-direction: column;
        text-align: center;
    }
    .mondphase-heute .mondphase-fakten {
        text-align: left;
    }
}

/* Fehlermeldung */
.mondphase-error {
    color: #c00;
    font-style: italic;
}
