/* =========================================
   GLOBAL
========================================= */

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f7f8;
    color: #333;
}

h1 {
    margin-top: 0;
    font-size: 26px;
    margin-bottom: 20px;
}

h2 {
    margin-top: 0;
    font-size: 18px;
    margin-bottom: 12px;
}

.menu-toggle {
    display: none;
}

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

.dashboard {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

.sidebar {
    width: 240px;
    background: #0d4d1f;
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1000;
}

.sidebar .logo {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 30px;
}

.nav-main a {
    display: block;
    padding: 12px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: 0.2s;
}

.nav-main a:hover:not(.active) {
    background: rgba(255,255,255,0.15);
}

.nav-main a.active {
    background: #2e8f47 !important;
    color: white !important;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35);
}

.nav-bottom {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.nav-bottom a {
    display: block;
    padding: 12px 10px;
    color: white;
    opacity: 0.8;
    text-decoration: none;
}

.content {
    flex: 1;
    padding: 30px;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

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

.login-container {
    max-width: 420px;
    margin: 120px auto;
    background: white;
    padding: 40px;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    text-align: center;
}

.login-container input {
    width: 100%;
    padding: 14px;
    margin-bottom: 18px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
}

.login-container button {
    width: 100%;
    padding: 14px;
    background: #2e7d32;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
}

/* Mobil Login größer */
@media (max-width: 700px) {
    .login-container {
        max-width: 90%;
        margin: 60px auto;
        padding: 30px;
        border-radius: 16px;
    }

    .login-container input,
    .login-container button {
        font-size: 18px;
        padding: 16px;
    }
}

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

.card {
    background: white;
    padding: 18px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

/* =========================================
   FILTER
========================================= */

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-group input,
.filter-group select {
    height: 34px;
    padding: 0 8px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    appearance: none;
}

input[name="kind_nr"]      { width: 90px; }
select[name="geschlecht"]  { width: 120px; }
select[name="alter_kind"]  { width: 70px; }
input[name="sozialamt"]    { width: 160px; }
select[name="status"]      { width: 120px; }

.filter-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.filter-group .error {
    font-size: 11px;
    color: #b30000;
}

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

.btn {
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    color: white;
    display: inline-block;
    transition: 0.2s;
    border: none;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.btn-green  { background: #1b7a36; }
.btn-red    { background: #b30000; }
.btn-orange { background: #ff9800; }
.btn-online { background: #0077cc; }
.btn-offline{ background: #d98200; }
.btn-vergeben { background: #2d7a00; }
.btn-reset  { background: #b30000; }

.btn:hover {
    opacity: 0.9;
}

/* =========================================
   TABLE
========================================= */

.table-wrapper {
    overflow-x: auto;
    padding-bottom: 14px;
    padding-right: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e5e5;
    vertical-align: top;
}

th {
    background: #f0f0f0;
    font-weight: 600;
    text-align: left;
}

td.wrap {
    white-space: normal;
    word-break: break-word;
}

td.actions {
    text-align: right;
    white-space: nowrap;
}

/* =========================================
   MOBILE-KARTEN
========================================= */

.mobile-card { display: none; }

.mobile-row {
    display: flex;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    gap: 10px;
}

.mobile-label {
    font-weight: 600;
    width: 110px;
    flex-shrink: 0;
}

.mobile-text {
    flex-grow: 1;
    word-break: break-word;
}

.mobile-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

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

@media (max-width: 900px) {
    .content {
        padding: 16px;
        padding-top: 60px;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        width: 240px;
        transition: left 0.3s ease;
        z-index: 999;
        padding-top: 60px;
    }

    .sidebar.open {
        left: 0 !important;
    }

    .menu-toggle {
        display: block;
        position: fixed;
        top: 15px;
        left: 15px;
        background: #0d4d1f;
        color: white;
        padding: 10px 14px;
        border-radius: 6px;
        font-size: 18px;
        cursor: pointer;
        z-index: 1000;
    }
}

@media (max-width: 700px) {

    .table-wrapper { display: none; }

    .mobile-card {
        display: block;
        background: white;
        padding: 12px;
        border-radius: 10px;
        margin-bottom: 12px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }

    .filter-form {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .filter-group {
        flex-direction: column;
        gap: 6px;
        width: 100%;
    }

    .filter-group input,
    .filter-group select {
        width: 100% !important;
        height: 32px;
        font-size: 12px;
        padding: 0 6px;
    }

    .filter-actions {
        width: 100%;
        display: flex;
        gap: 6px;
    }

    .filter-actions .btn {
        flex: 1;
        padding: 6px;
        font-size: 12px;
    }
}

/* =========================================
   ADMIN NAVIGATION
========================================= */

.admin-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.admin-nav .nav-active {
    background: #1b7a36 !important;
    color: white !important;
}

.admin-nav .btn:hover:not(.nav-active) {
    opacity: 0.9;
}

/* =========================================
   MOBILE FIX – 2 Buttons pro Reihe
========================================= */

@media (max-width: 700px) {

    .admin-nav {
        display: flex !important;
        flex-wrap: wrap !important;
        flex-direction: row !important;
        gap: 10px !important;
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    .admin-nav .btn {
        flex: 0 0 calc(50% - 10px) !important;
        width: calc(50% - 10px) !important;
        text-align: center;
        white-space: normal;
    }
}

/* =========================================
   UPLOAD-FELD GRÖSSER
========================================= */

input[type="file"] {
    font-size: 16px;
    padding: 10px;
}

/* =========================================
   INLINE-FORM FIX
========================================= */

.inline-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
    width: 100%;
}

/* =========================================
   MASSENAKTION – Eingabefeld größer
========================================= */

.inline-form input[name="range_input"] {
    font-size: 18px;
    padding: 12px;
    width: 100%;
    max-width: 480px;
    box-sizing: border-box;
}

/* =========================================
   MASSENAKTION – Buttons mobil untereinander
========================================= */

@media (max-width: 700px) {
    .inline-form .section-actions {
        display: flex;
        flex-direction: column;
        gap: 14px;
        width: 100%;
    }

    .inline-form .section-actions .btn {
        width: 100%;
    }
}

/* =========================================
   ABSTAND ZUM IMPORT-BUTTON
========================================= */

.section-actions {
    margin-top: 20px;
}
/* =========================================
   SAFARI FIX – Navigation 2 Spalten
========================================= */

@media (max-width: 700px) {

    .admin-nav {
        display: flex !important;
        flex-wrap: wrap !important;
        flex-direction: row !important;
        gap: 10px !important;
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    .admin-nav .btn,
    .admin-nav .btn-online {
        flex: 0 0 calc(50% - 10px) !important;
        width: calc(50% - 10px) !important;
        display: flex !important;
        justify-content: center;
        align-items: center;
        white-space: normal;
        text-align: center;
    }
}

/* =========================================
   Biberliverkauf
========================================= */


.price-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.price-row {
    display: flex;
    flex-direction: column;
}

.price-row input {
    padding: 10px;
    font-size: 1.1rem;
}

.price-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-left {
    display: flex;
    gap: 10px;
}

.filter-input {
    height: 42px;
    font-size: 1rem;
}

.export-btn {
    height: 42px;
    display: flex;
    align-items: center;
}
.cleanup-select {
    height: 42px;
    font-size: 1rem;
    padding: 6px;
}
.price-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 40px;
    margin-top: 10px;
}

.price-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.price-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-input input {
    flex: 1;
    padding: 10px;
    font-size: 1rem;
}

.currency {
    font-weight: bold;
    color: #444;
}

.price-actions {
    grid-column: 1 / 3;
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.filter-left {
    display: flex;
    gap: 10px;
}

.filter-input {
    height: 40px !important;
    padding: 0 12px;
    font-size: 1rem;
}

.export-btn {
    display: flex;
    align-items: center;
}

.table-spacing {
    height: 15px;
}
.sujet-label {
    font-weight: bold;
}
.sujet-label {
    font-weight: 700 !important;
}
@media (max-width: 768px) {

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .filter-left {
        width: 100%;
        justify-content: space-between;
    }

    .filter-input {
        height: 38px !important;
        width: 100%;
    }

    .export-btn {
        width: 100%;
        height: 38px !important;
        justify-content: center;
    }
}
/* Fix: Filter- und Export-Buttons auf Standard-Button-Grösse bringen */
.filter-input,
.export-btn {
    height: auto !important;
    line-height: normal !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
/* Fix: Sujet-Labels auch mobil fett */
.price-item label.sujet-label {
    font-weight: 700 !important;
}
/* Fix: Sidebar mobil vollständig anzeigen + scrollbar */
@media (max-width: 900px) {
    .sidebar {
        height: auto !important;
        max-height: 100vh !important;
        overflow-y: auto !important;
        padding-bottom: 40px !important;
    }
}
/* Mobile Fix: Preisverwaltung einspaltig */
@media (max-width: 700px) {
    .price-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .price-actions {
        grid-column: 1 !important;
        justify-content: flex-start;
    }
}
/* Fix: Excel-Export mobil nicht volle Breite */
@media (max-width: 768px) {
    .export-btn {
        width: auto !important;
        min-width: 120px;
        padding: 0 14px !important;
    }
}
/* Finaler Fix: Excel-Export mobil normale Button-Grösse */
@media (max-width: 768px) {
    .export-btn {
        width: auto !important;
        padding: 8px 14px !important;
        height: 34px !important;
        line-height: 34px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
}
@media (max-width: 900px) {
    .content {
        padding-top: 0 !important;
    }
}
/* Mobil: Content-Titel rechtsbündig oder mittig */
@media (max-width: 900px) {
    .content > h1 {
        text-align: center !important;   /* oder right */
        margin-top: 0 !important;
    }
}
/* Mobil: Admin-Nav wirklich in 2 Spalten zwingen */
@media (max-width: 900px) {

    .admin-nav {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .admin-nav a {
        flex: 0 0 45% !important;   /* nimmt 45% der Breite ein */
        max-width: 45% !important;
        box-sizing: border-box !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        white-space: normal !important;
    }
}
/* Biberliproduktion – kleinere Personenfelder */
input[name="mindestpersonen"],
input[name="maximalpersonen"] {
    width: 80px !important;
    max-width: 80px !important;
}
/* =========================================
   ZEITFENSTER – Einheitliches Flex-Layout
========================================= */

.timeslot-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.timeslot-form div {
    display: flex;
    flex-direction: column;
}

.timeslot-form input[type="time"],
.timeslot-form input[type="number"] {
    width: 150px;
}

/* Mobile: Felder untereinander */
@media (max-width: 700px) {
    .timeslot-form {
        flex-direction: column;
        align-items: stretch;
    }

    .timeslot-form input[type="time"],
    .timeslot-form input[type="number"] {
        width: 100% !important;
    }
}
/* =========================================
   ZEITFENSTER – Einheitliches Flex-Layout
========================================= */

.timeslot-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.timeslot-form div {
    display: flex;
    flex-direction: column;
}

.timeslot-form input[type="time"],
.timeslot-form input[type="number"] {
    width: 150px;
}

/* Mobile: Felder untereinander */
@media (max-width: 700px) {
    .timeslot-form {
        flex-direction: column;
        align-items: stretch;
    }

    .timeslot-form input[type="time"],
    .timeslot-form input[type="number"] {
        width: 100% !important;
    }
}
/* =========================================
   MODAL – Popup für Zeitfenster
========================================= */

.modal {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999 !important;
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    width: 600px;
    max-width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.modal-close {
    float: right;
    font-size: 28px;
    cursor: pointer;
}
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    width: 600px;
    max-width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.modal-close {
    float: right;
    font-size: 28px;
    cursor: pointer;
}
/* =========================================
   GENERISCHES MODAL FÜR ALLE ADMIN-SEITEN
========================================= */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    width: 600px;
    max-width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.modal-close {
    float: right;
    font-size: 28px;
    cursor: pointer;
}
