/* ============================================================
   SIDE PANEL + STOFF-LASCHE (wiederverwendbar)
   ============================================================ */

.side-panel,
.side-panel *,
.side-panel-ghost,
.side-panel-ghost * {
    box-sizing: border-box;
}

.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    width: 420px;
    max-width: 90vw;
    z-index: 9000;
    transform: translateX(100%);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.side-panel.open {
    transform: translateX(0);
}

.side-panel-content {
    height: 100%;
    width: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 30px 25px;
    background: rgba(26, 26, 26, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.side-panel-content::-webkit-scrollbar {
    display: none;
}

.side-panel .header {
    text-align: left;
    margin: 0 !important;
    padding: 0 0 20px 0 !important;
    cursor: pointer;
    transform: none !important;
}

.side-panel-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
}

.side-panel-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex-shrink: 0;
}

.side-panel-heading-text {
    min-width: 0;
}

.side-panel h1 {
    font-size: 1.7em;
    margin: 0 0 4px 0;
    line-height: 1.1;
    color: var(--text-color, #e0e0e0);
}

.side-panel .subtitle {
    font-size: 0.85em;
    color: #888;
    cursor: default;
    margin: 0;
    padding: 0;
}

.side-panel-footer:empty {
    display: none;
}

/* ---------- Lasche (Stofflabel) ---------- */
.side-panel-tab {
    position: absolute;
    top: 68%;
    left: -44px;
    transform: translateY(-50%);
    width: 44px;
    padding: 26px 0;
    margin-right: -1px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 10px 0 0 10px;
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 4px),
        linear-gradient(100deg, #4a4a4a 0%, #333 45%, #2b2b2b 100%);
    box-shadow:
        -5px 5px 14px rgba(0, 0, 0, 0.55),
        inset 1px 0 0 rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: left 0.2s ease, width 0.2s ease, filter 0.2s ease;
}

.side-panel-tab:hover {
    filter: brightness(1.12);
}

body.side-panel-open .side-panel-tab {
    width: 56px;
    left: -56px;
}

.side-panel-tab::before {
    content: '';
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 5px;
    right: 0;
    border: 1px dashed rgba(255, 255, 255, 0.32);
    border-right: none;
    border-radius: 6px 0 0 6px;
    pointer-events: none;
}

.side-panel-tab::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 6px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0));
    pointer-events: none;
}

.side-panel-tab-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-family: 'Courier New', 'Segoe UI', 'Yu Gothic UI', 'Meiryo', 'Noto Sans JP', sans-serif;
    font-size: 0.95em;
    font-weight: bold;
    letter-spacing: 3px;
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    font-variant-emoji: text;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    user-select: none;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.25s ease, filter 0.25s ease, letter-spacing 0.25s ease;
}

.side-panel-tab-label.swapping {
    opacity: 0;
    filter: blur(4px);
    letter-spacing: 8px;
}

/* ---------- Unsichtbarer Klickbereich (Position der geschlossenen Lasche) ---------- */
.side-panel-ghost {
    position: fixed;
    top: 68%;
    right: 0;
    transform: translateY(-50%);
    width: 44px;
    padding: 26px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9100;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    cursor: pointer;
}

body.side-panel-open .side-panel-ghost {
    visibility: visible;
    pointer-events: auto;
}

/* ---------- Unterer Bereich ---------- */
.side-panel-bottom {
    margin-top: auto;
    padding-top: 20px;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* Detail-Ansicht (aufgeklappte Card) */
.side-panel-detail:empty {
    display: none;
}

.side-panel-detail {
    margin-bottom: 15px;
}

.side-panel-detail #login-expanded-view {
    padding: 0 !important;
    height: auto !important;
}

.side-panel-detail .dashboard-card.in-panel.expanded {
    opacity: 1;
    animation: panelCardSlideUp 0.42s cubic-bezier(0.18, 1.12, 0.3, 1);
}

@keyframes panelCardSlideUp {
    from {
        opacity: 0.4;
        transform: translateY(70vh);
    }
    60% {
        opacity: 1;
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Kachel-Zeile - feste Groesse, bricht automatisch um */
.side-panel-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
}

/* Card als kompakte Kachel */
.side-panel-footer .dashboard-card.in-panel {
    box-sizing: border-box;
    flex: 1 1 0;
    min-width: 60px;
    max-width: 100%;
    height: 76px;
    min-height: 0;
    margin: 0;
    padding: 8px 4px;
    cursor: pointer;
    overflow: hidden;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    opacity: 1;
    transform: none;
    animation: none;
}

.side-panel-footer .dashboard-card.in-panel #login-default-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    height: auto;
    min-height: 0;
}

