/* 'css/style.css' */
body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f5faff;
    color: #222;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 950px;
    margin: 40px auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
    padding: 32px 40px;
}

h1, h2, h3 {
    color: #0077a6;
    margin-top: 0;
}

/* Navigation */
nav.admin-nav {
    margin-bottom: 2em;
    background: #0077a6;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    overflow-x: auto;
}
.admin-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}
.admin-nav li { margin: 0; }
.admin-nav a {
    display: block;
    padding: 1em 1.2em;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    border-right: 1px solid #005e85;
}
.admin-nav a:last-child { border-right: none; }
.admin-nav a.active, .admin-nav a:hover {
    background: #005e85;
    color: #ffe066;
}

.error, .error-msg {
    background: #ffe0e0;
    color: #c0392b;
    border: 1px solid #ebb0b0;
    border-radius: 4px;
    padding: 1em;
    margin-bottom: 1em;
}

.success-msg {
    background: #e0ffe0;
    color: #237a23;
    border: 1px solid #b0ebb0;
    border-radius: 4px;
    padding: 1em;
    margin-bottom: 1em;
}

form {
    margin-bottom: 1.5em;
}
label {
    display: block;
    margin-top: 1em;
    margin-bottom: 0.3em;
    font-weight: 500;
}
input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="datetime-local"], textarea, select {
    width: 100%;
    padding: 0.5em;
    border: 1px solid #b0c4d8;
    border-radius: 4px;
    font-size: 1em;
    margin-bottom: 0.5em;
    box-sizing: border-box;
    background: #f9fbfc;
    transition: border 0.2s;
}
input:focus, textarea:focus, select:focus {
    border-color: #0077a6;
    outline: none;
}
button, .icon-btn {
    background: #0077a6;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 24px;
    cursor: pointer;
    font-size: 1.05em;
    margin-top: 0.5em;
    transition: background 0.2s;
}
button:hover, .icon-btn:hover {
    background: #005e85;
}
.btn-reset {
    background: #aaaaaa;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
    background: #fff;
}
th, td {
    padding: 7px 8px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}
th {
    background: #f3f8fb;
    font-weight: 600;
}
tr:nth-child(even) td {
    background: #f9fbfd;
}
.treebox {
    background: #f5f9fc;
    border-radius: 5px;
    border: 1px solid #ddeaf8;
    padding: 12px 20px;
    font-family: monospace;
    margin-top: 20px;
    font-size: 1.07em;
}

/* Modals: Institution, Apotheke, Klient */
#institutionModal,
#apothekeModal,
#klientModal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.13);
    padding: 32px 40px;
    display: none;
    min-width: 400px;
    max-width: 1200px;
    width: 95vw;
    animation: modalFadeIn 0.15s;
    overflow-x: auto;
    max-height: 95vh;
    overflow-y: auto;
}
#institutionModal.active,
#apothekeModal.active,
#klientModal.active {
    display: block;
}
.inst-link {
    color: #0077a6;
    text-decoration: underline;
    cursor: pointer;
}
.inst-link:hover {
    color: #005e85;
}

#apothekeModal h3,
#institutionModal h3,
#klientModal h3 {
    margin-top: 0;
    color: #0077a6;
    margin-bottom: 1em;
}
#apothekeModal form,
#institutionModal form,
#klientModal form {
    background: #f7fafc;
    border-radius: 6px;
    padding: 18px 22px 12px 22px;
    margin-bottom: 1.2em;
    box-shadow: 0 1px 4px #0001;
}
#apothekeModal label,
#institutionModal label,
#klientModal label {
    display: flex;
    align-items: center;
    margin-bottom: 0.7em;
    font-weight: 500;
}
#apothekeModal label input,
#apothekeModal label select,
#institutionModal label input,
#institutionModal label select,
#klientModal label input,
#klientModal label select {
    flex: 1;
    margin-left: 1em;
    margin-bottom: 0;
}
#apothekeModal button[type="submit"],
#institutionModal button[type="submit"],
#klientModal button[type="submit"] {
    margin-right: 1em;
}
#apothekeModal h4,
#institutionModal h4,
#klientModal h4 {
    margin-top: 1.5em;
    color: #005e85;
    font-size: 1.1em;
    margin-bottom: 0.5em;
}
#apothekeModal ul#patientenListe,
#institutionModal ul#patientenListe,
#klientModal ul#arztListe {
    background: #f9fbfd;
    border: 1px solid #ddeaf8;
    border-radius: 4px;
    padding: 0.7em 1.1em;
    margin-bottom: 1.2em;
    list-style: disc inside;
    min-height: 2.2em;
}
#apothekeModal ul#patientenListe li,
#institutionModal ul#patientenListe li,
#klientModal ul#arztListe li {
    margin-bottom: 0.3em;
}

