/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: #333;
    background: #f5f7fa;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Navbar === */
.navbar {
    background: #C0275E;
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.navbar-brand a {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}
.navbar-school {
    margin-left: 1rem;
    font-size: 0.85rem;
    opacity: 0.85;
}
.navbar-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.navbar-user {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* === Container === */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
    flex: 1;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    background: #3478c6;
    color: #fff;
    transition: background 0.15s;
}
.btn:hover { background: #2a62a8; }
.btn-primary { background: #C0275E; }
.btn-primary:hover { background: #a02050; }
.btn-success { background: #34a853; color: #fff; }
.btn-success:hover { background: #2d8f47; }
.btn-danger { background: #d93025; color: #fff; }
.btn-danger:hover { background: #b5261f; }
.btn-outline {
    background: transparent;
    color: #3478c6;
    border-color: #3478c6;
}
.btn-outline:hover { background: #3478c6; color: #fff; }
.navbar .btn-outline { color: #fff; border-color: rgba(255,255,255,0.5); }
.navbar .btn-outline:hover { background: rgba(255,255,255,0.15); }
.navbar .btn-sm, .btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-block { display: block; width: 100%; text-align: center; }

/* === Flash Messages === */
.flash-messages { margin-bottom: 1rem; }
.flash {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.flash-success { background: #e6f4ea; color: #1e7e34; border: 1px solid #c3e6cb; }
.flash-error { background: #fce8e6; color: #d93025; border: 1px solid #f5c6cb; }
.flash-warning { background: #fef7e0; color: #856404; border: 1px solid #ffeeba; }
.flash-info { background: #e8f0fe; color: #1a73e8; border: 1px solid #b8d4fe; }

/* === Dashboard === */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.dashboard-header h1 { font-size: 1.5rem; }
.filter-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    background: #fff;
}

/* === Klasse Group === */
.klasse-group { margin-bottom: 1.5rem; }
.klasse-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
.klasse-header h2 { font-size: 1.1rem; color: #C0275E; }
.klasse-count { font-size: 0.85rem; color: #888; font-weight: 400; }
.empty-hint { font-size: 0.85rem; color: #999; }

/* === Import Dialog === */
.import-dialog {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.import-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.import-card h2 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.import-card p { font-size: 0.85rem; color: #666; margin-bottom: 1rem; }
.import-card input[type="file"] {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* === Table === */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.table th, .table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.table td { font-size: 0.9rem; }
.table .actions { white-space: nowrap; }
.inline-form { display: inline; }
.clickable-row { cursor: pointer; transition: background 0.1s; }
.clickable-row:hover { background: #f0f4ff; }
.zeugnis-link { color: #333; text-decoration: none; }
.zeugnis-link:hover { color: #C0275E; }

/* === Badge === */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-draft { background: #e8f0fe; color: #1a73e8; }
.badge-submitted { background: #fef7e0; color: #856404; }
.badge-approved { background: #e6f4ea; color: #1e7e34; }
.badge-rejected { background: #fce8e6; color: #d93025; }

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.empty-state p { margin-bottom: 1rem; color: #666; }

/* === Login === */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}
.login-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 400px;
    width: 100%;
}
.login-card h1 { margin-bottom: 0.25rem; color: #C0275E; }
.login-subtitle { color: #666; margin-bottom: 2rem; }
.login-hint { margin-top: 1rem; font-size: 0.85rem; color: #888; }
.login-info { margin-bottom: 1rem; color: #666; }
.error-text { color: #d93025; margin-bottom: 1.5rem; }

/* === Zeugnis Edit === */
.zeugnis-edit { background: #fff; border-radius: 6px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.edit-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.edit-header h1 { font-size: 1.3rem; }
.edit-meta { display: flex; gap: 0.75rem; align-items: center; }
.version-info { font-size: 0.85rem; color: #888; }

/* === Tabs === */
.tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    gap: 0;
}
.tab-btn {
    padding: 0.6rem 1rem;
    border: none;
    background: none;
    font-size: 0.85rem;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: #C0275E; }
.tab-btn.active { color: #C0275E; border-bottom-color: #C0275E; font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === Form === */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-group { margin-bottom: 0.75rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 0.25rem;
}
.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #C0275E;
    box-shadow: 0 0 0 2px rgba(192,39,94,0.15);
}
.form-inline { display: flex; align-items: center; gap: 0.5rem; }
.form-inline label { margin-bottom: 0; white-space: nowrap; }
.form-inline select { width: auto; }
.gesamtnote { margin-top: 1rem; padding: 0.75rem; background: #f8f9fa; border-radius: 4px; }

/* === Rating Table === */
.rating-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}
.rating-table th, .rating-table td {
    padding: 0.35rem 0.5rem;
    border: 1px solid #ddd;
    font-size: 0.85rem;
}
.rating-table th {
    background: #f5f5f5;
    font-weight: 600;
}
.rating-table .col-item { text-align: left; }
.rating-table .col-check { text-align: center; width: 48px; }
.rating-table input[type="radio"] { cursor: pointer; }
.col-clear { text-align: center; width: 32px; }
.btn-clear {
    border: none;
    background: none;
    color: #bbb;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
}
.btn-clear:hover { color: #d93025; background: #fce8e6; }
.sub-header td {
    background: #f8f9fa;
    font-weight: 600;
    padding-top: 0.5rem;
}

/* === Section Block === */
.section-block { margin-bottom: 2rem; }
.section-block h2 {
    font-size: 1rem;
    color: #C0275E;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3rem;
    margin-bottom: 0.75rem;
}
.section-prefix { font-size: 0.85rem; color: #666; margin-bottom: 0.5rem; }

/* === Form Actions === */
.form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    margin-top: 1.5rem;
}
.autosave-status { font-size: 0.8rem; color: #888; margin-left: auto; }

/* === Dashboard Actions === */
.dashboard-actions { display: flex; gap: 0.5rem; align-items: center; }
.col-check-batch { width: 36px; text-align: center; }
.col-check-batch input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; }

/* === Admin Button in Navbar === */
.navbar .btn-admin {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.5);
    font-weight: 600;
}
.navbar .btn-admin:hover { background: rgba(255,255,255,0.3); }

/* === Vorlage Edit === */
.vorlage-edit { background: #fff; border-radius: 6px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.vorlage-edit h1 { margin-bottom: 0.5rem; font-size: 1.3rem; }
.vorlage-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.vorlage-hint {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    padding: 0.6rem 0.75rem;
    background: #fef7e0;
    border: 1px solid #ffeeba;
    border-radius: 4px;
}
.help-text { color: #666; margin-bottom: 1.5rem; font-size: 0.9rem; }
.sub-section { margin-left: 1rem; }
.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.25rem; }
.label-row label { margin-bottom: 0; }
.btn-reset { font-size: 0.75rem; color: #888; border-color: #ccc; }
.btn-reset:hover { color: #d93025; border-color: #d93025; background: #fce8e6; }

/* === Accordion === */
.accordion-section {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}
.accordion-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    text-align: left;
    transition: background 0.15s;
}
.accordion-toggle:hover { background: #eef1f5; }
.accordion-title { flex: 1; }
.accordion-count { font-size: 0.8rem; color: #888; font-weight: 400; margin-right: 0.75rem; }
.accordion-arrow {
    font-size: 0.7rem;
    color: #999;
    transition: transform 0.2s;
}
.accordion-body {
    display: none;
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
}
.accordion-body textarea { font-size: 0.85rem; line-height: 1.6; }
.accordion-section.open .accordion-body { display: block; }
.accordion-section.open .accordion-arrow { transform: rotate(180deg); }

/* === Footer === */
.footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: #999;
    border-top: 1px solid #eee;
    margin-top: auto;
}

/* === Responsive === */
@media (max-width: 768px) {
    .navbar { flex-direction: column; gap: 0.5rem; }
    .form-grid { grid-template-columns: 1fr; }
    .dashboard-header { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
    .tabs { flex-wrap: nowrap; }
    .tab-btn { font-size: 0.75rem; padding: 0.5rem 0.6rem; }
    .table { font-size: 0.8rem; }
    .table th, .table td { padding: 0.4rem 0.5rem; }
    .form-actions { flex-wrap: wrap; }
}
