/* ==========================================================================
   DLHub - MP3 and Video Converter Script
   Designsystem (aufbauend auf Bootstrap 5)

   Alle Farben stammen aus den Theme-Variablen, die serverseitig im <head>
   gesetzt werden (siehe App\Core\Theme). Ein Themewechsel ändert damit das
   gesamte Erscheinungsbild – Frontend wie Adminbereich – ohne Codeänderung.

   Copyright by Theveloper
   ========================================================================== */

:root {
    /* Rückfallwerte – werden vom Theme überschrieben */
    --dh-primary:      #2563eb;
    --dh-primary-dark: #1d4ed8;
    --dh-accent:       #4f46e5;
    --dh-primary-rgb:  37, 99, 235;
    --dh-gradient:     linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);

    --dh-radius:       1rem;
    --dh-radius-lg:    1.4rem;
    --dh-shadow-sm:    0 1px 2px rgba(20, 24, 40, .05), 0 4px 16px rgba(20, 24, 40, .06);
    --dh-shadow:       0 2px 4px rgba(20, 24, 40, .05), 0 12px 32px rgba(20, 24, 40, .10);
    --dh-shadow-lg:    0 4px 8px rgba(20, 24, 40, .06), 0 24px 64px rgba(var(--dh-primary-rgb), .16);

    /* Systemschrift: schnell und datenschutzfreundlich (keine externen Fonts) */
    --dh-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
               Arial, 'Noto Sans', 'Liberation Sans', sans-serif;

    --dh-tint-6:  rgba(var(--dh-primary-rgb), .06);
    --dh-tint-10: rgba(var(--dh-primary-rgb), .10);
    --dh-tint-16: rgba(var(--dh-primary-rgb), .16);
    --dh-tint-28: rgba(var(--dh-primary-rgb), .28);

    --bs-body-font-family: var(--dh-font);
}

[data-bs-theme="dark"] {
    --dh-shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --dh-shadow:    0 2px 4px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
    --dh-shadow-lg: 0 4px 8px rgba(0, 0, 0, .3), 0 24px 64px rgba(var(--dh-primary-rgb), .22);
}

/* --------------------------------------------------------------- Grundlagen */
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
html, body { min-height: 100%; }

body {
    display: flex;
    flex-direction: column;
    font-family: var(--dh-font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body, .card, .navbar, .form-control, .form-select, .accordion-item, .dh-footer {
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Sichtbarer Fokus für Tastaturbedienung (Barrierefreiheit) */
a:focus-visible,
button:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.dh-type-btn:focus-visible,
.dh-icon-btn:focus-visible {
    outline: 3px solid rgba(var(--dh-primary-rgb), .45);
    outline-offset: 2px;
}

.dh-skip-link {
    position: absolute; top: .5rem; left: .5rem; z-index: 2000;
    background: var(--bs-body-bg); padding: .5rem 1rem; border-radius: .5rem;
    box-shadow: var(--dh-shadow-sm);
}

.dh-narrow { max-width: 34rem; margin-left: auto; margin-right: auto; }

/* --------------------------------------------------------------- Navigation */
.dh-navbar {
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color-translucent);
}
@supports (backdrop-filter: blur(12px)) {
    .dh-navbar {
        background: rgba(var(--bs-body-bg-rgb), .82);
        backdrop-filter: saturate(180%) blur(12px);
        -webkit-backdrop-filter: saturate(180%) blur(12px);
    }
}
.dh-navbar .nav-link { font-weight: 500; border-radius: .6rem; padding: .45rem .85rem; }
.dh-navbar .nav-link:hover,
.dh-navbar .nav-link:focus { background: var(--bs-secondary-bg); }

.dh-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.1rem; height: 2.1rem; border-radius: .65rem;
    background: var(--dh-gradient);
    box-shadow: 0 4px 12px rgba(var(--dh-primary-rgb), .35);
}

.dh-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.4rem; height: 2.4rem; border-radius: .7rem;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color); background: transparent;
}
.dh-icon-btn:hover { background: var(--bs-secondary-bg); }

