/* ==================================================
   SERP SIMULATOR CSS
   ==================================================

   Zweck:
   Diese Datei steuert ausschließlich den SERP-Simulator.

   Einbindung:
   In includes/head.php nach content.css einfügen:
   <link rel="stylesheet" href="<?= url('assets/css/serp.css'); ?>">

   HTML-Voraussetzung:
   Der Simulator liegt in einer vollen Kachel:
   <article class="card card-serp">
       <div class="serp-simulator">
           ...
       </div>
   </article>

   Projektanpassung:
   - passt zum bestehenden 1200px-Layout
   - nutzt die vorhandenen Projektfarben
   - überschreibt nur den SERP-Simulator, nicht alle Kacheln
   - nutzt die komplette Breite einer grid-1-Kachel
================================================== */


/* ==================================================
   SERP-KACHEL: Äußere Card
   --------------------------------------------------
   Diese Klasse ergänzt .card nur für den SERP-Simulator.

   Auswirkungen:
   - reduziert verschachtelte Abstände
   - gibt dem SERP-Modul mehr nutzbare Innenfläche
   - vermeidet doppelte Box-Optik
================================================== */

.card-serp {
    padding: 20px;
    background: rgba(98, 106, 127, 0.12);
    border: 1px solid var(--color-dark-blue);
    border-radius: 5px;
}


/* ==================================================
   SERP: Hauptcontainer
   --------------------------------------------------
   Zweispaltiges Layout innerhalb der vollen Kachel.

   Auswirkungen:
   - links Formular
   - rechts Google-Vorschau
   - 0.9fr / 1.1fr gibt der Vorschau etwas mehr Platz
   - minmax(0, ...) verhindert Überlaufen langer Inhalte
================================================== */

.serp-simulator {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    min-height: auto;
    font-family: var(--font-main);
    color: #202124;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0;
    overflow: visible;
    box-shadow: none !important;
}

.serp-simulator * {
    box-sizing: border-box;
}


/* ==================================================
   SERP: Grundflächen links/rechts
   --------------------------------------------------
   Entfernt zusätzliche Boxen innerhalb der Kachel.

   Auswirkungen:
   - Panel und Vorschau wirken als ein gemeinsames Modul.
   - Keine doppelten Rahmen, Schatten oder Hintergründe.
================================================== */

.serp-simulator .panel,
.serp-simulator .preview-area {
    width: 100%;
    min-width: 0;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.serp-simulator .panel {
    padding: 0 12px 0 0;
    border-radius: 0;
}

.serp-simulator .preview-area {
    padding: 0 0 0 12px;
    border-radius: 0;
}


/* ==================================================
   SERP: Überschrift und Intro
   --------------------------------------------------
   Linker Bereich oben.

   Auswirkungen:
   - h2 ist die Modulüberschrift.
   - Absatz erklärt SERP.
================================================== */

.serp-simulator .panel h2 {
    margin: 0 0 24px;
    font-size: clamp(2rem, 3vw, 2.8rem);
    line-height: 1.15;
    font-weight: 700;
    color: #203665;
    text-align: left;
    text-shadow: none;
}

.serp-simulator .panel > p {
    margin: 0 0 24px;
    font-size: 1rem;
    line-height: 1.45;
    color: #203665;
    text-align: left;
}


/* ==================================================
   SERP: Formularfelder
   --------------------------------------------------
   Eingaben für URL, Title und Description.

   Auswirkungen:
   - Felder sind kompakter als normale Content-Kacheln.
   - Fokuszustand macht aktive Eingabe sichtbar.
================================================== */

.serp-simulator .field {
    margin-bottom: 20px;
}

.serp-simulator label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    line-height: 1.3;
    font-weight: 700;
    color: #203665;
}

