/* ============================================================
   IHK Dashboard Styles
   Version: 2026-05-02
   ============================================================ */


/* ------------------------------------------------------------
   Container
   ------------------------------------------------------------ */

#dashboard-container {
    font-family: 'Source Sans 3', -apple-system, 'Segoe UI', sans-serif;
    font-size: 16px;
    color: #1a1a2e;
    line-height: 1.5;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    /* Aus dem eingeschränkten Content-Container herausbrechen, mit seitlichem Atemraum */
    width: calc(100vw - 48px);
    margin-left: calc(50% - 50vw + 24px);
}


/* ------------------------------------------------------------
   Tab-Leiste
   ------------------------------------------------------------ */

#dashboard-tabs {
    background: #e4eef5;
    display: flex;
    align-items: center;
    padding-right: 28px;
}

#dashboard-tabs .db-cachestatus {
    margin-left: auto;
    font-size: 14px;
    color: #6b7280;
}

#dashboard-tabs .db-analytics-refresh {
    /* Klein, dezent, dreht sich beim Klick (fa-spin via JS).
       margin-left: auto greift, wenn keine db-cachestatus davor liegt
       (Cache leer). Mit Cachestatus überschreibt der Selektor unten. */
    margin-left: auto;
    padding: 6px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#dashboard-tabs .db-cachestatus + .db-analytics-refresh {
    margin-left: 10px;
}

#dashboard-tabs .db-analytics-refresh:hover:not(:disabled) {
    background: #fff;
    border-color: #cbd5e1;
    color: #1e293b;
}

#dashboard-tabs .db-analytics-refresh:disabled {
    cursor: wait;
    opacity: 0.65;
}

#dashboard-tabs .tab {
    padding: 20px 32px;
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border: none;
    border-bottom: 3px solid transparent;
    background: none;
    display: inline-block;
    font-family: inherit;
    line-height: inherit;
}

#dashboard-tabs .tab.active,
#dashboard-tabs .tab:focus {
    color: #1a1a2e;
    border-bottom-color: #ed7123;
}


/* ------------------------------------------------------------
   Filterleiste
   ------------------------------------------------------------ */

#dashboard-filters {
    background: #f7f8fa;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 28px 24px;
    margin-top: 8px;
    flex-wrap: wrap;
    --filter-label-width: 80px;
}

#dashboard-filters label {
    font-size: 14px;
    color: #4b5563;
    font-weight: 600;
}

#dashboard-filters select {
    background: #faf0e6;
    border: 1px solid #e0cfc0;
    border-radius: 6px;
    padding: 8px 32px 8px 14px;
    font-size: 16px;
}

#dashboard-filters .filter-vs {
    font-size: 14px;
    color: #9ca3af;
    font-weight: 600;
}

#dashboard-filters button[type="submit"],
#dashboard-filters .filter-submit {
    background: #ed7123;
    color: #fff;
    border: none;
    border-radius: 25px;
    padding: 10px 24px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    white-space: nowrap;
}

/* Filtergruppen: je ein Flex-Block, der als Einheit umbricht */
.db-filter-group {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

/* Theme-Margin auf Labels in Gruppen entfernen */
.db-filter-group label {
    margin: 0;
}

/* Actions-Gruppe (Button + Icon): Box-Mitte statt Textbasis */
.db-filter-group--actions {
    align-items: center;
}

/* Zeiträume-Label (Periods-Gruppe): nur bei Umbruch sichtbar */
.db-label-responsive {
    display: none;
}

/* Responsive: unter 1200px → jede Gruppe in eigener Zeile,
   Zeiträume-Label einblenden, Labels auf einheitliche Breite */
@media (max-width: 1200px) {
    .db-filter-group {
        flex-basis: 100%;
    }

    .db-label-responsive {
        display: block;
    }

    .db-filter-group label {
        min-width: var(--filter-label-width);
    }

    /* Button bündig mit den Selects darunter */
    .db-filter-group--actions {
        padding-left: calc(var(--filter-label-width) + 10px);
    }
}


/* ------------------------------------------------------------
   Copy-Link Button
   ------------------------------------------------------------ */

.db-copy-link {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 25px;
    padding: 8px 12px;
    cursor: pointer;
    color: #6b7280;
    font-size: 16px;
}

.db-copy-link:hover {
    color: #374151;
    border-color: #9ca3af;
}

.db-copy-link--copied {
    color: #16a34a;
    border-color: #16a34a;
}


/* ------------------------------------------------------------
   Sektions-Header
   ------------------------------------------------------------ */

.db-section-title {
    font-size: 18px;
    color: #1a1a2e;
    font-weight: 700;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 10px;
    padding-left: 28px;
    padding-right: 28px;
    margin-top: 24px;
}


/* ------------------------------------------------------------
   Card Grid
   ------------------------------------------------------------ */

.db-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 12px 28px 24px;
}

