/* T&H Metallbau — UI styles */

:root {
    --th-accent: #2c5282;
}

body {
    padding-bottom: 100px; /* room for sticky submit */
}

nav .brand {
    text-decoration: none;
}

/* Dashboard buttons */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.action-grid a {
    display: block;
    padding: 24px 16px;
    text-align: center;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    font-weight: 600;
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-grid a:active {
    background: var(--pico-secondary-background);
}

@media (min-width: 768px) {
    .action-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Document list */
.doc-list {
    list-style: none;
    padding: 0;
}

.doc-list li {
    border-bottom: 1px solid var(--pico-muted-border-color);
    padding: 12px 0;
}

.doc-list a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.doc-list .meta {
    font-size: 0.85em;
    color: var(--pico-muted-color);
}

.doc-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    background: var(--pico-secondary-background);
    color: var(--pico-secondary-inverse);
    margin-right: 6px;
    text-transform: uppercase;
}

/* Position rows */
.position-row {
    display: grid;
    grid-template-columns: 60px 1fr 110px auto;
    gap: 8px;
    align-items: start;
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
}

.position-row textarea {
    min-height: 60px;
}

.position-row .remove-btn {
    background: transparent;
    border: 0;
    font-size: 1.4em;
    color: var(--pico-muted-color);
    cursor: pointer;
    padding: 0 8px;
}

@media (max-width: 600px) {
    .position-row {
        grid-template-columns: 1fr 1fr;
    }
    .position-row textarea {
        grid-column: 1 / 3;
    }
}

/* Vorrechnungs-Zeile: Nr / Datum / Betrag / × */
.vorrechnung-row {
    display: grid;
    grid-template-columns: 90px 1fr 110px auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
}

.vorrechnung-row input {
    margin: 0;
}

@media (max-width: 600px) {
    .vorrechnung-row {
        grid-template-columns: 1fr 1fr auto;
    }
    .vorrechnung-row input[name="vr_nr"] {
        grid-column: 1 / 3;
    }
}

/* Sticky submit bar */
.sticky-submit {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: var(--pico-background-color);
    border-top: 1px solid var(--pico-muted-border-color);
    z-index: 50;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}

.sticky-submit button {
    width: 100%;
    margin: 0;
}

/* Spinner shown while PDF is being generated */
.hidden { display: none; }

.spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    font-weight: 600;
}

.spinner {
    width: 56px;
    height: 56px;
    border: 5px solid #ddd;
    border-top-color: var(--th-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Warning banner (negative restbetrag etc.) */
.warning {
    background: #fff3cd;
    color: #664d03;
    border: 1px solid #ffe69c;
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
}

.error-banner {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
}

/* Filter chips */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 12px;
}

.filter-chips a {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--pico-muted-border-color);
    text-decoration: none;
    color: inherit;
    font-size: 0.9em;
    white-space: nowrap;
}

.filter-chips a.active {
    background: var(--th-accent);
    color: white;
    border-color: var(--th-accent);
}
