/* ═══════════════════════════════════════════
   HandwerksFlux Design System
   "Iron & Amber Refined" — Dark Mode First
   Optimiert fuer Baustelle, Sonnenlicht, Handschuhe
   ═══════════════════════════════════════════ */

/* ─── CSS Variables ─── */
:root {
    /* Primaerfarben (Iron & Amber) */
    --hf-primary: #ff8c00;            /* Vibrant Orange — Buttons, Highlights */
    --hf-primary-light: #ffb77d;      /* Sanftes Amber — Text auf dunklem Grund */
    --hf-primary-dark: #623200;       /* Dunkles Braun — Text auf Orange-Buttons */
    --hf-accent: #ff8c00;
    --hf-accent-light: rgba(255, 140, 0, 0.15);

    /* Status */
    --hf-success: #4ade80;
    --hf-success-light: rgba(74, 222, 128, 0.15);
    --hf-warning: #ffb77d;
    --hf-warning-light: rgba(255, 183, 125, 0.15);
    --hf-danger: #f87171;
    --hf-danger-light: rgba(248, 113, 113, 0.15);

    /* Neutral (Dark Theme) */
    --hf-bg: #001523;                 /* Ultra Dark Navy — App-Hintergrund */
    --hf-bg-card: #001e2f;            /* Deep Navy — Karten, Panels */
    --hf-bg-input: #15384d;           /* Surface — Inputs, Hover */
    --hf-border: #1e4a63;
    --hf-text: #ffffff;
    --hf-text-secondary: #b8c8da;     /* Blaeuliches Grau */
    --hf-text-muted: #6b8299;

    /* Spacing */
    --hf-radius: 12px;
    --hf-radius-sm: 8px;
    --hf-radius-lg: 16px;
    --hf-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --hf-shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.4);

    /* Typo */
    --hf-font: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --hf-font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ─── Reset & Base ─── */
html, body {
    font-family: var(--hf-font);
    background: var(--hf-bg);
    color: var(--hf-text);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

/* ─── Typo ─── */
.hf-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--hf-primary);
    margin: 0;
}

.hf-subtitle {
    font-size: 1rem;
    font-weight: 600;
    color: var(--hf-text);
    margin: 0;
}

.hf-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--hf-text-secondary);
    margin-bottom: 0.3rem;
    display: block;
}

.hf-muted {
    color: var(--hf-text-muted);
    font-size: 0.85rem;
}

/* ─── Buttons ─── */
.hf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--hf-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}

.hf-btn-primary {
    background: var(--hf-primary);
    color: var(--hf-primary-dark);
    font-weight: 700;
}
.hf-btn-primary:hover { background: var(--hf-primary-light); }
.hf-btn-primary:active { transform: scale(0.95); }
.hf-btn-primary:disabled { background: var(--hf-text-muted); color: var(--hf-bg); cursor: not-allowed; }

.hf-btn-secondary {
    background: var(--hf-bg-input);
    color: var(--hf-text);
    border: 2px solid var(--hf-border);
}
.hf-btn-secondary:hover { border-color: var(--hf-primary); color: var(--hf-primary); }

.hf-btn-success {
    background: var(--hf-success);
    color: white;
}

.hf-btn-danger {
    background: var(--hf-danger);
    color: white;
}

.hf-btn-ghost {
    background: transparent;
    color: var(--hf-primary-light);
    padding: 0.5rem 0.75rem;
}

.hf-btn-block {
    width: 100%;
}

.hf-btn-lg {
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
}

/* ─── Inputs ─── */
.hf-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--hf-border);
    border-radius: var(--hf-radius);
    font-size: 1rem;
    font-family: var(--hf-font);
    background: var(--hf-bg-input);
    color: var(--hf-text);
    outline: none;
    transition: border-color 0.15s ease;
    min-height: 48px; /* Mindesthoehe fuer Handschuhbedienung */
}
.hf-input:focus { border-color: var(--hf-primary); }
.hf-input::placeholder { color: var(--hf-text-muted); }
select.hf-input { appearance: auto; }

.hf-input-group {
    margin-bottom: 1rem;
}

/* ─── Cards ─── */
.hf-card {
    background: var(--hf-bg-card);
    border-radius: var(--hf-radius-lg);
    padding: 1.25rem;
    box-shadow: var(--hf-shadow);
    border: 1px solid var(--hf-border);
}

.hf-card-flat {
    background: var(--hf-bg-card);
    border-radius: var(--hf-radius);
    padding: 1rem;
    border: 1px solid var(--hf-border);
}

.hf-card-interactive {
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}
.hf-card-interactive:hover {
    box-shadow: var(--hf-shadow-lg);
    transform: translateY(-1px);
}
.hf-card-interactive:active {
    transform: translateY(0);
}