/* Medikamenten-Tabelle im Modal */
#klientModal table#medikamentTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8em;
    margin-top: 0.5em;
}
#klientModal table#medikamentTable th,
#klientModal table#medikamentTable td {
    padding: 5px 4px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    text-align: left;
}
#klientModal table#medikamentTable th {
    background: #eaf3fb;
    font-size: 0.9em;
    text-align: center;
    line-height: 1.1;
    height: 2.3em;
}
#klientModal table#medikamentTable input[type="text"] {
    font-size: 0.85em;
    padding: 0.15em 0.3em;
    margin: 0;
    border-radius: 4px;
    border: 1px solid #b0c4d8;
    background: #fff;
}
#klientModal table#medikamentTable input[type="text"]:focus {
    border-color: #0077a6;
}
#klientModal table#medikamentTable .med-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.2em 0.4em;
    font-size: 1.1em;
    color: #0077a6;
    transition: color 0.2s;
    vertical-align: middle;
}
#klientModal table#medikamentTable .med-btn:hover {
    color: #005e85;
}
#klientModal table#medikamentTable .med-btn.trash {
    color: #e74c3c;
}
#klientModal table#medikamentTable .med-btn.trash:hover {
    color: #c0392b;
}
#klientModal table#medikamentTable input.feld-pzn {
    width: 70px;
    min-width: 60px;
    max-width: 100px;
}
#klientModal table#medikamentTable input.feld-wirkstoff {
    width: 180px;
    min-width: 120px;
    max-width: 260px;
}
#klientModal table#medikamentTable input.feld-handelsname {
    width: 180px;
    min-width: 120px;
    max-width: 260px;
}
#klientModal table#medikamentTable input.feld-staerke {
    width: 80px;
    min-width: 60px;
    max-width: 120px;
}
#klientModal table#medikamentTable input.feld-dosis {
    width: 38px;
    min-width: 30px;
    max-width: 50px;
    text-align: center;
}
#klientModal table#medikamentTable input.feld-hinweis {
    width: 110px;
    min-width: 80px;
    max-width: 180px;
}
#klientModal table#medikamentTable input.feld-grund {
    width: 110px;
    min-width: 80px;
    max-width: 180px;
}

/* Submodal für inaktive Medikamente */
#submodalOverlay, #submodalInaktiv {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 1050;
    display: none;
}
#submodalInaktiv.active, #submodalOverlay.active {
    display: block;
}
#submodalInaktiv {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.13);
    padding: 28px 32px;
    min-width: 350px;
    max-width: 600px;
    z-index: 1101;
}
#submodalBestellungen {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.13);
    padding: 28px 32px;
    min-width: 350px;
    max-width: 600px;
    z-index: 1051;
    display: none;
}
#submodalBestellungen.active {
    display: block;
}
#submodalBestellungen h4 {
    margin-top: 0;
    color: #005e85;
}

#submodalBestellungen table {
    font-size: 0.93em;
    margin-bottom: 1em;
    width: 100%;
    border-collapse: collapse;
}

#submodalBestellungen th,
#submodalBestellungen td {
    border-bottom: 1px solid #e2e8f0;
    padding: 5px 8px;
    text-align: left;
}

