/* App-spezifische Styles. Pico CSS liefert das Basis-Design.
   Hier nur: Header-Layout-Override, App-Badges, Banner. */

/* Pico-Default-Link-Farbe ist sehr hell (azure ≈ #1095c1) — auf weißem
   Hintergrund schlecht lesbar. Override auf kräftiges Blau.
   !important damit Pico's `:where()`-Defaults nicht zurückkommen wenn
   irgendwo sonst Spezifität dazwischenfunkt. */
a:link, a:visited { color: #1565c0 !important; }
a:hover { color: #0d47a1 !important; }

/* Header: Logo links, Tab-Nav rechts (Pico stackt das sonst untereinander) */
header.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    padding-bottom: 0;
    margin-bottom: 0;
    /* Dünne durchgehende Linie unterhalb der Tab-Leiste — der aktive Tab
       verschmilzt mit ihr (border-bottom-color: #fff overlay'd) */
    border-bottom: 1px solid #1565c0;
}
header.app-header h1.app-logo {
    margin: 0 0 0.6rem 0;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* Fallback für ältere Templates ohne .app-header */
header:not(.app-header) { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
header:not(.app-header) h1 { margin: 0; font-size: 1.5rem; }
nav:not(.main-tabs) a { margin-left: 1rem; }

/* === Hauptnavigation als Folder-Tabs === */
nav.main-tabs {
    display: flex;
    align-items: flex-end;
    gap: 0.15rem;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
}
nav.main-tabs .main-tab {
    display: inline-block;
    padding: 0.5em 1.25em;
    background: #f1f3f5;
    color: #555 !important;
    border: 1px solid #c8d0d8;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    text-decoration: none !important;
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.3;
    transition: background 0.15s, color 0.15s;
    position: relative;
    bottom: -1px;
    cursor: pointer;
    margin: 0;
}
nav.main-tabs .main-tab:hover {
    background: #e7eef7;
    color: #1565c0 !important;
}
/* Aktiver Tab: hellblauer Hintergrund, kräftiger blauer Rahmen, unterer
   Rand exakt 1px weiß → verschmilzt visuell mit der weißen Card-Fläche
   bzw. dem dünnen Header-Border. */
nav.main-tabs .main-tab-active,
nav.main-tabs .main-tab-active:hover {
    background: #e3f2fd;
    color: #0d47a1 !important;
    border: 1px solid #1565c0;
    border-bottom: 1px solid #e3f2fd;
    font-weight: 700;
    z-index: 2;
    padding: 0.55em 1.3em;
    bottom: -1px;
}
/* External-Tab (💡 Funktionen) — schwebt rechts ohne Tab-Optik */
nav.main-tabs .main-tab-external {
    margin-left: auto;
    background: transparent;
    border: 1px solid transparent;
    color: #1565c0 !important;
    font-weight: 500;
    bottom: -1px;
}
nav.main-tabs .main-tab-external:hover {
    background: rgba(21, 101, 192, 0.08);
    border-color: transparent;
    color: #0d47a1 !important;
}
@media (max-width: 720px) {
    nav.main-tabs .main-tab {
        padding: 0.45em 0.85em;
        font-size: 0.88rem;
    }
    nav.main-tabs .main-tab-external {
        margin-left: 0;
    }
}

/* Container so breit wie der Bildschirm hergibt — Datentabellen brauchen Platz.
   96vw lässt minimal Luft zum Rand; min(1800px, 96vw) cappt auf riesigen
   Monitoren (4K etc.) damit Texte lesbar bleiben. */
body > main, body > header { max-width: min(1800px, 96vw); margin-left: auto; margin-right: auto; }

/* Status-Badges (Projekt-Status) */
.status { display: inline-block; padding: 0.25rem 0.6rem; border-radius: 12px; background: #e5e7eb; color: #374151; font-size: 0.8rem; font-weight: 500; }
.status-1 { background: #e5e7eb; color: #374151; }       /* Angebot (grau) */
.status-2 { background: #dbeafe; color: #1e40af; }       /* Beauftragt (blau) */
.status-3 { background: #fef3c7; color: #92400e; }       /* In Arbeit (gelb) */
.status-4 { background: #dcfce7; color: #166534; }       /* Fertiggestellt (grün) */
.status-5 { background: #d1fae5; color: #065f46; }       /* Abgenommen (türkis) */
.status-6 { background: #e5e7eb; color: #6b7280; }       /* Archiviert (grau) */

/* Status-Dropdown im Projekt-Detail (gleiches Farbdesign wie .status-Pills) */
.status-select {
    width: auto !important;                /* gegen Pico-CSS default width:100% */
    max-width: max-content;
    padding: 0.28rem 1.5rem 0.28rem 0.7rem;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.08);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%23666' stroke-width='1.4' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.45rem center;
    background-size: 0.7em;
    line-height: 1.2;
    margin: 0;
    flex: 0 0 auto;
}
.status-select:hover { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.status-select:focus { outline: 2px solid #5e35b1; outline-offset: 1px; }
/* Status-Select bekommt zusätzlich .status-N-Klasse für Background-Farbe */
select.status-select.status-1 { background-color: #e5e7eb; color: #374151; }
select.status-select.status-2 { background-color: #dbeafe; color: #1e40af; }
select.status-select.status-3 { background-color: #fef3c7; color: #92400e; }
select.status-select.status-4 { background-color: #dcfce7; color: #166534; }
select.status-select.status-5 { background-color: #d1fae5; color: #065f46; }
select.status-select.status-6 { background-color: #e5e7eb; color: #6b7280; }

/* Kompakter Projekt-Header (inline editierbare Meta-Felder) */
.project-header-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem 1.4rem;
    align-items: center;
}
.project-header-row .project-title {
    margin: 0;
    font-size: 1.55rem;
    line-height: 1.2;
}
.meta-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.92rem;
}
.meta-key-inline {
    color: #6b7280;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.meta-edit {
    padding: 0.22rem 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    font-size: 0.92rem;
    background: white;
    transition: border-color 150ms, box-shadow 150ms;
}
.meta-edit:hover { border-color: #cbd5e1; }
.meta-edit:focus {
    outline: none;
    border-color: #5e35b1;
    box-shadow: 0 0 0 2px rgba(94,53,177,0.15);
}
.meta-edit[type="text"] { min-width: 180px; }
.meta-edit[type="date"] { width: auto; }
.meta-feedback {
    font-size: 0.85em;
    margin-left: 0.5em;
    min-width: 80px;
}

/* Beschreibung-Zeile: über volle Breite, Input nimmt verfügbaren Platz */
.project-header-row-desc {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px solid #e5e7eb;
}
.meta-edit.meta-edit-full {
    flex: 1;
    min-width: 0;
    width: 100%;
}

/* Import-Card mit 3 Buttons gleichen Stils + Größe + vertikale Linie */
.import-actions-row {
    display: flex;
    gap: 0.8em;
    align-items: center;
    flex-wrap: wrap;
}
/* Die 3 Haupt-Buttons (Rechnung/Ordner/Hochladen) bleiben IMMER in einer Zeile */
.import-buttons-group {
    display: inline-flex;
    gap: 0.6em;
    align-items: center;
    flex-wrap: nowrap;
}
.btn-import {
    /* Identisches Box-Model für <a> und <button> damit nichts versetzt erscheint */
    box-sizing: border-box;
    height: 40px;
    padding: 0 1.4em;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    border: none;
    min-width: 190px;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    margin: 0;
    vertical-align: middle;
    transition: background 150ms, transform 100ms;
    font-family: inherit;
    white-space: nowrap;            /* Icon + Text bleiben auf einer Zeile */
}
.btn-import:hover:not(:disabled) { transform: translateY(-1px); }
.btn-import-file { background: #6366f1; color: white; }
.btn-import-file:hover { background: #4f46e5; }
.btn-import-folder { background: #6366f1; color: white; }
.btn-import-folder:hover { background: #4f46e5; }
.btn-import-upload { background: #1b5e20; color: white; }
.btn-import-upload:hover { background: #155018; }
.btn-import:disabled { background: #cbd5e1; color: #94a3b8; cursor: not-allowed; transform: none; }
.btn-import-file-info {
    font-size: 0.88em;
    color: #475569;
    margin-left: 0.4em;
}

/* Health-Banner (System-Warnung oben) */
.banner { padding: 0.75rem 1rem; margin: 0 0 1rem 0; border-radius: 6px; font-size: 0.9rem; }
.banner-warn  { background: #fef3c7; border: 1px solid #f59e0b; color: #92400e; }
.banner-error { background: #fee2e2; border: 1px solid #ef4444; color: #991b1b; }
.banner-info  { background: #dbeafe; border: 1px solid #3b82f6; color: #1e3a8a; }
