/* ==========================================================================
   DNS Insight Report – Layout & Design
   Datei: assets/style.css
   ========================================================================== */

/* ------------------------------
   Reset & Base
   ------------------------------ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    color: #1f2933;
    background-color: #f4f5f7;
}

/* Links allgemein */

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

/* Monospace-Text */

.mono {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9rem;
    word-break: break-all;
}

/* ------------------------------
   App-Rahmen
   ------------------------------ */

.app-header {
    background: #111827;
    color: #f9fafb;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
    position: sticky;
    top: 0;
    z-index: 50;
}

.app-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    justify-content: space-between;
}

.app-title-block h1 {
    margin: 0 0 0.25rem 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.app-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: #e5e7eb;
    max-width: 720px;
}

.app-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-main {
    max-width: 1120px;
    margin: 1.5rem auto 2.5rem;
    padding: 0 1.0rem 3rem;
}

/* ------------------------------
   Karten / Panels
   ------------------------------ */

.card {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1.5rem 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
    border: 1px solid #e5e7eb;
    position: relative;
}

.card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0.9rem;
    bottom: 0.9rem;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(to bottom, #2563eb, #0ea5e9);
    opacity: 0.8;
}

.card-inner {
    position: relative;
}

.card h2 {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.card h2 span.section-tag {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
}

/* Login-Karte (falls Passwortschutz) */

.card-login {
    max-width: 480px;
    margin: 3rem auto;
}

/* ------------------------------
   Buttons
   ------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: none;
    font-size: 0.95rem;
    padding: 0.45rem 1.15rem;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
    white-space: nowrap;
}

.btn-primary {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.45);
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: #111827;
    color: #f9fafb;
    box-shadow: 0 6px 15px rgba(15, 23, 42, 0.45);
}

.btn-secondary:hover {
    background: #030712;
}

/* ------------------------------
   Formular
   ------------------------------ */

.domain-form,
.card-login form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.3fr);
    gap: 1rem 1.5rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #111827;
}

input[type="text"],
input[type="password"],
select {
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    padding: 0.45rem 0.6rem;
    font-size: 0.95rem;
    outline: none;
    background-color: #ffffff;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
    background-color: #f9fafb;
}

.form-hint {
    font-size: 0.8rem;
    color: #6b7280;
}

.form-actions {
    margin-top: 0.5rem;
}

.form-actions .btn {
    min-width: 170px;
}

.form-error {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #b91c1c;
    background: #fee2e2;
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
}

/* ------------------------------
   Report-Kopf / Meta-Kacheln
   ------------------------------ */

.report-header {
    margin-bottom: 1rem;
}

/* Container (Grid ohne eigenen Kasten) */
.report-meta {
    border: none;
    background: transparent;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75rem 1rem;
}

/* Einzelne Meta-Kacheln */
.report-meta-item {
    background: #f9fafb;
    border-radius: 0.6rem;
    border: 1px solid #e5e7eb;
    padding: 0.55rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.report-meta-item .label {
    font-size: 0.75rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #6b7280;
}

.report-meta-item .value {
    font-size: 0.95rem;
    font-weight: 500;
    color: #111827;
    word-break: break-word;
}

/* ------------------------------
   Section-Toggles
   ------------------------------ */

.section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.section-toggle::after {
    content: "▼";
    font-size: 0.8rem;
    color: #6b7280;
    margin-left: 0.5rem;
    transition: transform 0.15s ease;
}

.section-toggle.collapsed::after {
    transform: rotate(-90deg);
}

.section-body {
    margin-top: 0.75rem;
}

/* ------------------------------
   Summary-Kacheln
   ------------------------------ */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.0rem;
}

.summary-card {
    border-radius: 0.6rem;
    padding: 0.75rem 0.8rem;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.9rem;
}

.summary-card.ok {
    border-color: #16a34a;
    background: #ecfdf3;
}

.summary-card.warn {
    border-color: #f97316;
    background: #fff7ed;
}

.summary-card.neutral {
    border-color: #e5e7eb;
    background: #f9fafb;
}

.summary-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
}

.summary-value {
    font-weight: 500;
    color: #111827;
}

/* ------------------------------
   Security-Hinweise
   ------------------------------ */

.security-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
}

.security-item {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.security-badge {
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.security-critical {
    background-color: #b91c1c;
    color: #fef2f2;
}

.security-warning {
    background-color: #f97316;
    color: #fffbeb;
}

.security-info {
    background-color: #0369a1;
    color: #eff6ff;
}

.security-text {
    flex: 1;
}

/* ------------------------------
   Tabellen & Tabellen-Wrapper
   ------------------------------ */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 0.5rem;
}

/* DKIM-Wrapper: wie andere Tabellen (Scroll bei Bedarf) */
.dkim-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

/* Basis-Tabellenlayout */

.dns-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background-color: #ffffff;
    table-layout: auto;
}

.dns-table thead {
    background-color: #f3f4f6;
}

.dns-table th,
.dns-table td {
    border: 1px solid #e5e7eb;
    padding: 0.45rem 0.5rem;
    text-align: left;
    vertical-align: top;
}

.dns-table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

/* Zebra-Look */
.dns-table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

/* Wortumbruch, damit lange Werte nicht aus dem Layout ragen */

