/* ============================================================================
   Druckauftragsverwaltung – Shared Styles
   Primärfarbe: Indigo (#6366f1) – unterscheidet sich vom Feedback-Blau
   ============================================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary:        #6366f1;
    --primary-dark:   #4f46e5;
    --primary-light:  #e0e7ff;
    --success:        #10b981;
    --warning:        #f59e0b;
    --danger:         #ef4444;
    --info:           #3b82f6;
    --bg:             #f8fafc;
    --card:           #ffffff;
    --text:           #0f172a;
    --text-muted:     #64748b;
    --border:         #e2e8f0;
    --shadow:         0 1px 3px rgba(0,0,0,.1);
    --shadow-md:      0 4px 12px rgba(0,0,0,.1);
    --shadow-lg:      0 10px 30px rgba(0,0,0,.15);
    --radius:         8px;
    --radius-lg:      12px;

    /* Status */
    --offen:          #3498db;
    --in-druck:       #f39c12;
    --fertig:         #27ae60;
    --abgebrochen:    #95a5a6;

    /* Priorität */
    --p-niedrig:      #64748b;
    --p-normal:       #3b82f6;
    --p-hoch:         #f59e0b;
    --p-dringend:     #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

/* ============================================================================
   LAYOUT
   ============================================================================ */

.container { max-width: 1280px; margin: 0 auto; padding: 24px 20px; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.page-header h1 { font-size: 24px; font-weight: 700; }
.page-header .subtitle { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 14px;
    font-weight: 500;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-icon { padding: 7px; }

/* ============================================================================
   CARDS
   ============================================================================ */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

/* ============================================================================
   FORMS
   ============================================================================ */

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text-muted); }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: #fff;
    transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.form-control.error { border-color: var(--danger); }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2364748b' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.radio-group { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all .15s;
}
.radio-option:has(input:checked) { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); font-weight: 500; }
.radio-option input { margin: 0; }

/* ============================================================================
   STATUS & PRIORITÄT BADGES
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-offen         { background: #dbeafe; color: var(--offen); }
.badge-slice-fertig  { background: #ede9fe; color: #6d28d9; }
.badge-in-druck      { background: #fef3c7; color: var(--in-druck); animation: pulse-badge 1.5s infinite; }
.badge-fertig        { background: #d1fae5; color: var(--fertig); }
.badge-abgebrochen   { background: #f1f5f9; color: var(--abgebrochen); }

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50%       { opacity: .7; }
}

.badge-niedrig { background: #f1f5f9; color: var(--p-niedrig); }
.badge-normal  { background: #dbeafe; color: var(--p-normal); }
.badge-hoch    { background: #fef3c7; color: var(--p-hoch); }

.badge-revision-locked { background: #fee2e2; color: #991b1b; }
.badge-nachdruck { background: #ffedd5; color: #9a3412; }
.badge-dringend{ background: #fee2e2; color: var(--p-dringend); }

/* ============================================================================
   LOGIN PAGE
   ============================================================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    padding: 20px;
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .icon { font-size: 48px; margin-bottom: 8px; }
.login-logo h1 { font-size: 22px; font-weight: 700; }
.login-logo p { color: var(--text-muted); font-size: 14px; }

.login-box .btn-primary { width: 100%; justify-content: center; padding: 11px; font-size: 15px; margin-top: 4px; }

.error-msg {
    background: #fee2e2;
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-top: 12px;
    display: none;
}

.back-link { display: block; text-align: center; margin-top: 14px; font-size: 14px; color: var(--text-muted); cursor: pointer; }
.back-link:hover { color: var(--primary); }

/* ============================================================================
   HOME / BUTTON GRID
   ============================================================================ */

.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.home-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 28px 20px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all .2s;
    text-align: center;
    box-shadow: var(--shadow);
    min-height: 140px;
}

.home-card:hover:not(.disabled) {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.home-card.disabled {
    opacity: .45;
    cursor: not-allowed;
    filter: grayscale(.5);
}

.home-card .card-icon { font-size: 36px; }
.home-card .card-label { font-size: 15px; font-weight: 600; }
.home-card .card-info  { font-size: 12px; color: var(--text-muted); }
.home-card .lock-badge {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 99px;
    border: 1px solid var(--border);
}

/* ============================================================================
   TABELLEN
   ============================================================================ */

.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 14px; }
thead { background: #f8fafc; }
th { padding: 11px 14px; text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ============================================================================
   BERECHTIGUNGEN (Checkbox-Matrix)
   ============================================================================ */

.perm-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.perm-check { text-align: center; }

/* ============================================================================
   MODAL
   ============================================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 4px; line-height: 1; }
.modal-close:hover { color: var(--danger); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ============================================================================
   FEEDBACK / TOAST
   ============================================================================ */

.toast-container { position: fixed; top: 90px; right: 24px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; }

.toast {
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-md);
    animation: slideIn .2s ease;
    max-width: 320px;
}

.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--primary); }