#submodalBestellungen .icon-btn {
    font-size: 1.1em;
    color: #0077a6;
}
#submodalInaktiv h4 {
    margin-top: 0;
    color: #005e85;
}
#submodalInaktiv table {
    font-size: 0.93em;
    margin-bottom: 1em;
}
#submodalInaktiv th, #submodalInaktiv td {
    padding: 5px 8px;
}
#submodalInaktiv .icon-btn {
    font-size: 1.1em;
}

#modalOverlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 1000;
    display: none;
}
#modalOverlay.active {
    display: block;
}

.modal-row {
    display: flex;
    gap: 1.5em;
    align-items: flex-end;
    margin-bottom: 1em;
}
.modal-row label {
    flex: 1 1 0;
    margin-bottom: 0;
}
/* Benutzerverwaltung – Styles integriert in css/style.css */

.benutzer-form-narrowbox {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.09);
    padding: 24px 28px 18px 28px;
    max-width: 420px;
    min-width: 260px;
    margin: 42px auto 0 auto;
    border: 1px solid #e2e8f0;
    margin-bottom: 2.5em;
}
.benutzer-form-narrowbox h2 {
    font-size: 1.15em;
    color: #0077a6;
    text-decoration: underline;
    margin-top: 0;
    margin-bottom: 1.14em;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.benutzer-form-narrowbox .btn { 
    width: 100%; 
    margin-top: 1.1em;
}
.benutzerliste-table th,
.benutzerliste-table td {
    padding: 6px 8px; 
    border-bottom: 1px solid #e2e8f0;
}
.benutzerliste-table th { 
    background: #f3f8fb; 
}
.benutzerliste-table {
    width: 100%; 
    background: #fff; 
    margin-bottom: 45px;
}
.benutzerliste-table tr.inaktiv td { 
    color: #bbb; 
}
.icon-btn { 
    border: none; 
    background: none; 
    color: #888; 
    cursor: pointer; 
    font-size: 1.15em;
}
.icon-btn:hover { 
    color: #0077a6;
}
/* Schmalerer Rahmen entsprechend dem Formularfeld */
.export-form-narrowbox {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.09);
    padding: 30px 28px 24px 28px;
    max-width: 370px;
    min-width: 260px;
    margin: 45px auto 0 auto;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
@media (max-width: 500px) {
    .export-form-narrowbox { max-width: 98vw; min-width: 0; padding: 18px 6vw 14px 6vw;}
}
.export-form-narrowbox h2 {
    font-size: 1.15em;
    color: #0077a6;
    text-decoration: underline;
    margin-top: 0;
    margin-bottom: 1.4em;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.export-form-narrowbox .desc {
    color: #444;
    font-size: 0.97em;
    background: #f3f8fb;
    border: 1px solid #ddeaf8;
    border-radius: 6px;
    padding: 12px 15px;
    margin-top: 0.5em;
    margin-bottom: 0;
}
.export-form-narrowbox .btn {
    width: 100%;
    font-size: 1em;
    margin-top: 0.1em;
    margin-bottom: 1.1em;
}
 .bestellung-institution-header { margin-top: 2em; margin-bottom: 0.5em; font-weight: bold; font-size: 1.1em; color: #1a6fb4;}
        .order-table { width: 100%; border-collapse: collapse; margin-bottom: 2em;}
        .order-table th, .order-table td { border: 1px solid #ddd; padding: 8px;}
        .order-table th { background: #f0f0f0;}
        @media (max-width: 600px) {
            .order-table, .order-table thead, .order-table tbody, .order-table th, .order-table td, .order-table tr { display: block;}
            .order-table tr { margin-bottom: 1em; }
            .order-table td { border: none; }
            .order-table th { display: none; }
        }

.rolle-form-narrowbox {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.09);
    padding: 28px 30px 24px 30px;
    max-width: 430px;
    min-width: 240px;
    margin: 45px auto 0 auto;
    border: 1px solid #e2e8f0;
}
.rolle-form-narrowbox h2 {
    color: #0077a6;
    font-size: 1.17em;
    margin-top: 0; margin-bottom: 1.3em;
    letter-spacing: 0.01em;
    text-decoration: underline;
}
.menue-rechte-table { 
    width: 100%; border-collapse: collapse; margin-top:18px;
    margin-bottom: 20px;
}
.menue-rechte-table th, .menue-rechte-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}
.menue-rechte-table th {
    background: #f3f8fb;
}
.rolle-form-narrowbox .btn {
    width: 100%;
    font-size: 1em;
    margin-top: 1.1em;
}
.dashboard-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}
.card {
    background: #f9f9f9;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 0 6px rgba(0,0,0,0.05);
    width: 200px;
    text-align: center;
}
.card h3 {
    margin: 0;
    font-size: 16px;
    color: #555;
}
.card p {
    font-size: 24px;
    font-weight: bold;
    color: #222;
}
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}
.chart-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
}