.side-panel-footer .dashboard-card.in-panel .card-icon,
.side-panel-footer .dashboard-card.in-panel .card-icon img {
    width: 26px;
    height: 26px;
    margin: 0 auto;
    display: block;
}

.side-panel-footer .dashboard-card.in-panel .card-title {
    font-size: 9px;
    line-height: 1.1;
    margin: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.side-panel-footer .dashboard-card.in-panel .card-description,
.side-panel-footer .dashboard-card.in-panel .connection-status,
.side-panel-footer .dashboard-card.in-panel #login-expanded-view {
    display: none !important;
}

/* Aktive Kachel (Card ist aufgeklappt) - Klick = zuklappen */
.side-panel-tile-placeholder {
    box-sizing: border-box;
    flex: 1 1 0;
    min-width: 60px;
    height: 76px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: background 0.2s ease;
}

.side-panel-tile-placeholder:hover {
    background: rgba(255, 255, 255, 0.18);
}

.side-panel-tile-placeholder img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
}

.side-panel-tile-placeholder span {
    font-size: 9px;
    line-height: 1.1;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color, #e0e0e0);
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
    .side-panel {
        width: 85vw;
    }

    .side-panel-tab {
        left: -36px;
        width: 36px;
        padding: 20px 0;
    }

    body.side-panel-open .side-panel-tab {
        width: 46px;
        left: -46px;
    }

    .side-panel-ghost {
        width: 36px;
        padding: 20px 0;
    }
}

/* Aufgeklappte Card integriert sich rahmenlos ins Panel */
.side-panel-detail .dashboard-card.in-panel.expanded {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    min-height: 0 !important;
    display: block !important;
}

.side-panel-detail .dashboard-card.in-panel.expanded::before {
    display: none !important;
}

.side-panel-detail .dashboard-card.in-panel.expanded:hover {
    transform: none;
}

.side-panel-detail .dashboard-card.in-panel.expanded .card-title,
.side-panel-detail .dashboard-card.in-panel.expanded .card-description,
.side-panel-detail .dashboard-card.in-panel.expanded .connection-status {
    display: none !important;
}

/* Login-Formular im Panel: groessere Felder & Buttons */
.side-panel-detail #login-expanded-view input {
    padding: 13px 12px !important;
    font-size: 15px !important;
    margin-bottom: 10px !important;
}

#login-expanded-view .pbtn {
    flex: 1;
    min-height: 48px;
    padding: 14px 8px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    transition: all 0.22s ease;
}

/* Aktiver Button - edler Glas-Verlauf im jeweiligen Farbton */
.pbtn-primary.pbtn-login { --tone: 102, 126, 234; }
.pbtn-primary.pbtn-register { --tone: 81, 207, 102; }
.pbtn-primary.pbtn-reset { --tone: 255, 165, 0; }

#login-expanded-view .pbtn-primary {
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 55%),
        linear-gradient(160deg, rgba(var(--tone), 0.88), rgba(var(--tone), 0.5));
    border-color: rgba(var(--tone), 0.65);
    box-shadow:
        0 6px 18px rgba(var(--tone), 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

#login-expanded-view .pbtn-primary:hover {
    filter: brightness(1.08);
}

/* Inaktive Buttons - transparent/glasig */
#login-expanded-view .pbtn-ghost {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.55);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#login-expanded-view .pbtn-ghost:hover {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
}

#login-expanded-view .pbtn img {
    width: 20px;
    height: 20px;
    opacity: 0.85;
}

#login-expanded-view .pbtn svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Unsichtbares Suchfeld (oeffnet die Tastatur auf Mobilgeraeten) */
.panel-search-input {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    border: 0;
    padding: 0;
    font-size: 16px;
}

/* Statische Kacheln (Seiten ohne dashboard-cards) */
.side-panel-footer .panel-tile {
    box-sizing: border-box;
    flex: 1 1 0;
    min-width: 60px;
    height: 76px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-color, #e0e0e0);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    background-color: rgba(42, 42, 42, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    transition: all 0.25s ease;
}

.side-panel-footer .panel-tile:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.3);
}

.side-panel-footer .panel-tile img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
}

.side-panel-footer .panel-tile span {
    font-size: 9px;
    line-height: 1.1;
    max-width: 100%;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.side-panel-tile-placeholder span {
    margin: 0;
}