/* --------------------------------------------------------------- Buttons */
.btn { border-radius: .75rem; font-weight: 600; }

.btn-gradient {
    background: var(--dh-gradient);
    color: #fff;
    border: none;
    /* Bewusst OHNE Schatten: Der weiche Schatten wurde beim Zusammenspiel aus
       Verlauf und Transformation in manchen Browsern fehlerhaft gezeichnet –
       sichtbar als harte Kante beim Überfahren mit der Maus. Die Fläche trägt
       durch den Farbverlauf ohnehin genug. */
    box-shadow: none;
    transition: filter .15s ease;
}
.btn-gradient:hover, .btn-gradient:focus {
    color: #fff;
    filter: brightness(1.07);
    box-shadow: none;
}
.btn-gradient:active { filter: brightness(.95); box-shadow: none; }
.btn-gradient:disabled { background: var(--dh-gradient); color: #fff; opacity: .65; box-shadow: none; }

.btn-outline-primary {
    --bs-btn-color: var(--dh-primary-dark);
    --bs-btn-border-color: var(--dh-primary);
    --bs-btn-hover-bg: var(--dh-primary);
    --bs-btn-hover-border-color: var(--dh-primary);
    --bs-btn-focus-shadow-rgb: var(--dh-primary-rgb);
}
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: var(--dh-primary); }

/* --------------------------------------------------------------- Hero */
.dh-hero {
    position: relative;
    padding: 4.5rem 0 3.5rem;
    background: linear-gradient(180deg, var(--dh-tint-10) 0%, transparent 70%);
    overflow: hidden;
}
.dh-hero::before {
    content: "";
    position: absolute; inset: -40% -20% auto -20%; height: 80%;
    background:
        radial-gradient(38% 55% at 22% 40%, var(--dh-tint-16), transparent 70%),
        radial-gradient(32% 50% at 78% 30%, var(--dh-tint-10), transparent 70%);
    pointer-events: none;
}
.dh-hero > .container { position: relative; }
.dh-hero-inner { max-width: 46rem; }

.dh-badge {
    display: inline-flex; align-items: center;
    padding: .45rem 1rem; border-radius: 100rem;
    background: var(--dh-tint-10);
    border: 1px solid var(--dh-tint-28);
    color: var(--dh-primary-dark);
    font-size: .85rem; font-weight: 600;
    margin-bottom: 1.25rem;
}
[data-bs-theme="dark"] .dh-badge { color: var(--dh-primary); }

.dh-hero-title {
    font-size: clamp(2.1rem, 5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
    margin-bottom: 1rem;
}
@supports (-webkit-background-clip: text) or (background-clip: text) {
    .dh-hero-title {
        background: linear-gradient(135deg, var(--bs-emphasis-color) 30%, var(--dh-primary) 100%);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}
.dh-hero-sub {
    font-size: 1.15rem;
    color: var(--bs-secondary-color);
    max-width: 40rem;
    margin: 0 auto 2.25rem;
    line-height: 1.65;
}

/* --------------------------------------------------------------- Downloadfeld */
.dh-download-card, .dh-flow-card, .dh-alert {
    max-width: 46rem;
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--dh-radius-lg);
    background: var(--bs-body-bg);
}
.dh-download-card { box-shadow: var(--dh-shadow-lg); }
.dh-flow-card     { box-shadow: var(--dh-shadow); }

.dh-field-label {
    font-size: .82rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--bs-secondary-color);
}

.dh-url-group { display: flex; gap: .6rem; flex-wrap: wrap; }
.dh-url-input {
    flex: 1 1 16rem;
    border-radius: .85rem;
    padding: .8rem 1.1rem;
    border: 1.5px solid var(--bs-border-color);
    font-size: 1rem;
}
.dh-url-input:focus {
    border-color: var(--dh-primary);
    box-shadow: 0 0 0 .25rem rgba(var(--dh-primary-rgb), .15);
}
.dh-analyze-btn { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 575.98px) {
    .dh-analyze-btn { flex: 1 1 100%; }
}

