/*
 * GoSplit — Admin-CSS
 * Warmes, modernes Design. Keine Build-Tools, reine CSS-Variablen.
 */

:root {
    /* Farben — warm, hochwertig, nicht kalt */
    --color-bg:          #FAF7F2;  /* Off-White */
    --color-surface:     #FFFFFF;
    --color-surface-alt: #F4EDE2;
    --color-border:      #EFE8DD;
    --color-border-soft: #F4EDE2;
    --color-text:        #2B1B12;  /* Deep Espresso */
    --color-text-soft:   #6B5A4F;
    --color-text-muted:  #A69481;
    --color-primary:     #C97B4A;  /* Terrakotta */
    --color-primary-dark:#A85E30;
    --color-primary-soft:#F3E3D4;
    --color-success:     #7A8B6E;  /* Sage */
    --color-success-soft:#E5EBDF;
    --color-warning:     #D9A657;
    --color-warning-soft:#FAF0DF;
    --color-danger:      #B04A3D;
    --color-danger-soft: #F5DDD8;

    /* Typografie */
    --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;

    /* Schatten (warm getönt, nicht neutral-grau) */
    --shadow-sm: 0 1px 2px rgba(43, 27, 18, 0.04), 0 1px 3px rgba(43, 27, 18, 0.06);
    --shadow-md: 0 4px 10px rgba(43, 27, 18, 0.06), 0 2px 4px rgba(43, 27, 18, 0.04);
    --shadow-lg: 0 10px 25px rgba(43, 27, 18, 0.08), 0 4px 10px rgba(43, 27, 18, 0.05);

    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --container: 1120px;
}

* {
    box-sizing: border-box;
}

[x-cloak] {
    display: none !important;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.15s;
}
a:hover {
    color: var(--color-primary-dark);
}

h1, h2, h3, h4 {
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.01em;
    margin: 0;
}

code {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.9em;
}

/* ============================================================
   Layout
============================================================ */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

.main {
    min-height: calc(100vh - 140px);
    padding: 32px 0 64px;
}

.footer {
    border-top: 1px solid var(--color-border);
    padding: 24px 0;
    color: var(--color-text-muted);
    background: var(--color-bg);
}

/* ============================================================
   Topbar
============================================================ */
.topbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--color-text);
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    color: var(--color-bg);
    border-radius: var(--radius-sm);
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 20px;
    box-shadow: var(--shadow-sm);
}
.brand-mark-lg {
    width: 64px;
    height: 64px;
    font-size: 38px;
    border-radius: var(--radius);
}
.brand-name {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 19px;
}
.topnav {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 20px;
}
.topnav a {
    color: var(--color-text-soft);
    font-weight: 500;
    font-size: 14px;
}
.topnav a:hover {
    color: var(--color-text);
}
.topnav a.btn {
    color: var(--color-bg);
}
.logout-form {
    margin: 0;
}
.btn-link {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    padding: 6px 10px;
}
.btn-link:hover {
    color: var(--color-text);
}

/* ============================================================
   Buttons
============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-sm {
    padding: 7px 13px;
    font-size: 13px;
}
.btn-block {
    display: flex;
    width: 100%;
}
.btn-primary {
    background: var(--color-primary);
    color: #FFF;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background: var(--color-primary-dark);
    color: #FFF;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn-ghost {
    background: transparent;
    color: var(--color-text-soft);
    border: 1px solid var(--color-border);
}
.btn-ghost:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}
.btn-danger-ghost {
    background: transparent;
    color: var(--color-danger);
    border: 1px solid var(--color-danger-soft);
}
.btn-danger-ghost:hover {
    background: var(--color-danger-soft);
}

/* ============================================================
   Flash-Messages
============================================================ */
.flash {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid transparent;
}
.flash-success {
    background: var(--color-success-soft);
    border-color: var(--color-success);
    color: #46553B;
}
.flash-error {
    background: var(--color-danger-soft);
    border-color: var(--color-danger);
    color: #6A2A22;
}
.flash-info {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

/* ============================================================
   Page-Hero
============================================================ */
.page-hero {
    margin-bottom: 36px;
}
.page-title {
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 600;
    margin: 0 0 6px;
}
.page-subtitle {
    color: var(--color-text-soft);
    margin: 0;
    font-size: 15px;
}
.back-link {
    display: inline-block;
    color: var(--color-text-muted);
    font-size: 13px;
    margin-bottom: 12px;
}
.back-link:hover {
    color: var(--color-text-soft);
}

.hero-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.hero-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================================
   Stats-Grid (Dashboard Karten)
============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
}
.stat-label {
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.stat-value {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 600;
    color: var(--color-text);
}

/* ============================================================
   Sections
============================================================ */
.section {
    margin-bottom: 48px;
}
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.section-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
}
.section-subtitle {
    color: var(--color-text-muted);
    font-weight: 400;
    font-size: 14px;
}
.section-lead {
    color: var(--color-text-soft);
    margin: -14px 0 24px;
    font-size: 14px;
}

/* ============================================================
   Range-Filter (Heute / 7 Tage / 30 Tage / Alles)
============================================================ */
.range-filter {
    display: inline-flex;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 4px;
    gap: 2px;
}
.range-btn {
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-soft);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}
.range-btn:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}
.range-btn.active {
    background: var(--color-text);
    color: var(--color-bg);
}