/* Wichtig für Dropdown: Eltern müssen position: relative haben */
.admin-nav ul.gruppen-liste > li.gruppen-item {
    position: relative;
    /* overflow sichtbar machen wenn irgendwo anders gesetzt */
    overflow: visible !important;
    z-index: 1000;
}

/* Dropdown-Menü (.submenu) */
.admin-nav .submenu {
    position: absolute !important;
    top: 100%;
    left: 0;
    background: #0077a6;
    min-width: 180px;
    padding: 0;
    margin: 0;
    border-radius: 0 0 8px 8px;
    list-style: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
    display: none;
    white-space: nowrap;
    z-index: 9999;
}

/* Sichtbar, wenn .open gesetzt */
.admin-nav li.gruppen-item.open > ul.submenu {
    display: block !important;
}

/* Das Styling der Links im Dropdown */
.admin-nav .submenu li a {
    display: block;
    padding: 0.75em 1.2em;
    color: #ffe066;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid #005e85;
}

.admin-nav .submenu li a:hover,
.admin-nav .submenu li a:focus,
.admin-nav .submenu li a.active {
    background-color: #005e85;
    color: #fff;
}

/* Pfeil rotation bei geöffnetem Menü */
.admin-nav .gruppen-item.open > button.gruppen-label .arrow {
    transform: rotate(180deg);
}

/* Optional: sorgt dafür, dass Menüzeile nicht umbrechen */
.admin-nav ul.gruppen-liste {
    flex-wrap: nowrap !important;
}
.admin-nav,
.admin-nav * {
    overflow: visible !important;
}

.admin-nav .gruppen-item {
    position: relative !important;
    z-index: 1000 !important;
}

.admin-nav .submenu {
    position: absolute !important;
    top: 100%;
    left: 0;
    background: #0077a6;
    min-width: 180px;
    padding: 0;
    margin: 0;
    border-radius: 0 0 8px 8px;
    list-style: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
    display: none;
    z-index: 9999 !important;
}

.admin-nav .gruppen-item.open > .submenu {
    display: block !important;
}

.admin-nav .submenu li a {
    display: block;
    padding: 0.75em 1.2em;
    color: #ffe066;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid #005e85;
    white-space: nowrap;
    background: #0077a6;
}

.admin-nav .submenu li a:hover,
.admin-nav .submenu li a:focus,
.admin-nav .submenu li a.active {
    background-color: #005e85;
    color: #fff;
}


@media (max-width: 700px) {
    .container, #institutionModal, #klientModal, #apothekeModal { padding: 1em 0.4em; border-radius: 0; box-shadow: none; }
    h1, h2, h3 { font-size: 1.2em; }
    #apothekeModal, #institutionModal, #klientModal { min-width: 0; max-width: 98vw; }
    .modal-row { flex-direction: column; gap: 0; }
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: translate(-50%, -55%);}
    to   { opacity: 1; transform: translate(-50%, -50%);}
}
::-webkit-input-placeholder { color: #b0b0b0; }
::-moz-placeholder { color: #b0b0b0; }
::placeholder { color: #b0b0b0; }