.toast-closable { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toast-close { background: none; border: none; color: #fff; opacity: .8; font-size: 16px; line-height: 1; cursor: pointer; padding: 0; flex-shrink: 0; }
.toast-close:hover { opacity: 1; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ============================================================================
   LOADING
   ============================================================================ */

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 40px auto;
}

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

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 640px) {
    .page-header { flex-direction: column; align-items: flex-start; }
    .home-grid { grid-template-columns: repeat(2, 1fr); }
    .login-box { padding: 28px 20px; }
    .form-row { grid-template-columns: 1fr; }
}

/* ============================================================================
   SCROLL BUTTONS
   ============================================================================ */

.scroll-btn {
    position: fixed;
    right: 28px;
    z-index: 999;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: var(--primary-dark);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
    display: none;
    align-items: center;
    justify-content: center;
    transition: opacity .2s, background .2s;
}
.scroll-btn:hover { background: var(--primary); }
#scrollTopBtn { bottom: 80px; }
#scrollBottomBtn { bottom: 24px; }

/* ============================================================================
   FORTSCHRITTSSTRAHL (Auftrag und Platten, Rainer 09.11.2026)
   Farben wie bisher: erledigt = --fertig (gruen), aktuell = --primary (Akzent), offen = grau, Stand-Fehler = rot
   ============================================================================ */

.fs-strahl { display: flex; align-items: flex-start; width: 100%; }
.fs-station { position: relative; flex: 1 1 0; min-width: 0; text-align: center; padding: 0 2px; }
.fs-station:not(:first-child)::before {
    content: ''; position: absolute; top: 12px; right: 50%; width: 100%; height: 3px;
    background: var(--border); z-index: 0;
}
.fs-station.fs-verbunden::before { background: var(--fertig); }
.fs-punkt {
    position: relative; z-index: 1; width: 26px; height: 26px; margin: 0 auto 6px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
    background: var(--card); border: 3px solid var(--border); color: var(--text-muted);
}
.fs-erledigt .fs-punkt { background: var(--fertig); border-color: var(--fertig); color: #fff; }
.fs-aktuell .fs-punkt { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); animation: pulse-badge 1.5s infinite; }
.fs-label { font-size: 12px; line-height: 1.25; color: var(--text-muted); }
.fs-erledigt .fs-label { color: var(--text); }
.fs-aktuell .fs-label { color: var(--primary-dark); font-weight: 600; }
.fs-zahl { font-size: 12px; font-weight: 600; margin-top: 2px; color: var(--text-muted); }
.fs-erledigt .fs-zahl { color: var(--fertig); }
.fs-aktuell .fs-zahl { color: var(--primary-dark); }
.fs-balken { height: 4px; background: var(--border); border-radius: 99px; margin: 4px 6px 0; overflow: hidden; }
.fs-balken > span { display: block; height: 100%; background: var(--fertig); }
.fs-aktuell .fs-balken > span { background: var(--primary); }

.fs-platten { margin-top: 18px; border-top: 1px solid var(--border); }
.fs-zeile { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.fs-zeile:last-child { border-bottom: none; }
.fs-kopf { flex: 0 0 210px; min-width: 0; }
.fs-kopf .fs-name { font-weight: 600; font-size: 14px; word-break: break-word; }
.fs-kopf .fs-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.fs-zeile .fs-strahl { flex: 1 1 auto; }
.fs-zeile .fs-punkt { width: 20px; height: 20px; font-size: 11px; border-width: 2px; margin-bottom: 4px; }
.fs-zeile .fs-station:not(:first-child)::before { top: 9px; height: 2px; }
.fs-zeile .fs-label { font-size: 11px; }
.fs-fehler { display: inline-block; margin-top: 4px; }
.fs-leer { color: var(--text-muted); font-size: 13px; }
@media (max-width: 720px) {
    .fs-zeile { flex-direction: column; align-items: stretch; gap: 8px; }
    .fs-kopf { flex-basis: auto; }
    .fs-label { font-size: 10.5px; }
}

/* Filter der Teileliste im Auftrag (Rainer 09.11.2026) */
.teile-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.teile-filter .teile-filter-zahl { margin-left: 4px; font-weight: 700; opacity: .85; }