/* ─── Dashboard Tiles ─── */
.hf-tile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    max-width: 420px;
    margin: 0 auto;
}

.hf-tile {
    background: var(--hf-bg-card);
    border-radius: var(--hf-radius-lg);
    padding: 1.25rem;
    text-align: center;
    text-decoration: none;
    color: var(--hf-text);
    box-shadow: var(--hf-shadow);
    border: 1px solid var(--hf-border);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
    min-height: 48px;
}
.hf-tile:hover {
    box-shadow: var(--hf-shadow-lg);
    transform: translateY(-2px);
    border-color: var(--hf-primary);
}
.hf-tile-icon {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}
.hf-tile-title {
    font-weight: 700;
    color: var(--hf-primary);
    font-size: 0.9rem;
}
.hf-tile-sub {
    color: var(--hf-text-muted);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

/* ─── Page Layout ─── */
.hf-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
}

.hf-page-wide {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.hf-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

/* ─── Progress Bar (Wizard) ─── */
.hf-progress {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 2rem;
}
.hf-progress-step {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--hf-border);
    transition: background 0.3s ease;
}
.hf-progress-step.active {
    background: var(--hf-primary);
}

/* ─── Tags / Badges ─── */
.hf-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}
.hf-badge-success { background: var(--hf-success-light); color: var(--hf-success); }
.hf-badge-warning { background: var(--hf-warning-light); color: var(--hf-warning); }
.hf-badge-danger { background: var(--hf-danger-light); color: var(--hf-danger); }
.hf-badge-info { background: var(--hf-accent-light); color: var(--hf-accent); }

/* ─── Plantafel Team Column ─── */
.hf-team-col {
    flex: 1;
    min-width: 280px;
    max-width: 400px;
}
.hf-team-header {
    color: white;
    padding: 0.65rem 1rem;
    border-radius: var(--hf-radius) var(--hf-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.95rem;
}
.hf-team-header-count {
    background: rgba(255,255,255,0.25);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 400;
}
.hf-team-body {
    background: var(--hf-bg);
    border-radius: 0 0 var(--hf-radius) var(--hf-radius);
    min-height: 200px;
    padding: 0.5rem;
    border: 1px solid var(--hf-border);
    border-top: none;
}

/* ─── Auftrag Card (in Plantafel) ─── */
.hf-auftrag-card {
    background: var(--hf-bg-card);
    border-radius: var(--hf-radius-sm);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    box-shadow: var(--hf-shadow);
    transition: box-shadow 0.15s ease;
    border-left: 4px solid;
}
.hf-auftrag-card:hover {
    box-shadow: var(--hf-shadow-lg);
}
.hf-auftrag-nr {
    font-size: 0.7rem;
    color: var(--hf-text-muted);
    letter-spacing: 0.3px;
}
.hf-auftrag-title {
    font-weight: 700;
    color: var(--hf-text);
    font-size: 0.9rem;
    margin: 0.2rem 0 0.3rem;
    line-height: 1.3;
}
.hf-auftrag-time {
    color: var(--hf-text-secondary);
    font-size: 0.8rem;
}
.hf-auftrag-notiz {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--hf-border);
    font-size: 0.8rem;
    color: var(--hf-text-secondary);
}

/* ─── Date Navigator ─── */
.hf-date-nav {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
    background: var(--hf-bg);
    border-radius: var(--hf-radius);
    padding: 0.25rem;
    border: 1px solid var(--hf-border);
}
.hf-date-nav-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--hf-bg-card);
    border-radius: var(--hf-radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--hf-primary);
    box-shadow: var(--hf-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}
.hf-date-nav-label {
    padding: 0 0.75rem;
    font-weight: 600;
    color: var(--hf-primary);
    font-size: 0.95rem;
    min-width: 160px;
    text-align: center;
}
.hf-date-nav-today {
    height: 36px;
    border: none;
    border-radius: var(--hf-radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0 0.75rem;
    font-weight: 600;
    margin-left: 0.25rem;
}

/* ─── Data Grid ─── */
.hf-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.hf-grid thead th {
    background: var(--hf-bg-card);
    color: var(--hf-primary);
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    position: sticky;
    top: 0;
}
.hf-grid thead th:first-child { border-radius: var(--hf-radius-sm) 0 0 0; }
.hf-grid thead th:last-child { border-radius: 0 var(--hf-radius-sm) 0 0; }
.hf-grid thead th:hover { background: var(--hf-bg-input); }
.hf-grid tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--hf-border);
    color: var(--hf-text);
}
.hf-grid tbody tr:hover { background: var(--hf-bg-input); }
.hf-grid tbody tr:last-child td { border-bottom: none; }