/* ============================================================
   Test-Cards
============================================================ */
.tests-list {
    display: grid;
    gap: 14px;
}
.test-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--color-text);
    transition: all 0.2s;
    display: block;
}
.test-card:hover {
    color: var(--color-text);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.test-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.test-card-title {
    font-size: 19px;
    font-weight: 600;
    margin: 0 0 4px;
}
.test-card-slug {
    display: inline-block;
    padding: 2px 8px;
    background: var(--color-surface-alt);
    color: var(--color-text-soft);
    border-radius: 6px;
    font-size: 12px;
}
.test-card-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.metric-label {
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.metric-value {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 22px;
    color: var(--color-text);
}
.metric-highlight .metric-value {
    color: var(--color-primary);
}

.winner-strip {
    margin-top: 14px;
    padding: 8px 14px;
    background: var(--color-success-soft);
    color: #46553B;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}
.winner-strip-gray {
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
}

/* ============================================================
   Badges
============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 11px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-active {
    background: var(--color-success-soft);
    color: #46553B;
}
.badge-paused {
    background: var(--color-warning-soft);
    color: #866436;
}
.badge-archived {
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
}

/* ============================================================
   Empty State
============================================================ */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
}
.empty-state p {
    margin: 0 0 20px;
    color: var(--color-text-soft);
}

/* ============================================================
   Forms
============================================================ */
.form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.form-wide {
    max-width: 720px;
}
.form-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 28px 30px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.form-section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 6px;
}
.form-section-lead {
    color: var(--color-text-soft);
    margin: 0 0 20px;
    font-size: 14px;
}
.field {
    display: block;
    margin-bottom: 16px;
}
.field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-soft);
    margin-bottom: 6px;
}
.field-optional {
    color: var(--color-text-muted);
    font-weight: 400;
    font-size: 11px;
    margin-left: 6px;
}
.field-hint {
    display: block;
    color: var(--color-text-muted);
    font-size: 12px;
    margin-top: 6px;
}
.field-error {
    display: block;
    color: var(--color-danger);
    font-size: 12px;
    margin-top: 6px;
}
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=url],
.field input[type=number],
.field textarea,
.field select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.slug-input {
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    overflow: hidden;
}
.slug-input:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.slug-prefix {
    padding: 11px 12px;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    font-size: 13px;
    white-space: nowrap;
    border-right: 1px solid var(--color-border);
}
.slug-input input {
    border: none !important;
    box-shadow: none !important;
    flex: 1;
    background: transparent !important;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.radio {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}
.radio:hover {
    background: var(--color-surface-alt);
}
.radio input {
    accent-color: var(--color-primary);
}

.variant-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}
.variant-badge {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
    border-radius: var(--radius-sm);
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 18px;
    margin-top: 22px;
}
.variant-fields {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 10px;
    padding-top: 8px;
}

/* ============================================================
   Login
============================================================ */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 140px);
    padding: 40px 20px;
}
.login-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}
.login-brand {
    text-align: center;
    margin-bottom: 28px;
}
.login-brand .brand-mark {
    margin-bottom: 16px;
}
.login-title {
    font-size: 28px;
    margin: 8px 0 4px;
}
.login-subtitle {
    color: var(--color-text-muted);
    margin: 0;
    font-size: 14px;
}

/* ============================================================
   Test-Detail: Copy-Karten
============================================================ */
.copy-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
@media (min-width: 900px) {
    .copy-grid {
        grid-template-columns: 1fr 1fr;
    }
}
.copy-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
}
.copy-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}
.copy-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--color-surface-alt);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 10px;
}
.copy-value {
    flex: 1;
    font-size: 13px;
    color: var(--color-text);
    word-break: break-all;
}
.copy-value-wrap {
    font-size: 11px;
    max-height: 40px;
    overflow: hidden;
}
.copy-hint {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--color-text-soft);
    line-height: 1.5;
}

/* ============================================================
   Variants-Grid (Test-Detail Statistik)
============================================================ */
.variants-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 28px;
}
@media (min-width: 800px) {
    .variants-grid {
        grid-template-columns: 1fr 1fr;
    }
}
.variant-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}
.variant-card-winner {
    border-color: var(--color-success);
    box-shadow: 0 0 0 3px var(--color-success-soft);
}
.variant-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.variant-card-badge {
    display: inline-block;
    padding: 5px 14px;
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
    border-radius: 100px;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 13px;
}
.variant-winner-badge {
    padding: 5px 12px;
    background: var(--color-success);
    color: #FFF;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.variant-card-url {
    display: block;
    color: var(--color-text-muted);
    font-size: 12px;
    margin: 10px 0 18px;
    word-break: break-all;
}
.variant-card-url:hover {
    color: var(--color-primary);
}
.variant-card-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.share-bar {
    height: 8px;
    background: var(--color-surface-alt);
    border-radius: 100px;
    overflow: hidden;
}
.share-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    transition: width 0.3s;
}
.share-label {
    margin-top: 6px;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ============================================================
   Winner-Banner
============================================================ */
.winner-banner {
    display: flex;
    align-items: baseline;
    gap: 10px;
    background: var(--color-success-soft);
    border: 1px solid var(--color-success);
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.winner-banner strong {
    color: #3E4B34;
    font-family: var(--font-serif);
    font-size: 16px;
}
.winner-banner span {
    color: #5D6B52;
    font-size: 14px;
}
.winner-banner-gray {
    background: var(--color-surface-alt);
    border-color: var(--color-border);
}
.winner-banner-gray strong {
    color: var(--color-text-soft);
}
.winner-banner-gray span {
    color: var(--color-text-muted);
}

/* ============================================================
   Chart-Card
============================================================ */
.chart-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px 26px;
    box-shadow: var(--shadow-sm);
}
.chart-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 18px;
    color: var(--color-text-soft);
}

/* ============================================================
   Responsive
============================================================ */
@media (max-width: 720px) {
    .topbar-inner {
        flex-wrap: wrap;
        gap: 12px;
    }
    .topnav {
        flex-basis: 100%;
        order: 3;
        gap: 14px;
    }
    .test-card-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    .variant-card-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    .form-section {
        padding: 22px 20px;
    }
}
