/* ==========================================================================
   Design Tokens  WICHTIG:
	•	Nur diese eine Datei ändern.
	•	Keine PHP-Dateien anfassen.
	•	Keine zusätzlichen Styles ergänzen oder optimieren, einfach 1:1 ersetzen.   ========================================================================== */ 

:root {
    /* Farben */
    --ui-bg: #f1f5f9;
    --ui-bg-alt: #e5e7eb;
    --ui-surface: #ffffff;
    --ui-surface-subtle: #f8fafc;

    --ui-border-subtle: #e2e8f0;
    --ui-border-strong: #cbd5e1;

    --ui-text: #0f172a;
    --ui-text-muted: #6b7280;

    --ui-primary: #2563eb;
    --ui-primary-soft: #eff6ff;
    --ui-primary-strong: #1d4ed8;

    --ui-success: #16a34a;
    --ui-success-soft: #ecfdf3;

    --ui-warning: #f59e0b;
    --ui-warning-soft: #fffbeb;

    --ui-danger: #ef4444;
    --ui-danger-soft: #fef2f2;

    /* Radius & Schatten */
    --ui-radius-sm: 8px;
    --ui-radius-md: 14px;
    --ui-radius-lg: 20px;
    --ui-radius-xl: 28px;
    --ui-radius-pill: 9999px;

    --ui-shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.12);
    --ui-shadow-card: 0 12px 30px rgba(15, 23, 42, 0.08);
    --ui-shadow-elevated: 0 24px 60px rgba(15, 23, 42, 0.18);

    /* Abstände */
    --ui-gap-section: 24px;
    --ui-gap-element: 16px;
}

/* ==========================================================================
   Reset & Basis
   ========================================================================== */

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

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    color: var(--ui-text);
    background-color: var(--ui-bg);
    -webkit-font-smoothing: antialiased;
}

img,
svg {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--ui-primary);
    text-decoration: none;
    cursor: pointer;
}

a:hover {
    color: var(--ui-primary-strong);
    text-decoration: underline;
}

strong {
    font-weight: 600;
}

/* ==========================================================================
   App Layout
   ========================================================================== */

/* Body-Klasse für alle App-Seiten */
body.app-shell {
    background-image:
            radial-gradient(circle at top left, #dbeafe, #f9fafb 55%, #f1f5f9 100%);
}

/* Hülle um Header + Hauptbereich + Footer */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 16px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    row-gap: 16px;
    min-height: 100vh;
}

/* Hauptinhalt (unterhalb Header) */
.app-main {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--ui-radius-xl);
    box-shadow: var(--ui-shadow-soft);
    padding: 20px 20px 18px;
    display: flex;
    flex-direction: column;
    gap: var(--ui-gap-section);
    overflow: hidden;
}

/* Standard-Headerbereich innerhalb app-main (Überschrift, Aktionen) */
.app-main-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.app-main-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.app-main-subtitle {
    margin-top: 2px;
    font-size: 0.85rem;
    color: var(--ui-text-muted);
}

/* Responsive Anpassungen */
@media (max-width: 768px) {
    .app-container {
        padding: 8px;
    }

    .app-main {
        border-radius: 20px;
        padding: 12px 12px 10px;
    }

    .app-main-header {
        align-items: flex-start;
    }
}

/* ==========================================================================
   Globaler App-Header (render_app_header)
   ========================================================================== */

.app-header {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 9999px;
    box-shadow: var(--ui-shadow-card);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

/* links: Logo + Seitentitel */
.app-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-header-logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--ui-primary), #22c55e);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.app-header-title {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.app-header-title > span {
    font-size: 0.9rem;
    font-weight: 600;
}

.app-header-title > small {
    font-size: 0.75rem;
    color: var(--ui-text-muted);
}

/* rechts: Suche + Benutzer */
.app-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Suche im Header */
.app-header-search {
    display: none; /* standard: mobil aus */
}

.app-header-search input {
    border-radius: 9999px;
    border: 1px solid var(--ui-border-subtle);
    padding: 6px 10px;
    font-size: 0.8rem;
    min-width: 190px;
    background: var(--ui-surface-subtle);
    color: var(--ui-text);
}

.app-header-search input::placeholder {
    color: var(--ui-text-muted);
}

/* User-Badge */
.app-header-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-header-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    background: radial-gradient(circle at 30% 30%, #a7f3d0, #22c55e);
    color: #064e3b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.app-header-user-info {
    display: none;
    flex-direction: column;
    font-size: 0.75rem;
}

.app-header-user-info strong {
    font-weight: 600;
}

.app-header-user-info span {
    color: var(--ui-text-muted);
}

/* Breadcrumb (optional) */
.app-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    font-size: 0.75rem;
    color: var(--ui-text-muted);
}