/* ─── Tag Toggle (Arbeitstage) ─── */
.hf-tag-toggle {
    display: inline-flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.hf-tag {
    padding: 0.5rem 0.75rem;
    border-radius: var(--hf-radius-sm);
    border: 2px solid var(--hf-border);
    background: var(--hf-bg-card);
    color: var(--hf-text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 400;
    transition: all 0.15s ease;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
}
.hf-tag.active {
    border-color: var(--hf-primary);
    background: var(--hf-primary);
    color: var(--hf-primary-dark);
    font-weight: 700;
}

/* ─── Alert / Info Box ─── */
.hf-alert {
    padding: 0.65rem 1rem;
    border-radius: var(--hf-radius-sm);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}
.hf-alert-info { background: var(--hf-accent-light); color: var(--hf-accent); }
.hf-alert-success { background: var(--hf-success-light); color: var(--hf-success); }
.hf-alert-danger { background: var(--hf-danger-light); color: var(--hf-danger); }
.hf-alert-warning { background: var(--hf-warning-light); color: var(--hf-warning); }

/* ─── Empty State ─── */
.hf-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--hf-text-muted);
    font-size: 0.85rem;
}

/* ─── Spacer Utilities ─── */
.hf-mt-1 { margin-top: 0.5rem; }
.hf-mt-2 { margin-top: 1rem; }
.hf-mt-3 { margin-top: 1.5rem; }
.hf-mt-4 { margin-top: 2rem; }
.hf-mb-1 { margin-bottom: 0.5rem; }
.hf-mb-2 { margin-bottom: 1rem; }
.hf-mb-3 { margin-bottom: 1.5rem; }
.hf-gap-1 { gap: 0.5rem; }
.hf-gap-2 { gap: 0.75rem; }
.hf-flex { display: flex; }
.hf-flex-col { display: flex; flex-direction: column; }
.hf-flex-between { display: flex; justify-content: space-between; align-items: center; }
.hf-text-center { text-align: center; }

/* ─── Layout (Responsive Sidebar) ─── */
.hf-layout {
    display: flex;
    min-height: 100vh;
}

.hf-sidebar {
    width: 220px;
    background: var(--hf-bg-card);
    border-right: 1px solid var(--hf-border);
    padding: 1rem 0;
    flex-shrink: 0;
}

.hf-sidebar-close {
    display: none;
}

.hf-sidebar-overlay {
    display: none;
}

.hf-main {
    flex: 1;
    overflow-y: auto;
    min-width: 0;
}

.hf-topbar {
    display: none;
}

.hf-hamburger {
    background: none;
    border: none;
    color: var(--hf-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

/* Mobile: < 768px */
@media (max-width: 767.98px) {
    .hf-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        overflow-y: auto;
    }
    .hf-sidebar.open {
        transform: translateX(0);
    }
    .hf-sidebar-close {
        display: block;
        background: none;
        border: none;
        color: var(--hf-text-muted);
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0;
        line-height: 1;
    }
    .hf-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1050;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .hf-sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }
    .hf-topbar {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        background: var(--hf-bg-card);
        border-bottom: 1px solid var(--hf-border);
        position: sticky;
        top: 0;
        z-index: 100;
    }
}

/* ─── Sidebar / Nav (Legacy) ─── */
.sidebar {
    background: var(--hf-bg) !important;
}

.top-row {
    background: var(--hf-bg-card) !important;
    border-bottom: 1px solid var(--hf-border);
}

.navbar-brand {
    color: var(--hf-primary) !important;
    font-weight: 700 !important;
}

.nav-link {
    color: var(--hf-text-secondary) !important;
}
.nav-link:hover, .nav-link.active {
    color: var(--hf-primary) !important;
}

/* ─── DevExtreme Trial Banner ausblenden (Lizenz spaeter einbinden) ─── */
.dx-license { display: none !important; }

/* ─── Blazor Defaults ─── */
h1:focus { outline: none; }

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--hf-success); }
.invalid { outline: 1px solid var(--hf-danger); }
.validation-message { color: var(--hf-danger); }

#blazor-error-ui {
    background: var(--hf-warning-light);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.status-bar-safe-area { display: none; }

@supports (-webkit-touch-callout: none) {
    .status-bar-safe-area {
        display: flex;
        position: sticky;
        top: 0;
        height: env(safe-area-inset-top);
        background-color: var(--hf-bg);
        width: 100%;
        z-index: 1;
    }
    .flex-column, .navbar-brand {
        padding-left: env(safe-area-inset-left);
    }
}