.serp-simulator input,
.serp-simulator textarea {
    width: 100%;
    border: 1px solid rgba(32, 54, 101, 0.35);
    border-radius: 5px;
    padding: 12px 12px;
    font: inherit;
    font-size: 1rem;
    line-height: 1.45;
    color: #203665;
    background: rgba(255, 255, 255, 0.82);
    outline: none;
    box-shadow: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.serp-simulator input {
    min-height: 48px;
}

.serp-simulator textarea {
    min-height: 120px;
    resize: vertical;
}

.serp-simulator input:focus,
.serp-simulator textarea:focus {
    border-color: #203665;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(32, 54, 101, 0.16);
}


/* ==================================================
   SERP: Button
   --------------------------------------------------
   Analyse starten.

   Auswirkungen:
   - volle Breite
   - Projektfarbe statt externem Violett
================================================== */

.serp-simulator button {
    width: 100%;
    border: 1px solid #203665;
    border-radius: 5px;
    padding: 12px 16px;
    font: inherit;
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 700;
    color: #ffffff;
    background: #203665;
    cursor: pointer;
    text-align: center;
    transition: background 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.serp-simulator button:hover {
    background: #18294f;
    transform: translateY(-2px);
}

.serp-simulator button:active {
    transform: translateY(1px);
}

.serp-simulator button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}


/* ==================================================
   SERP: Hinweise und Meldungen
   --------------------------------------------------
   Zeichenlängen und Lade-/Fehlermeldungen.
================================================== */

.serp-simulator .hint {
    margin: 8px 0 0;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: left;
}

.serp-simulator .hint.success {
    color: #1b6b2a;
}

.serp-simulator .hint.danger {
    color: #972727;
}

.serp-simulator .message {
    margin: 8px 0 0;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #203665;
    text-align: left;
    font-weight: 700;
}

.serp-simulator .message.is-error {
    color: #972727;
}


/* ==================================================
   SERP: Google-Kopf
   --------------------------------------------------
   Google-Schriftzug und Tabs.
================================================== */

.serp-simulator .google-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 8px;
    border: 0 !important;
    box-shadow: none !important;
}

.serp-simulator .google-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.02em;
    font-size: clamp(3.2rem, 7vw, 5.5rem);
    line-height: 1;
    font-weight: 700;
    letter-spacing: -0.03em;
    white-space: nowrap;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.35);
}

.serp-simulator .google-logo span:nth-child(1),
.serp-simulator .google-logo span:nth-child(4) {
    color: #4285f4;
}

.serp-simulator .google-logo span:nth-child(2),
.serp-simulator .google-logo span:nth-child(6) {
    color: #ea4335;
}

.serp-simulator .google-logo span:nth-child(3) {
    color: #fbbc05;
}

.serp-simulator .google-logo span:nth-child(5) {
    color: #34a853;
}

.serp-simulator .tabs {
    display: flex;
    gap: 14px;
    font-size: 0.9rem;
    line-height: 1.3;
    white-space: nowrap;
}

.serp-simulator .tabs a {
    color: #5f6368;
    text-decoration: none;
}

.serp-simulator .tabs a:hover,
.serp-simulator .tabs a.active {
    color: #1a73e8;
}


/* ==================================================
   SERP: Ergebnisbereich
   --------------------------------------------------
   Ergebnisanzahl und Snippet.
================================================== */

.serp-simulator .results {
    width: 100%;
    max-width: 100%;
    margin: 22px 0 0;
}

.serp-simulator .result-count {
    margin-bottom: 18px;
    color: #5f6368;
    font-size: 0.9rem;
    line-height: 1.4;
}


/* ==================================================
   SERP: Google Snippet
   --------------------------------------------------
   Suchergebnis-Vorschau.

   Auswirkungen:
   - max-width: 100% nutzt die rechte Spalte sauber.
   - Hintergrund bleibt hell wie in SERPs.
================================================== */