.app-breadcrumb a {
    color: var(--ui-text-muted);
}

.app-breadcrumb a:hover {
    color: var(--ui-primary-strong);
    text-decoration: none;
}

/* Header-Responsiveness */
@media (min-width: 640px) {
    .app-header-search {
        display: block;
    }

    .app-header-user-info {
        display: flex;
    }
}

@media (max-width: 480px) {
    .app-header-title > span {
        font-size: 0.85rem;
    }
    .app-header-title > small {
        display: none;
    }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
    margin-top: 8px;
    padding: 4px 4px 8px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--ui-text-muted);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--ui-radius-pill);
    border: 1px solid transparent;
    padding: 0.45rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease-out;
    white-space: nowrap;
    background-color: transparent;
}

.btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Primär (blau) */
.btn-primary {
    background: linear-gradient(135deg, var(--ui-primary), var(--ui-primary-strong));
    color: #fff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.4);
}

/* Sekundär (weiß) */
.btn-secondary {
    background: #ffffff;
    color: var(--ui-text);
    border-color: var(--ui-border-subtle);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--ui-surface-subtle);
}

/* Ghost-Button */
.btn-ghost {
    background: transparent;
    color: var(--ui-text-muted);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(15, 23, 42, 0.04);
    color: var(--ui-text);
}

/* Kleine Variante */
.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.78rem;
}

/* ==========================================================================
   Badges / Pills / Status
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: var(--ui-radius-pill);
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    gap: 4px;
}

.badge-muted {
    background: var(--ui-surface-subtle);
    color: var(--ui-text-muted);
}

.badge-primary {
    background: var(--ui-primary-soft);
    color: var(--ui-primary-strong);
}

.badge-success {
    background: var(--ui-success-soft);
    color: var(--ui-success);
}

.badge-warning {
    background: var(--ui-warning-soft);
    color: var(--ui-warning);
}

.badge-danger {
    background: var(--ui-danger-soft);
    color: var(--ui-danger);
}

/* ==========================================================================
   Karten / Panels
   ========================================================================== */

.card {
    background: var(--ui-surface);
    border-radius: var(--ui-radius-lg);
    box-shadow: var(--ui-shadow-card);
    padding: 16px 18px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--ui-text-muted);
}

/* KPI-Karten (z. B. Dashboard) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .kpi-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.kpi-card {
    background: #ffffff;
    border-radius: var(--ui-radius-lg);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    padding: 12px 14px;
}

.kpi-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ui-text-muted);
}

.kpi-value {
    margin-top: 4px;
    font-size: 1.3rem;
    font-weight: 600;
}

.kpi-hint {
    margin-top: 2px;
    font-size: 0.75rem;
}

/* ==========================================================================
   Tabellen
   ========================================================================== */

.table-wrapper {
    border-radius: var(--ui-radius-lg);
    overflow: hidden;
    border: 1px solid var(--ui-border-subtle);
    background: #ffffff;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table thead {
    background: var(--ui-surface-subtle);
    color: var(--ui-text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
}

.table th,
.table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--ui-border-subtle);
    text-align: left;
}

.table th:last-child,
.table td:last-child {
    text-align: right;
}

.table tbody tr:hover {
    background: #f9fafb;
}

/* Mobile Tabellenansicht -> als Karten darstellen: 
   Einfach eigene .table-mobile-card-Stile nutzen, siehe Seite
*/

/* ==========================================================================
   Formulare / Inputs
   ========================================================================== */

.input,
select,
textarea {
    border-radius: var(--ui-radius-md);
    border: 1px solid var(--ui-border-subtle);
    padding: 6px 10px;
    font-size: 0.85rem;
    width: 100%;
    max-width: 100%;
    background: #ffffff;
    color: var(--ui-text);
    transition: border-color 0.12s ease-out, box-shadow 0.12s ease-out;
}

.input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--ui-primary);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
}

.input::placeholder,
textarea::placeholder {
    color: var(--ui-text-muted);
}

/* ==========================================================================
   Alerts / Hinweise
   ========================================================================== */

.alert {
    border-radius: var(--ui-radius-pill);
    padding: 0.55rem 0.85rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-info {
    background: var(--ui-primary-soft);
    color: var(--ui-primary-strong);
}

.alert-success {
    background: var(--ui-success-soft);
    color: var(--ui-success);
}

.alert-warning {
    background: var(--ui-warning-soft);
    color: var(--ui-warning);
}

.alert-danger {
    background: var(--ui-danger-soft);
    color: var(--ui-danger);
}

/* ==========================================================================
   Layout-Utilities
   ========================================================================== */

.app-grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

@media (max-width: 1024px) {
    .app-grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }
}

.stack {
    display: flex;
    flex-direction: column;
    gap: var(--ui-gap-element);
}

.cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