.db-grid--single {
    grid-template-columns: 1fr;
}


/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */

.db-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.db-card-accent {
    height: 4px;
}

.db-card-body {
    padding: 20px 24px;
}

.db-card-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    font-weight: 700;
}

/* Card color modifiers (accent bar) */

.db-card--zertifikate .db-card-accent {
    background: #1a79bf;
}

.db-card--seminare .db-card-accent {
    background: #edac1a;
}

.db-card--beratungstage .db-card-accent {
    background: #14794b;
}

.db-card--beratungen .db-card-accent {
    background: #a0325c;
}

.db-card--website .db-card-accent {
    background: #ed7123;
}

.db-card--newsletter .db-card-accent {
    background: #c46210;
}

.db-card--youtube .db-card-accent {
    background: #ed233a;
}

.db-card--linkedin .db-card-accent {
    background: #0a66c2;
}


/* ------------------------------------------------------------
   Hero Numbers
   ------------------------------------------------------------ */

.db-hero {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 16px;
}

.db-hero-num {
    font-size: 42px;
    font-weight: 700;
    line-height: 1;
    color: #1a1a2e;
}

.db-hero-label {
    font-size: 16px;
    color: #4b5563;
}


/* ------------------------------------------------------------
   Data Rows
   ------------------------------------------------------------ */

.db-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 16px;
}

.db-row-label {
    color: #374151;
}

.db-row-value {
    font-weight: 600;
    color: #1a1a2e;
}

.db-row-value--positive {
    color: #16a34a;
}


/* ------------------------------------------------------------
   Beratungstage Rows
   ------------------------------------------------------------ */

.db-check-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 16px;
}

.db-check-name {
    flex: 1;
    color: #374151;
}

.db-check-stats {
    display: flex;
    gap: 20px;
    font-weight: 600;
    color: #1a1a2e;
}

.db-check-icon {
    font-size: 14px;
    color: #6b7280;
    margin-right: 4px;
}

.db-check-legend {
    display: flex;
    gap: 20px;
    padding: 6px 0 0;
    font-size: 13px;
    color: #6b7280;
}


/* ------------------------------------------------------------
   Event Lists
   ------------------------------------------------------------ */

.db-events {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.db-events-title {
    font-size: 14px;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 6px;
}

.db-events ol {
    padding-left: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #374151;
    list-style: decimal inside;
    margin: 0;
}

.db-events li {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hide items beyond 3 unless expanded */
.db-events:not(.db-events--expanded) li:nth-child(n+4) {
    display: none;
}

.db-events-toggle {
    font-size: 14px;
    color: #6b7280;
    cursor: pointer;
    border: none;
    background: none;
    padding: 4px 0;
}

.db-events-toggle:hover {
    color: #374151;
}


/* ------------------------------------------------------------
   Chart Cards
   ------------------------------------------------------------ */

.db-chart-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.db-chart-card--full {
    grid-column: 1 / -1;
}

.db-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 8px;
}

.db-chart-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
}

.db-chart-legend {
    display: flex;
    gap: 16px;
    font-size: 14px;
}

.db-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #4b5563;
}

