/* ===========================================================
   GRUNDSTYLES
   =========================================================== */

#app input {
    display: block;
    margin: 5px 0;
    padding: 8px;
}

button {
    padding: 8px 12px;
    color: #000;
    font-family: inherit;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
}


/* ===========================================================
   HEADER: MENÜBUTTON + LOGO + TEXT + TABS
   =========================================================== */

.tabs-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: #009846;
}

/* Linke Gruppe: ☰ + ← + Label */
.tabs-header-left {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

/* Rechte Gruppe: ⋮ */
.tabs-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    margin-left: auto;
}

/* Menübuttons links + rechts */
.tabs-menu-toggle {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    flex-shrink: 0;
}

.tabs-menu-toggle:hover {
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
}

/* rechter Toggle (Settings ⋮) — kein margin-left:auto mehr, liegt in eigener Spalte */
.tabs-menu-toggle-right {
    margin-left: 0;
}

/* Back-Button */
.tabs-back-btn {
    font-size: 20px;
    padding: 0 10px;
    min-width: 36px;
    opacity: 0.35;
    cursor: default;
}

.tabs-back-btn:not([disabled]) {
    opacity: 1;
    cursor: pointer;
}

/* Titel */
.tabs-app-label {
    padding: 2px 0;
    font-size: 22px;
    font-weight: bold;
    color: #ffffff;
    white-space: nowrap;
}

/* Tabs Wrapper */
.tabs-frame {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: flex-start;
    overflow: hidden;
    margin-left: 20px;
}


/* ===========================================================
   TAB-LEISTE
   =========================================================== */

.tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 8px;
    padding: 6px 4px;
    background: transparent;
    max-width: 100%;
}

/* Scrollbar */
.tabs::-webkit-scrollbar {
    height: 8px;
}
.tabs::-webkit-scrollbar-thumb {
    background: #ffffff;
    border-radius: 4px;
}
.tabs {
    scrollbar-width: thin;
    scrollbar-color: #ffffff transparent;
}


/* ===========================================================
   EINZELNE TABS
   =========================================================== */

.tabs button.tab-button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 10px 16px;
    background: transparent;

    border: none;
    border-radius: 0;
    cursor: pointer;

    font-size: 16px;
    color: #ffffff;
}

.tabs button.tab-button:hover {
    background: rgba(255,255,255,0.15);
    border-radius: 999px;
}

/* aktiver Tab */
.tabs button.tab-button.active {
    color: #009846;
    background: #ffffff;
    border-bottom-color: #009846;
    border-radius: 999px;
}

.tabs button:hover {
    background: rgba(255,255,255,0.2);
}

.tabs button.active {
    background: #ffffff;
    color: #009846;
    border-color: #009846;
}


/* ===========================================================
   TAB ICONS
   =========================================================== */

.tab-menu-icon,
.tab-close {
    font-size: 0.9rem;
    cursor: pointer;
}

.tabs button:not(.active) .tab-menu-icon,
.tabs button:not(.active) .tab-close {
    color: #ffffff;
}

.tabs button.active .tab-menu-icon,
.tabs button.active .tab-close {
    color: #009846;
}

.tab-close:hover {
    color: red;
}


/* ===========================================================
   DUPLIZIERTE TABS
   =========================================================== */

.tabs button.tab-duplicated:not(.active) {
    background: #ffe9b3;
    color: #009846;
    border-color: #e2b256;
}

.tabs button.tab-duplicated.active {
    background: #ffd77a;
    color: #009846;
    border-color: #c8992f;
}


/* ===========================================================
   TAB-INHALT
   =========================================================== */

.tab-content {
    position: relative;
    display: none;
    width: 100%;
    height: calc(100vh - 60px);
}

.tab-content.active {
    display: block;
}

.tab-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}


/* ===========================================================
   LOADER
   =========================================================== */

.tab-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    color: #fff;
}

.tab-loader-box {
    background: #333;
    padding: 10px 16px;
    border-radius: 4px;
}


/* ===========================================================
   KONTEXTMENÜ (TAB ⋮)
   =========================================================== */

.tab-menu {
    position: absolute;
    display: none;
    background: #ffffff;
    border-radius: 6px;
    min-width: 150px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    z-index: 9999;
}

.tab-menu button {
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.tab-menu button:hover {
    background: #f0f0f0;
}


/* ===========================================================
   DROPDOWN-MENÜS (LINKS + RECHTS)
   =========================================================== */

.tabs-dropdown-menu {
    position: fixed;
    top: 56px;
    left: 8px;
    right: 8px;

    background: #009846;
    border-radius: 8px;
    padding: 4px 0;
    display: none;

    max-height: 60vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    z-index: 10000;
}

.tabs-dropdown-menu.open {
    display: block;
}

/* RECHTES DROPDOWN */
.tabs-dropdown-right {
    left: auto;
    right: 10px;
    width: 220px;
}

/* DROPDOWN BUTTONS – NUR UNTERSTRICH */
.tabs-dropdown-menu button {
    width: 100%;
    padding: 12px 16px;

    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.35);

    text-align: left;
    font-size: 16px;
    color: #ffffff;
    cursor: pointer;

    outline: none;
    border-radius: 0;
}

.tabs-dropdown-menu button:last-child {
    border-bottom: none;
}

.tabs-dropdown-menu button:hover {
    background: rgba(255,255,255,0.12);
}


/* ===========================================================
   HELP / ABOUT MODAL
   =========================================================== */

.help-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.help-modal.hidden {
    display: none;
}

.help-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}

.help-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 90vw;
    height: 90vh;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.help-modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
}


/* ===========================================================
   TOAST-BENACHRICHTIGUNG
   =========================================================== */

.pwa-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;

    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;

    background: #333;
    color: #fff;
    font-size: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    max-width: 90vw;

    animation: pwa-toast-in 0.2s ease;
}

@keyframes pwa-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pwa-toast button {
    background: #009846;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.pwa-toast button:hover {
    background: #007a39;
}

.pwa-toast-close {
    background: transparent !important;
    color: #aaa !important;
    font-size: 16px !important;
    padding: 2px 6px !important;
}

.pwa-toast-close:hover {
    color: #fff !important;
    background: transparent !important;
}


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

@media (max-width: 800px) {
    .tabs-frame {
        display: none;
    }

    .tabs-app-label {
        font-size: 20px;
    }
}