/* ===== CSS Custom Properties ===== */
:root {
    --fi-spacing-lg: 2rem;
    --fi-border-radius: 0.28571429rem;
    --fi-color-primary: rgb(83, 155, 245);
    --text-secondary: rgba(0, 0, 0, 0.6);
    --bg-secondary: #f8f9fa;
}

/* ===== Base / Reset ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4285em;
}

a { color: var(--fi-color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { margin-top: 0; }

hr {
    border: none;
    border-top: 1px solid #dee2e6;
    margin: 1rem 0;
}

img { max-width: 100%; }

table {
    border-collapse: collapse;
    width: 100%;
}

table th, table td {
    text-align: left;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid #dee2e6;
}

table th {
    font-weight: 600;
    background: #f8f9fa;
}

textarea, input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="url"], select {
    font-family: inherit;
    font-size: inherit;
    padding: 0.5rem 0.75rem;
    border: 1px solid #adb5bd !important;
    border-radius: var(--fi-border-radius);
    background: #fff;
    color: #212529;
}

textarea:focus, input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus, input[type="number"]:focus, input[type="url"]:focus, select:focus {
    outline: none;
    border-color: var(--fi-color-primary) !important;
    box-shadow: 0 0 0 2px rgba(33, 133, 208, 0.15);
}

/* FOUC prevention - body hidden until WA components load */
body:not(.wa-ready) { opacity: 0; }

/* ===== Layout: Hauptcontent + Footer ===== */
.hauptcontent {
    min-height: calc(100vh - 200px);
}

.footer {
    clear: both;
}

/* ===== Navbar ===== */
.fi-navbar {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    min-height: 50px;
    flex-wrap: wrap;
    gap: 0;
    background: rgb(6, 11, 23);
    color: #fff;
}

.fi-navbar a {
    color: var(--fi-color-primary);
    text-decoration: none;
}

.fi-navbar a:hover {
    color: #fff;
    text-decoration: none;
}

.fi-navbar > a:not(.fi-nav-brand) {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.fi-nav-brand {
    font-weight: 700;
    font-size: 1.2rem;
    padding: 0.5rem 0.75rem;
    margin-right: 0.5rem;
    color: #fff !important;
}

.fi-nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0;
}