.db-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.db-chart-area {
    padding: 8px 20px 20px;
}

.dashboard-renderarea {
    width: 100%;
    height: 300px;
}


/* ------------------------------------------------------------
   Cachestatus
   ------------------------------------------------------------ */

/* ------------------------------------------------------------
   Dashboard Body (Content-Bereich)
   ------------------------------------------------------------ */

#dashboard-body {
    background: #f7f8fa;
    padding-top: 12px;
    padding-bottom: 28px;
}


.db-cachestatus {
    font-size: 14px;
    color: #6b7280;
}


/* ------------------------------------------------------------
   Fade-In Animation
   ------------------------------------------------------------ */

.dashboard-fading-hide {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.dashboard-fading-show {
    opacity: 1;
    transform: translateY(0);
}


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

@media (max-width: 1365px) {
    .db-grid--produkte {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .db-grid {
        grid-template-columns: 1fr;
    }
}

/* === Analytics-Tab === */

.db-grid--analytics-global,
.db-grid--analytics-bereiche,
.db-grid--analytics-konversionen {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
}
@media (max-width: 767px) {
	.db-grid--analytics-global,
	.db-grid--analytics-bereiche,
	.db-grid--analytics-konversionen {
		grid-template-columns: 1fr;
	}
}

.db-analytics-card {
	background: white;
	border-radius: 6px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
	/* Default-Akzent: dezenter, neutraler Top-Border, damit auch Cards ohne
	   semantischen Modifier einen sauberen Rand haben (keine "rahmenlosen"
	   Top-Listen mehr). Modifier überschreiben nur die Farbe. */
	border-top: 4px solid #cbd5e1;
	padding: 20px;
}
.db-analytics-card--global,
.db-analytics-card--channels { border-top-color: #3b82f6; }
.db-analytics-card--bereich  { border-top-color: #10b981; }
.db-analytics-card--konversion { border-top-color: #f59e0b; }
.db-analytics-card--devices { border-top-color: #8b5cf6; }
.db-analytics-card--coming-soon {
	background: #fafafa;
	color: #94a3b8;
	font-style: italic;
	/* Dashed signalisiert "noch nicht fertig" — bewusster Stil statt
	   blassgrauer Standardrand, der nach Bug aussieht. */
	border-top-style: dashed;
	border-top-color: #cbd5e1;
}

/* Card-Überschrift im Analytics-Tab: identische Optik wie .db-card-title in
   den Details-Cards, leicht angehoben für bessere Lesbarkeit. */
.db-analytics-card .db-label,
.db-twocol-item .db-label,
.db-analytics-section .db-section-title {
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #6b7280;
	font-weight: 700;
	margin-bottom: 12px;
}
/* Section-Title in .db-analytics-section ist eigenständige Headline → kein
   uppercase-Override durch obige Regel; eigene Variante rückgängig machen. */
.db-analytics-section > .db-section-title {
	font-size: 18px;
	text-transform: none;
	letter-spacing: normal;
	color: #1a1a2e;
}

/* Default-Look für Big-Number-Display in Analytics-Cards (Konversionen u. ä.).
   .db-stat-grid und .db-twocol-item überschreiben diese Werte für ihre
   eigenen Layouts. */
.db-analytics-card .db-num { font-size: 36px; font-weight: 700; color: #0f172a; line-height: 1.1; display: block; }
.db-analytics-card .db-num-label { font-size: 16px; color: #374151; display: block; margin-top: 4px; }

.db-stat-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
}
.db-stat-grid > div { display: flex; flex-direction: column; gap: 4px; }
.db-stat-grid .db-num { font-size: 32px; }
.db-stat-grid .db-num-label { font-size: 16px; color: #374151; }

.db-stat-row { font-size: 16px; color: #374151; margin: 10px 0 14px; }
.db-stat-row strong { color: #0f172a; font-weight: 700; }

/* Spaltenüberschriften für die Listen ("Abrufe" / "%"): klein, uppercase,
   gedämpfter Grauton — gleicher Stil wie .db-card-title, nur kleiner. */
.db-toplist-head,
.db-channel-head {
	display: grid;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #94a3b8;
	font-weight: 600;
	padding: 0 0 4px;
	border-bottom: 1px solid #f1f5f9;
}
.db-toplist-head { grid-template-columns: 1fr auto; gap: 10px; }
.db-channel-head { grid-template-columns: 1fr 7ch 7ch; gap: 14px; }
.db-toplist-head-value,
.db-channel-head-value,
.db-channel-head-pct { text-align: right; white-space: nowrap; }

.db-device-head {
	display: grid;
	grid-template-columns: auto 1fr 7ch 7ch;
	gap: 14px;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #94a3b8;
	font-weight: 600;
	padding: 0 0 4px;
	border-bottom: 1px solid #f1f5f9;
}
.db-device-head-value,
.db-device-head-pct { text-align: right; white-space: nowrap; }
.db-device-legend-wrap { min-width: 0; }

.db-toplist { padding-left: 0; margin: 0; list-style: none; }
.db-toplist--small { font-size: 16px; line-height: 1.55; }
.db-toplist li { padding: 6px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.db-toplist-icon { width: 18px; height: 18px; flex-shrink: 0; object-fit: contain; }
.db-toplist-label { color: #f97316; flex: 1; min-width: 0; }
.db-toplist-value { color: #374151; font-variant-numeric: tabular-nums; }

.db-channel-list { list-style: none; padding: 0; margin: 8px 0 0; }
/* Visits- und Prozent-Spalte rechtsbündig mit fester Mindestbreite, damit
   Zahlen über alle Zeilen sauber an einer Kante stehen. */
.db-channel-list li { display: grid; grid-template-columns: 1fr 7ch 7ch; gap: 14px; padding: 7px 0; font-size: 16px; }
.db-channel-name { color: #0f172a; display: inline-flex; align-items: center; gap: 6px; }
.db-channel-visits { color: #374151; font-variant-numeric: tabular-nums; text-align: right; }
.db-channel-pct { color: #4b5563; font-variant-numeric: tabular-nums; text-align: right; }

/* Info-Icon mit eigenem Tooltip — Hover/Focus/Klick zeigt eine Sprechblase
   neben dem Icon. Eigener Tooltip statt title-Attribut, weil native
   Browser-Tooltips erst nach ~1.5 s erscheinen und nicht per Klick triggerbar
   sind. */
.db-info {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	padding: 0;
	border: none;
	background: transparent;
	color: #94a3b8;
	cursor: help;
	font-size: 15px;
	line-height: 1;
}
.db-info:hover,
.db-info:focus { color: #2563eb; outline: none; }
.db-info:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
	border-radius: 50%;
}

.db-info-tooltip {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	min-width: 220px;
	max-width: 320px;
	padding: 10px 14px;
	background: #0f172a;
	color: #f8fafc;
	font-size: 15px;
	font-weight: 400;
	font-style: normal;
	letter-spacing: normal;
	text-transform: none;
	line-height: 1.4;
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
	white-space: normal;
	text-align: left;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease, visibility 0.15s ease;
}
/* Tooltip-Pfeil nach unten zeigend */
.db-info-tooltip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: #0f172a;
}
.db-info:hover .db-info-tooltip,
.db-info:focus .db-info-tooltip,
.db-info:focus-visible .db-info-tooltip {
	opacity: 1;
	visibility: visible;
}
/* Am rechten Rand der Liste würden Tooltips vom rechten Listen-Ende
   abgeschnitten — daher beim letzten Eintrag rechtsbündig statt zentriert. */
.db-channel-list li:last-child .db-info-tooltip {
	left: auto;
	right: 0;
	transform: none;
}
.db-channel-list li:last-child .db-info-tooltip::after {
	left: auto;
	right: 6px;
	transform: none;
}

.db-deeplink {
	display: inline-block;
	margin-top: 12px;
	font-size: 15px;
	color: #f97316;
	text-decoration: none;
}
.db-deeplink:hover { text-decoration: underline; }
.db-hint {
	margin-top: 8px;
	font-size: 14px;
	color: #6b7280;
	font-style: italic;
}

.db-twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.db-twocol-item { background: white; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 20px; }
.db-twocol-item .db-num { font-size: 40px; font-weight: 700; color: #0f172a; line-height: 1.1; }
.db-twocol-item .db-num-label { font-size: 16px; color: #374151; }

/* Im Analytics-Tab erbt die "Check vs. Individuelle Beratung"-Sektion das
   .db-twocol-Layout, soll aber visuell wie die anderen Analytics-Cards
   aussehen: gleicher horizontaler Inset wie .db-grid (28px), Akzent-Top-Border
   und identischer Gap. Slate-Ton signalisiert "BIEG-interne Daten, kein
   Matomo-Channel". */
.db-analytics-section .db-twocol {
	gap: 16px;
	padding: 12px 28px 24px;
}
.db-analytics-section .db-twocol-item {
	border-top: 4px solid #94a3b8;
}

.db-check-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.db-check-table td { padding: 8px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.db-check-name { color: #0f172a; font-weight: 600; }

.db-empty,
.db-empty-message {
	color: #94a3b8;
	font-style: italic;
	padding: 16px 0;
}

.db-compare-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.db-compare-col { min-width: 0; }

/* === Geräte-Card =====================================================
 * Layout: links Donut (fixe Breite), rechts kompakte HTML-Legende mit
 * Color-Swatch + absolutem Wert + Prozent.
 *
 * Card spannt die volle Section-Breite (wie alle anderen Analytics-Cards),
 * das innere .db-device-layout ist über justify-content: center mittig
 * platziert — so wirkt die Card nicht "leer" trotz fester Donut-Breite.
 *
 * Bei schmalem Viewport stacken Donut und Legende untereinander.
 * ==================================================================== */

/* Im Details-Tab steht die Geräte-Card direkt in .db-section (ohne .db-grid
   als Wrapper). Damit sie horizontal denselben 28px-Inset hat wie die Cards
   in .db-grid, bekommt sie hier ein passendes margin. Im Vergleichs-Tab
   sitzt sie in einem .db-compare-col und braucht keinen extra Inset. */
.db-section > .db-analytics-card--devices {
	margin: 12px 28px 24px;
}
.db-device-layout {
	display: grid;
	grid-template-columns: 280px minmax(220px, 360px);
	gap: 40px;
	align-items: center;
	justify-content: center;
}
.db-device-chart {
	width: 280px;
	height: 240px;
	max-width: 100%;
	margin: 0 auto;
}
.db-device-legend {
	list-style: none;
	padding: 0;
	margin: 0;
}
.db-device-legend li {
	display: grid;
	/* Zwei rechte Spalten mit fester ch-Breite → tabular-nums richten sich
	   sauber an der rechten Kante aus. */
	grid-template-columns: auto 1fr 7ch 7ch;
	align-items: center;
	gap: 14px;
	padding: 10px 0;
	font-size: 16px;
}
.db-device-swatch {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 2px;
	transform: translateY(1px);
}
.db-device-name { color: #0f172a; display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.db-device-name .db-toplist-icon { flex-shrink: 0; }
.db-device-visits { color: #374151; font-variant-numeric: tabular-nums; text-align: right; }
.db-device-pct { color: #4b5563; font-variant-numeric: tabular-nums; text-align: right; }

/* Geräte-Card im Vergleich zwei Cards nebeneinander → früher stacken,
   sonst wird der Donut zu klein. */
@media (max-width: 1100px) {
	.db-compare-row .db-device-layout {
		grid-template-columns: 1fr;
	}
}

/* Schmale Viewports generell: Donut über Legende. */
@media (max-width: 767px) {
	.db-device-layout {
		grid-template-columns: 1fr;
	}
	.db-device-chart {
		width: 100%;
		max-width: 320px;
	}
}