.dh-limit-note { color: var(--bs-secondary-color); }

.dh-prefill-note {
    border-radius: .8rem;
    background: var(--dh-tint-10);
    border: 1px solid var(--dh-tint-28);
    padding: .7rem 1rem;
    font-size: .92rem;
}

.dh-captcha { display: flex; justify-content: center; }

/* --------------------------------------------------------------- Verbindungsstatus */
.dh-conn-bar {
    border: 1px dashed var(--bs-border-color);
    border-radius: var(--dh-radius);
    padding: .9rem 1.1rem;
    background: var(--bs-tertiary-bg);
}
.dh-conn-brand { font-weight: 700; }
.dh-conn-brand .bi-youtube { color: #ff0033; }

.dh-status-pill {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .3rem .8rem; border-radius: 100rem;
    font-size: .85rem; font-weight: 600;
    background: var(--bs-secondary-bg); color: var(--bs-secondary-color);
    border: 1px solid var(--bs-border-color-translucent);
}
.dh-status-dot { width: .55rem; height: .55rem; border-radius: 50%; background: #9ca3af; }
.dh-status-pill[data-state="active"] { background: rgba(16, 185, 129, .12); color: #047857; border-color: rgba(16, 185, 129, .3); }
.dh-status-pill[data-state="active"] .dh-status-dot { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .2); }
.dh-status-pill[data-state="stale"]  { background: rgba(245, 158, 11, .12); color: #b45309; border-color: rgba(245, 158, 11, .3); }
.dh-status-pill[data-state="stale"] .dh-status-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }
[data-bs-theme="dark"] .dh-status-pill[data-state="active"] { color: #34d399; }
[data-bs-theme="dark"] .dh-status-pill[data-state="stale"]  { color: #fbbf24; }

/* --------------------------------------------------------------- Ablauf-Karten */
.dh-alert {
    border-radius: var(--dh-radius);
    background: rgba(220, 38, 38, .08);
    border: 1px solid rgba(220, 38, 38, .25);
    color: #b91c1c;
}
[data-bs-theme="dark"] .dh-alert { color: #fca5a5; }

.dh-prompt-card { border-color: var(--dh-tint-28); }
.dh-prompt-icon {
    width: 3.2rem; height: 3.2rem; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    border-radius: 1rem; font-size: 1.4rem; color: #fff;
    background: var(--dh-gradient);
    box-shadow: 0 6px 18px rgba(var(--dh-primary-rgb), .35);
}

.dh-thumb { object-fit: cover; aspect-ratio: 16 / 9; background: var(--bs-secondary-bg); min-height: 90px; }
.dh-chip {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color-translucent);
    font-weight: 500;
    padding: .45em .8em;
    border-radius: .6rem;
}

.dh-type-switch {
    display: flex; gap: .6rem; flex-wrap: wrap;
    background: var(--bs-tertiary-bg);
    padding: .4rem; border-radius: var(--dh-radius);
    border: 1px solid var(--bs-border-color-translucent);
}
.dh-type-btn {
    flex: 1 1 12rem;
    display: flex; align-items: center; justify-content: center; gap: .55rem;
    padding: .75rem 1rem;
    border: 1.5px solid transparent;
    border-radius: .8rem;
    background: transparent;
    color: var(--bs-secondary-color);
    font-weight: 600;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.dh-type-btn:hover { color: var(--bs-body-color); }
.dh-type-btn.active {
    background: var(--bs-body-bg);
    color: var(--dh-primary-dark);
    border-color: var(--dh-tint-28);
    box-shadow: var(--dh-shadow-sm);
}
[data-bs-theme="dark"] .dh-type-btn.active { color: var(--dh-primary); }

/* Fortschritt */
.dh-progress { height: .9rem; border-radius: 100rem; background: var(--bs-secondary-bg); }
.dh-progress-bar { background: var(--dh-gradient); border-radius: 100rem; transition: width .5s ease; }
.dh-spin { display: inline-block; animation: dh-spin 1.4s linear infinite; }
@keyframes dh-spin { to { transform: rotate(360deg); } }

.dh-done-icon {
    width: 4rem; height: 4rem; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 1.8rem; color: #fff;
    background: linear-gradient(135deg, #10b981, #047857);
    box-shadow: 0 8px 24px rgba(16, 185, 129, .4);
    animation: dh-pop .4s ease;
}
@keyframes dh-pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* --------------------------------------------------------------- Sektionen */
.dh-section { padding: 4.5rem 0; }
.dh-section-alt { background: var(--bs-tertiary-bg); }
.dh-section-title { font-size: clamp(1.6rem, 3.5vw, 2.2rem); font-weight: 800; letter-spacing: -.02em; }
.dh-section-sub { color: var(--bs-secondary-color); font-size: 1.05rem; max-width: 44rem; margin-left: auto; margin-right: auto; }

.dh-card {
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--dh-radius-lg);
    box-shadow: var(--dh-shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease;
}
.dh-card:hover { transform: translateY(-3px); box-shadow: var(--dh-shadow); }

.dh-feature-icon {
    width: 2.9rem; height: 2.9rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: .9rem; font-size: 1.25rem; color: #fff;
    background: var(--dh-gradient);
    box-shadow: 0 5px 14px rgba(var(--dh-primary-rgb), .3);
}

.dh-steps { list-style: none; counter-reset: step; padding-left: 0; margin-bottom: 1.25rem; }
.dh-steps li {
    counter-increment: step;
    position: relative;
    padding-left: 2.6rem;
    margin-bottom: .9rem;
    line-height: 1.55;
}
.dh-steps li::before {
    content: counter(step);
    position: absolute; left: 0; top: 0;
    width: 1.8rem; height: 1.8rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: .6rem;
    background: var(--dh-tint-10);
    color: var(--dh-primary-dark);
    font-weight: 700; font-size: .85rem;
    border: 1px solid var(--dh-tint-28);
}
[data-bs-theme="dark"] .dh-steps li::before { color: var(--dh-primary); }

.dh-callout {
    max-width: 52rem;
    border-radius: var(--dh-radius-lg);
    border: 1px solid var(--dh-tint-28);
    background: var(--dh-tint-6);
    padding: 2rem;
}
.dh-callout-icon {
    width: 2.9rem; height: 2.9rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 1.25rem; color: #fff;
    background: var(--dh-gradient);
}
.dh-callout-mini {
    border-radius: .8rem;
    background: var(--dh-tint-10);
    border: 1px solid var(--dh-tint-28);
    padding: .75rem 1rem;
    font-size: .92rem;
}
.dh-help-box {
    border-radius: .8rem;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color-translucent);
    padding: 1rem 1.25rem;
}

.dh-platform-chip {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .55rem 1.1rem;
    border-radius: 100rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    font-weight: 600; font-size: .95rem;
    box-shadow: var(--dh-shadow-sm);
}
.dh-platform-chip .bi-youtube   { color: #ff0033; }
.dh-platform-chip .bi-facebook  { color: #1877f2; }
.dh-platform-chip .bi-instagram { color: #e4405f; }
.dh-platform-chip .bi-twitter-x { color: var(--bs-emphasis-color); }

/* FAQ */
.dh-accordion { max-width: 48rem; }
.dh-accordion .accordion-item {
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--dh-radius) !important;
    margin-bottom: .8rem;
    overflow: hidden;
    background: var(--bs-body-bg);
    box-shadow: var(--dh-shadow-sm);
}
.dh-accordion .accordion-button { font-weight: 600; padding: 1.1rem 1.35rem; background: transparent; box-shadow: none; }
.dh-accordion .accordion-button:not(.collapsed) { color: var(--dh-primary-dark); background: var(--dh-tint-6); }
[data-bs-theme="dark"] .dh-accordion .accordion-button:not(.collapsed) { color: var(--dh-primary); }
.dh-accordion .accordion-button:focus { box-shadow: 0 0 0 .2rem rgba(var(--dh-primary-rgb), .15); }
.dh-accordion .accordion-body { line-height: 1.7; }

/* CTA */
.dh-cta {
    max-width: 52rem;
    border-radius: var(--dh-radius-lg);
    background: var(--dh-gradient);
    color: #fff;
    padding: 3.5rem 2rem;
    box-shadow: var(--dh-shadow-lg);
}
.dh-cta .dh-section-title, .dh-cta .dh-section-sub { color: #fff; }
.dh-cta .dh-section-sub { opacity: .88; }

/* Footer */
.dh-footer { border-top: 1px solid var(--bs-border-color-translucent); background: var(--bs-tertiary-bg); }
.dh-footer-about { max-width: 36ch; }
.dh-footer-links li { margin-bottom: .55rem; }
.dh-footer-links a { color: var(--bs-secondary-color); text-decoration: none; }
.dh-footer-links a:hover, .dh-footer-links a:focus { color: var(--dh-primary); text-decoration: underline; }

/* Fehlerseite */
.dh-error-icon {
    width: 5rem; height: 5rem; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    border-radius: 1.4rem; font-size: 2.2rem; color: #fff;
    background: var(--dh-gradient);
    box-shadow: var(--dh-shadow-lg);
}

/* Einblend-Animationen (per JS gesteuert, respektiert reduced motion) */
.dh-reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.dh-reveal.visible { opacity: 1; transform: none; }

/* Modal */
.dh-modal { border-radius: var(--dh-radius-lg); border: none; box-shadow: var(--dh-shadow-lg); }
.dh-modal-note { max-width: 32ch; }

/* ==========================================================================
   Adminbereich
   ========================================================================== */
.admin-sidebar { background: var(--bs-body-bg); }
.admin-sidebar .nav-link {
    color: var(--bs-body-color);
    border-radius: .6rem;
    padding: .55rem .8rem;
    font-weight: 500;
    display: flex; align-items: center; gap: .55rem;
}
.admin-sidebar .nav-link.active { background: var(--dh-primary); color: #fff; }
.admin-sidebar .nav-link:hover:not(.active) { background: var(--bs-secondary-bg); }
.admin-sidebar .nav-section {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--bs-secondary-color); font-weight: 700;
    padding: 1rem .8rem .35rem;
}

.admin-main { min-height: 100vh; }

.stat-card { border-radius: var(--dh-radius); }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }

.card { border: 1px solid var(--bs-border-color); border-radius: var(--dh-radius); }
.card-header { background: transparent; border-bottom: 1px solid var(--bs-border-color-translucent); font-weight: 600; }

.table-responsive { border-radius: .5rem; }
code.inline { background: var(--bs-secondary-bg); padding: .1rem .35rem; border-radius: .25rem; word-break: break-all; }
pre.dh-pre {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: .6rem;
    padding: .85rem 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: .84rem;
    max-height: 22rem;
    overflow: auto;
    margin-bottom: 0;
}

.nav-tabs .nav-link { font-weight: 600; color: var(--bs-secondary-color); }
.nav-tabs .nav-link.active { color: var(--dh-primary-dark); }
[data-bs-theme="dark"] .nav-tabs .nav-link.active { color: var(--dh-primary); }

.dh-theme-swatch {
    display: inline-block; width: 1rem; height: 1rem;
    border-radius: 50%; vertical-align: -2px; margin-right: .4rem;
    border: 1px solid var(--bs-border-color);
}

.dh-setting-hint { font-size: .82rem; color: var(--bs-secondary-color); }

@media (max-width: 767.98px) {
    .dh-section { padding: 3rem 0; }
    .dh-hero { padding: 3rem 0 2.5rem; }
    .admin-sidebar { border-bottom: 1px solid var(--bs-border-color); }
}