.fi-nav-right > a {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* WA buttons in navbar use WA quiet token (Shadow DOM) */
.fi-navbar wa-button[appearance="plain"]::part(base) {
    color: var(--wa-color-on-quiet, var(--wa-color-neutral-on-quiet));
}

.fi-navbar wa-button[appearance="plain"]::part(caret) {
    color: var(--wa-color-on-quiet, var(--wa-color-neutral-on-quiet));
}

/* Light mode only: override tokens on host so shadow DOM picks them up */
:root:not(.wa-dark) .fi-navbar wa-button[appearance="plain"] {
    --wa-color-on-quiet: rgba(255, 255, 255, 0.7);
    --wa-color-neutral-on-quiet: rgba(255, 255, 255, 0.7);
    --wa-color-fill-quiet: rgba(255, 255, 255, 0.08);
    --wa-color-neutral-fill-quiet: rgba(255, 255, 255, 0.08);
}


/* ===== Footer ===== */
.fi-footer {
    padding: var(--fi-spacing-lg) 0;
    margin-top: var(--fi-spacing-lg);
    background: rgb(6, 11, 23);
    color: rgba(255, 255, 255, 0.85);
}

.fi-footer a {
    color: var(--fi-color-primary);
    text-decoration: none;
}

.fi-footer a:hover {
    color: #fff;
    text-decoration: underline;
}

.fi-footer h4 {
    margin-bottom: 0.5rem;
    color: #fff;
}

.fi-footer p {
    line-height: 1.8;
    margin: 0;
}

/* ===== Table Hover Rows ===== */
.wa-hover-rows tr:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* ===== Section Headers ===== */
.section-header {
    text-align: center;
    padding: 1rem;
    background: var(--wa-color-gray-95, #f8f9fa);
    color: var(--wa-color-gray-10, #212529);
    border-radius: 4px;
    margin: 0;
}

.section-header-card {
    padding: 0.65rem 1rem;
    background: var(--wa-color-gray-95, #f8f9fa);
    color: #6c757d;
    border-radius: 4px 4px 0 0;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.wa-dark .section-header-card {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.55);
}

/* ===== Integration Info Tables ===== */
.integration-info {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.integration-info td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--wa-color-neutral-90, #e9ecef);
}

.integration-info tr:last-child td {
    border-bottom: none;
}

.integration-info td:first-child {
    color: #6c757d;
    white-space: nowrap;
    width: 1%;
}

.wa-dark .integration-info td {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

.wa-dark .integration-info td:first-child {
    color: rgba(255, 255, 255, 0.45);
}

/* ===== Utility: Margin Bottom ===== */
.mb-2 { margin-bottom: 0.5rem; }

/* ===== Theme Toggle Button ===== */
.theme-toggle {
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    color: var(--fi-color-primary);
    transition: color 0.2s;
}

.theme-toggle:hover {
    color: #fff;
}

/* ===== wa-card spacing ===== */
/* Card spacing is handled by parent layout containers (wa-grid gap, wa-stack gap). */

/* ===== WA Progress Bar & Badge defaults (blue instead of brand/purple) ===== */
wa-progress-bar {
    --indicator-color: #2185d0;
    --track-color: #e9ecef;
}

wa-badge:not([variant]),
wa-badge[variant="brand"],
wa-badge[variant="neutral"] {
    --wa-color-fill-loud: #2185d0;
    --wa-color-on-loud: #fff;
    --wa-color-fill-normal: rgba(33, 133, 208, 0.15);
    --wa-color-on-normal: #2185d0;
    --wa-color-border-loud: #2185d0;
}

/* Brand buttons/elements use blue instead of WA purple */
wa-button[variant="brand"] {
    --wa-color-fill-loud: #2185d0;
    --wa-color-on-loud: #fff;
    --wa-color-fill-quiet: rgba(33, 133, 208, 0.1);
    --wa-color-on-quiet: #2185d0;
}


/* ===== Duration/Cost Display (musicbot templates) ===== */
.duration-display,
.cost-display {
    font-weight: 600;
}

/* ===== Magic Link Wizard Stepper ===== */
.magic-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 80px;
}

.magic-step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    border: 2px solid var(--wa-color-neutral-fill-loud, #adb5bd);
    color: var(--wa-color-neutral-fill-loud, #adb5bd);
    background: transparent;
    transition: all 0.3s ease;
}

.magic-step-indicator.active .magic-step-circle {
    border-color: var(--fi-color-primary);
    background: var(--fi-color-primary);
    color: #fff;
}

.magic-step-indicator.completed .magic-step-circle {
    border-color: var(--wa-color-success-600, #16a34a);
    background: var(--wa-color-success-600, #16a34a);
    color: #fff;
}

.magic-step-label {
    font-size: 0.75rem;
    text-align: center;
    color: var(--wa-color-neutral-fill-loud, #adb5bd);
    transition: color 0.3s ease;
}

.magic-step-indicator.active .magic-step-label {
    color: var(--fi-color-primary);
    font-weight: 600;
}

.magic-step-indicator.completed .magic-step-label {
    color: var(--wa-color-success-600, #16a34a);
}

.magic-step-line {
    flex: 1;
    height: 2px;
    background: var(--wa-color-neutral-fill-loud, #adb5bd);
    margin-top: 18px;
    min-width: 40px;
    transition: background 0.3s ease;
}

.magic-step-line.completed {
    background: var(--wa-color-success-600, #16a34a);
}

.magic-step-content {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.magic-step-content > * {
    width: 100%;
}

/* ===== Keyframes ===== */
@keyframes fi-wave {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