.dns-table td,
.dns-table th {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* DKIM-Tabelle: Hostname und Zielspalte etwas eingegrenzt */

.dkim-table th:nth-child(3),
.dkim-table td:nth-child(3),
.dkim-table th:nth-child(6),
.dkim-table td:nth-child(6) {
    max-width: 260px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* Inline-Listen (für Alias-Records) */

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

.inline-list li {
    font-size: 0.85rem;
}

/* ------------------------------
   Unterüberschriften
   ------------------------------ */

.subheadline {
    margin: 0.75rem 0 0.4rem;
    font-size: 1.0rem;
    font-weight: 600;
    color: #111827;
}

.subheadline-small {
    margin: 0.75rem 0 0.3rem;
    font-size: 0.95rem;
    font-weight: 500;
}

/* ------------------------------
   SPF & DMARC Blöcke
   ------------------------------ */

.spf-block,
.dmarc-block {
    border-radius: 0.6rem;
    border: 1px solid #e5e7eb;
    padding: 0.6rem 0.7rem;
    margin-bottom: 0.65rem;
    background-color: #f9fafb;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.spf-raw,
.dmarc-raw {
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
}

.spf-list,
.dmarc-list {
    display: grid;
    grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
    gap: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

.spf-list dt,
.dmarc-list dt {
    font-weight: 600;
    color: #374151;
}

.spf-list dd,
.dmarc-list dd {
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
}

/* ------------------------------
   Alias-Sektion
   ------------------------------ */

.note {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.45rem;
}

/* ------------------------------
   Print-spezifische Regeln
   ------------------------------ */

@media print {

    html,
    body {
        background: #ffffff !important;
    }

    body {
        margin: 0;
        padding: 0;
        box-shadow: none !important;
    }

    .no-print {
        display: none !important;
    }

    @page {
        margin: 1.0cm 0.8cm 1.0cm 0.8cm;
        size: A4 portrait;
    }

    .app-main {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    /* Report-Kopf möglichst mit erster Sektion zusammenhalten */
    .report-header {
        max-width: none !important;
        width: 100% !important;
        margin: 0 0 0.5cm 0 !important;
        padding-left: 0.8cm !important;
        padding-right: 0.8cm !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        border: none !important;
        page-break-after: avoid;
    }

    /* Karten normal im Fluss, aber nicht mitten drin brechen wenn vermeidbar */
    .card {
        max-width: none !important;
        width: 100% !important;
        margin: 0 0 0.5cm 0 !important;
        padding-left: 0.8cm !important;
        padding-right: 0.8cm !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        border: none !important;
        page-break-inside: avoid;
    }

    /* Tabellen & Zeilen als Einheit behandeln */
    .dns-table {
        font-size: 0.78rem;
        table-layout: fixed;
        page-break-inside: avoid;
    }

    .dns-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    .dns-table th,
    .dns-table td {
        padding: 0.25rem 0.3rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }

    /* DKIM-Tabelle auch als Block */
    .dkim-table {
        page-break-inside: avoid;
    }

    .dkim-table th:nth-child(3),
    .dkim-table td:nth-child(3),
    .dkim-table th:nth-child(6),
    .dkim-table td:nth-child(6) {
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }

    .table-wrapper,
    .dkim-table-wrapper {
        overflow: visible !important;
    }

    /* SPF/DMARC-Blöcke nicht mitten drin trennen */
    .spf-block,
    .dmarc-block {
        page-break-inside: avoid;
    }

    /* Section-Header nicht allein am Seitenende lassen */
    .section-toggle {
        page-break-after: avoid;
    }

    .btn {
        display: none !important;
    }

    a,
    a:visited {
        color: #111827 !important;
        text-decoration: none !important;
    }
}

/* ------------------------------
   Screen-only Feinschliff
   ------------------------------ */

@media screen {

    .dns-table tbody tr:hover {
        background-color: #e5f0ff;
    }

    .dns-table tbody tr:hover td {
        border-color: #bfdbfe;
    }
}

/* ------------------------------
   Responsive Anpassungen
   ------------------------------ */

@media (max-width: 768px) {

    .app-header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .app-main {
        padding: 0 0.85rem 2.5rem;
    }

    .card {
        padding: 1.2rem 1.1rem 1.4rem;
    }
}

/* Smartphones ~ „70 % Zoom“ */
@media (max-width: 600px) {

    /* globale Skalierung über kleinere Basis-Schriftgröße */
    html {
        font-size: 12px; /* 16px → 12px ≈ 75 % */
    }

    body {
        line-height: 1.45;
    }

    .app-main {
        padding: 0 0.5rem 2rem;
    }

    .card {
        margin-bottom: 1.1rem;
        padding: 1.0rem 0.9rem 1.2rem;
    }

    .app-title-block h1 {
        font-size: 1.2rem;
    }

    .app-subtitle {
        font-size: 0.8rem;
    }

    .report-meta-item .value {
        font-size: 0.9rem;
    }

    .summary-card {
        font-size: 0.85rem;
        padding: 0.6rem 0.65rem;
    }

    .dns-table {
        font-size: 0.8rem;
    }

    .dns-table th {
        font-size: 0.75rem;
    }

    .dns-table th,
    .dns-table td {
        padding: 0.3rem 0.35rem;
    }

    /* SPF/DMARC-Analyse einspaltig, damit nichts horizontale Überbreite erzeugt */
    .spf-list,
    .dmarc-list {
        grid-template-columns: minmax(0, 1fr);
    }
}