/* PV-Prüfbefund - Hauptstylesheet */
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --success: #0d904f;
    --warning: #e8a817;
    --danger: #d93025;
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #1a1a2e;
    --text-light: #5f6368;
    --border: #dadce0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

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

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

/* Layout */
.app-container { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--text);
    color: #fff;
    padding: 1.5rem 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1rem;
}

.sidebar-header h2 { font-size: 1.1rem; font-weight: 600; }
.sidebar-header small { color: rgba(255,255,255,0.5); font-size: 0.75rem; }

.sidebar nav { flex: 1; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.15s;
    font-size: 0.9rem;
}

.sidebar nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
}

.main-content { flex: 1; padding: 2rem; overflow-y: auto; }

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

.page-header h1 { font-size: 1.5rem; font-weight: 600; }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body { padding: 1.5rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 0.3rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s;
    background: #fff;
}

.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(26,115,232,0.15); }

select.form-control { cursor: pointer; }

.form-row {
    display: grid;
    gap: 1rem;
}

.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.checkbox-group { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.checkbox-group label { margin-bottom: 0; cursor: pointer; font-size: 0.9rem; }

.radio-group { display: flex; gap: 1.5rem; flex-wrap: wrap; padding: 0.3rem 0; }
.radio-group label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; font-size: 0.9rem; margin-bottom: 0; }
.radio-group input[type="radio"] { width: 16px; height: 16px; cursor: pointer; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #0b7a43; }
.btn-warning { background: var(--warning); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b92720; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-lg { padding: 0.7rem 1.5rem; font-size: 1rem; }

/* Tables */
.table-container { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-light); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: rgba(0,0,0,0.02); }

/* Wizard */
.wizard-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
    position: relative;
}

.wizard-progress::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 24px;
    right: 24px;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    cursor: pointer;
}

.wizard-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    transition: all 0.2s;
}

.wizard-step.active .wizard-step-number { background: var(--primary); color: #fff; }
.wizard-step.completed .wizard-step-number { background: var(--success); color: #fff; }

.wizard-step-label {
    font-size: 0.65rem;
    color: var(--text-light);
    text-align: center;
    max-width: 80px;
    line-height: 1.2;
}

.wizard-step.active .wizard-step-label { color: var(--primary); font-weight: 600; }

.wizard-content { min-height: 400px; }

.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

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

/* Dropdown with search */
.select-with-info {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.select-with-info select { flex: 1; }
.select-with-info .btn { flex-shrink: 0; margin-top: 0; }

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a73e8 100%);
}

.login-card {
    background: var(--card);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-card h1 { font-size: 1.5rem; margin-bottom: 0.3rem; text-align: center; }
.login-card .subtitle { text-align: center; color: var(--text-light); margin-bottom: 2rem; font-size: 0.9rem; }
.login-card .btn { width: 100%; justify-content: center; padding: 0.7rem; }

.alert {
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.alert-error { background: #fce8e6; color: var(--danger); border: 1px solid #f5c6c2; }
.alert-success { background: #e6f4ea; color: var(--success); border: 1px solid #b7e1cd; }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
}

.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 0.8rem; color: var(--text-light); margin-top: 0.2rem; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--card);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-header .close-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.2rem;
}

.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Info box */
.info-box {
    background: #e8f0fe;
    border: 1px solid #d2e3fc;
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #1a56db;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
    .main-content { padding: 1rem; }
    .wizard-step-label { display: none; }
}

/* Field Color Coding - Fachkraft (rot markiert im PDF) */
.field-fachkraft .form-control,
.field-fachkraft select.form-control {
    background-color: #fff0f0;
    border-color: #e8a0a0;
}
.field-fachkraft .form-control:focus {
    background-color: #fff;
    border-color: var(--primary);
}
.field-fachkraft > label::after {
    content: ' (F)';
    color: #d93025;
    font-size: 0.7rem;
    font-weight: normal;
}

/* Field Color Coding - Optional/Techniker (gelb markiert im PDF) */
.field-optional .form-control,
.field-optional select.form-control {
    background-color: #f5f5f5;
    border-color: #d0d0d0;
}
.field-optional .form-control:focus {
    background-color: #fff;
    border-color: var(--primary);
}
.field-optional > label::after {
    content: ' (T)';
    color: #888;
    font-size: 0.7rem;
    font-weight: normal;
}

/* Suggestion Dropdown */
.suggestion-wrapper { position: relative; }
.suggestion-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: none;
}
.suggestion-list.active { display: block; }
.suggestion-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid #f0f0f0;
}
.suggestion-item:hover { background: #e8f0fe; }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-count {
    float: right;
    font-size: 0.7rem;
    color: var(--text-light);
    background: #f0f0f0;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
}

/* Projekt Cards */
.projekt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.projekt-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.15s;
    cursor: pointer;
}
.projekt-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.projekt-card .projekt-title { font-weight: 600; font-size: 1rem; margin-bottom: 0.3rem; }
.projekt-card .projekt-meta { font-size: 0.8rem; color: var(--text-light); }
.projekt-card .projekt-status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.5rem;
}
.projekt-card .projekt-status.entwurf { background: #fff3cd; color: #856404; }
.projekt-card .projekt-status.abgeschlossen { background: #d4edda; color: #155724; }

/* PDF Export Choice */
.pdf-choice-container {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
}
.pdf-choice-card {
    flex: 1;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.pdf-choice-card:hover { border-color: var(--primary); background: #f8faff; }
.pdf-choice-card.selected { border-color: var(--primary); background: #e8f0fe; }
.pdf-choice-card .pdf-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.pdf-choice-card .pdf-label { font-weight: 600; }
.pdf-choice-card .pdf-desc { font-size: 0.8rem; color: var(--text-light); margin-top: 0.3rem; }

/* Prüf-Matrix Tabelle */
.pruef-matrix-wrapper { overflow-x: auto; margin-bottom: 1.5rem; }
.pruef-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.pruef-matrix th {
    background: #e8f0fe;
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.6rem 0.5rem;
    text-align: center;
    border: 1px solid var(--border);
    text-transform: none;
    letter-spacing: 0;
    vertical-align: bottom;
    line-height: 1.3;
}
.pruef-matrix td {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    vertical-align: middle;
}
.pruef-matrix .pm-label-col { width: 160px; }
.pruef-matrix .pm-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text);
    background: #f8f9fa;
    white-space: nowrap;
}
.pruef-matrix .form-control {
    font-size: 0.8rem;
    padding: 0.35rem 0.5rem;
}
.pruef-matrix .pm-cb-cell {
    text-align: center;
}
.pruef-matrix .pm-cb-cell input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}
.pruef-matrix .pm-select {
    width: 65px;
    margin: 0 auto;
    padding: 0.25rem;
    font-size: 0.8rem;
    text-align: center;
}
.pruef-matrix tr:hover td { background: rgba(26,115,232,0.03); }
.pruef-matrix tr:hover .pm-label { background: #eef2f6; }

/* Color legend */
.color-legend {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 0.6rem 1rem;
    background: #f8f9fa;
    border-radius: var(--radius);
    font-size: 0.8rem;
}
.color-legend-item { display: flex; align-items: center; gap: 0.4rem; }
.color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid #ccc;
}
.color-swatch.fachkraft { background: #fff0f0; border-color: #e8a0a0; }
.color-swatch.optional { background: #f5f5f5; border-color: #d0d0d0; }

/* Helper */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--text-light); font-size: 0.85rem; }