.serp-simulator .snippet {
    max-width: 100%;
    margin-bottom: 26px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 3px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.serp-simulator .snippet-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.serp-simulator .snippet-favicon-wrap {
    position: relative;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    margin-top: 1px;
    border-radius: 50%;
    background: #f1f3f4;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.serp-simulator .snippet-favicon {
    display: none;
    width: 32px;
    height: 32px;
    max-width: 32px;
    max-height: 32px;
    min-width: 32px;
    min-height: 32px;
    object-fit: contain;
    border-radius: 50%;
    background: transparent;
}

.serp-simulator .snippet-favicon[src]:not([src=""]) {
    display: block;
}

.serp-simulator .snippet-favicon.is-loaded {
    display: block;
}

.serp-simulator .snippet-favicon.is-loaded + .snippet-favicon-fallback,
.serp-simulator .snippet-favicon[src]:not([src=""]) + .snippet-favicon-fallback {
    display: none;
}

.serp-simulator .snippet-favicon-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    font-size: 0.75rem;
    line-height: 1;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 500;
}

.serp-simulator .snippet-meta {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.serp-simulator .snippet-site-name {
    display: block;
    margin: 0;
    padding: 0;
    color: #202124;
    font-size: 1rem;
    line-height: 1.25;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.serp-simulator .snippet-url {
    display: block;
    margin: 2px 0 0;
    padding: 0;
    color: #4d5156;
    font-size: 0.875rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.serp-simulator .snippet-menu {
    flex: 0 0 18px;
    color: #5f6368;
    font-size: 1.35rem;
    line-height: 1;
    text-align: center;
    align-self: center;
    margin-left: 4px;
    transform: translateY(-1px);
}

.serp-simulator .snippet-title {
    display: block;
    max-width: 100%;
    margin-top: 6px;
    color: #1a0dab;
    font-size: clamp(1.2rem, 2vw, 1.45rem);
    line-height: 1.22;
    font-weight: 400;
    text-decoration: none;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
}

.serp-simulator .snippet-title:hover {
    text-decoration: underline;
}

.serp-simulator .snippet-description {
    margin-top: 4px;
    color: #4d5156;
    font-size: 1rem;
    line-height: 1.45;
}


/* ==================================================
   SERP: Hinweisbereich und Kontaktbutton
================================================== */

.serp-simulator .serp-note {
    display: grid;
    gap: 12px;
    margin-top: 24px;
    color: #203665;
    font-size: 0.95rem;
    line-height: 1.5;
}

.serp-simulator .serp-note p {
    margin: 0;
    color: #203665;
    text-align: left;
}

.serp-simulator .skeleton {
    display: grid;
    gap: 12px;
}

.serp-simulator .skeleton > div:not(.serp-contact-button-wrap) {
    display: none;
}

.serp-simulator .serp-contact-button-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.serp-simulator .serp-contact-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    padding: 12px 22px;
    border: 1px solid #203665;
    border-radius: 5px;
    background: #203665;
    color: #ffffff;
    font-size: 0.95rem;
    line-height: 1.3;
    font-weight: 700;
    text-decoration: none;
    transition: background 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.serp-simulator .serp-contact-button:hover {
    background: #18294f;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
}

.serp-simulator .serp-contact-button:active {
    transform: translateY(1px);
}


/* ==================================================
   SERP: Responsive
   --------------------------------------------------
   Ab kleinerer Breite wird der Simulator einspaltig.
================================================== */

@media (max-width: 900px) {
    .serp-simulator {
        grid-template-columns: 1fr;
        max-width: 100%;
        border-radius: 0;
    }

    .serp-simulator .panel,
    .serp-simulator .preview-area {
        padding: 20px 0;
        border: 0 !important;
        border-radius: 0;
    }

    .serp-simulator .google-header {
        align-items: flex-start;
        flex-direction: column;
        border: 0 !important;
    }

    .serp-simulator .tabs {
        flex-wrap: wrap;
    }

    .serp-simulator .google-logo {
        font-size: 3.5rem;
    }

    .serp-simulator .snippet {
        max-width: 100%;
        padding: 16px;
    }

    .serp-simulator .snippet-title {
        font-size: 1.25rem;
    }

    .serp-simulator .snippet-site-name,
    .serp-simulator .snippet-url,
    .serp-simulator .snippet-description {
        font-size: 0.9rem;
    }
}
