/* ==========================================================================
   MOBILE BOTTOM TOOLBAR - SBS Website
   Inspiriert von Doku-App Toolbar
   ========================================================================== */

/* ==================== TOOLBAR CONTAINER ==================== */

.sbs-mobile-toolbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    background: var(--bg-dark-95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--cyan-15);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transition: transform var(--transition-base),
                height var(--transition-base);
}

/* Scroll-Versteck: Labels ausblenden */
.sbs-mobile-toolbar.is-collapsed .toolbar-item-label {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
}

.sbs-mobile-toolbar.is-collapsed .toolbar-items {
    padding: 0.5rem 0.25rem;
}

/* ==================== TOOLBAR ITEMS CONTAINER ==================== */

.toolbar-items {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0.5rem 0.25rem 0.75rem;
    transition: padding var(--transition-base);
}

/* ==================== EINZELNES TOOLBAR ITEM ==================== */

.toolbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    min-width: 56px;
    cursor: pointer;
    background: transparent;
    border: none;
    color: rgba(148, 163, 184, 0.9);
    text-decoration: none;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.toolbar-item:hover,
.toolbar-item:focus {
    background: var(--cyan-10);
    color: var(--primary-cyan);
    outline: none;
}

.toolbar-item:active {
    transform: scale(0.95);
}

.toolbar-item.is-active {
    color: var(--primary-cyan);
    background: var(--cyan-15);
}

/* ==================== ICON ==================== */

.toolbar-item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-item-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ==================== LABEL ==================== */

.toolbar-item-label {
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    max-height: 20px;
    opacity: 1;
    margin-top: 0.125rem;
    transition: opacity 0.25s ease, max-height 0.25s ease, margin-top 0.25s ease;
}

/* ==================== HAMBURGER ANIMATION ==================== */

.toolbar-hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 24px;
    height: 24px;
}

.toolbar-hamburger-line {
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: var(--radius-full);
    transition: transform var(--transition-base), opacity var(--transition-base);
}

/* Hamburger -> X Animation */
.toolbar-item.hamburger-open .toolbar-hamburger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.toolbar-item.hamburger-open .toolbar-hamburger-line:nth-child(2) {
    opacity: 0;
}

.toolbar-item.hamburger-open .toolbar-hamburger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ==================== HAMBURGER POPUP MENU ==================== */

.toolbar-hamburger-popup {
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    pointer-events: none;
    /* z-index wird unten mit !important gesetzt (10) */
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid var(--cyan-25);
    border-radius: var(--radius-xl);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.4),
                0 0 30px rgba(0, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: var(--space-md);
    min-width: 220px;
    max-width: calc(100vw - 2rem);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toolbar-hamburger-popup.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.toolbar-hamburger-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-sm);
    border-bottom: 1px solid var(--cyan-15);
}

.toolbar-hamburger-popup-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-white);
}

.toolbar-hamburger-popup-close {
    background: transparent;
    border: none;
    color: rgba(148, 163, 184, 0.8);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.toolbar-hamburger-popup-close:hover {
    color: var(--text-white);
}

.toolbar-hamburger-popup-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.toolbar-hamburger-popup-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-light);
    text-decoration: none;
    font-size: var(--font-size-base);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.toolbar-hamburger-popup-link:hover,
.toolbar-hamburger-popup-link:focus {
    background: var(--cyan-10);
    color: var(--primary-cyan);
    outline: none;
}

.toolbar-hamburger-popup-link:active {
    transform: scale(0.98);
}

/* Aktiver Link (aktuelle Seite) */
.toolbar-hamburger-popup-link.is-active {
    background: var(--cyan-15);
    color: var(--primary-cyan);
    position: relative;
}

.toolbar-hamburger-popup-link.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    background: var(--primary-cyan);
    border-radius: 0 3px 3px 0;
}

.toolbar-hamburger-popup-link-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* ==================== SMARTCHECK FAB ==================== */

.smartcheck-fab {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    left: 1.25rem;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--gradient-cyan-purple);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-glow-md);
    z-index: calc(var(--z-fixed) - 1);
    display: none;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-base),
                box-shadow var(--transition-base),
                bottom var(--transition-base),
                opacity var(--transition-base);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.smartcheck-fab:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow-lg);
}

.smartcheck-fab:active {
    transform: scale(1.05);
}

.smartcheck-fab-icon {
    width: 28px;
    height: 28px;
    color: var(--bg-dark);
}

.smartcheck-fab-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

/* Tooltip bei Hover */
.smartcheck-fab::after {
    content: 'SmartCheck';
    position: absolute;
    left: calc(100% + 0.75rem);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-white);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    border: 1px solid var(--cyan-20);
}

.smartcheck-fab:hover::after {
    opacity: 1;
}

/* Bei geoeffnetem Hamburger-Menu nach unten schieben */
.smartcheck-fab.popup-open {
    bottom: calc(320px + env(safe-area-inset-bottom, 0px));
    opacity: 0.7;
}

/* Bei collapsed Toolbar anpassen */
.sbs-mobile-toolbar.is-collapsed ~ .smartcheck-fab {
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}

/* ==================== MOBILE ONLY ==================== */

@media (max-width: 900px) {
    .sbs-mobile-toolbar {
        display: block;
    }

    /* SmartCheck FAB auf Mobile zeigen */
    .smartcheck-fab {
        display: flex;
    }

    /* Floating Scroll Button auf Mobile verstecken - ersetzt durch Sidebar */
    .floating-scroll-button {
        display: none !important;
    }

    /* Body Padding fuer Toolbar */
    body {
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    }
}

/* ==================== LANDSCAPE OPTIMIERUNG ==================== */

@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    .sbs-mobile-toolbar {
        padding: 0.25rem 0;
    }

    .toolbar-items {
        padding: 0.25rem 0;
    }

    .toolbar-item-label {
        display: none;
    }

    body {
        padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
    }

    .smartcheck-fab {
        bottom: calc(56px + env(safe-area-inset-bottom, 0px));
        width: 48px;
        height: 48px;
    }

    .toolbar-hamburger-popup {
        bottom: calc(56px + env(safe-area-inset-bottom, 0px));
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
}

/* ==================== BACKDROP fuer Popup ==================== */
/* Backdrop ist INNERHALB der Toolbar wegen Stacking Context (backdrop-filter) */

.toolbar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1; /* Niedriger als Popup (10) aber über Toolbar-Items */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.toolbar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Toolbar-Items müssen über Backdrop sein */
.toolbar-items {
    position: relative;
    z-index: 2;
}

/* Hamburger Popup muss über Backdrop sein */
.toolbar-hamburger-popup {
    z-index: 10 !important;
}

/* ==================== MOBILE MODALS (Cookie & Feedback) ==================== */

.mobile-modal {
    position: fixed;
    inset: 0;
    z-index: 10100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.mobile-modal-content {
    width: 100%;
    max-width: 400px;
    max-height: calc(100vh - 120px - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(0, 255, 255, 0.25);
    border-radius: 16px;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5),
                0 0 40px rgba(0, 255, 255, 0.1);
    transform: translateY(20px);
    transition: transform 0.25s ease;
}

.mobile-modal.is-open .mobile-modal-content {
    transform: translateY(0);
}

.mobile-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.15);
}

.mobile-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #00ffff;
    margin: 0;
}

.mobile-modal-close {
    background: transparent;
    border: none;
    color: rgba(148, 163, 184, 0.8);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-modal-close:hover,
.mobile-modal-close:focus {
    color: white;
    outline: none;
}

.mobile-modal-body {
    padding: 20px;
}

.mobile-modal-status {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: rgba(0, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
}

.mobile-modal-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 20px;
    line-height: 1.5;
}

.mobile-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.mobile-modal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-modal-btn:active {
    transform: scale(0.98);
}

.mobile-modal-btn svg {
    flex-shrink: 0;
}

.mobile-modal-btn-primary {
    background: linear-gradient(135deg, #00ffff 0%, #00d9ff 100%);
    color: #0a0f1e;
}

.mobile-modal-btn-primary:hover {
    background: linear-gradient(135deg, #00d9ff 0%, #00bfff 100%);
}

.mobile-modal-btn-primary:disabled {
    background: rgba(100, 100, 100, 0.5);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
}

.mobile-modal-btn-secondary {
    background: rgba(0, 255, 255, 0.15);
    color: #00ffff;
    border: 1px solid rgba(0, 255, 255, 0.3);
}

.mobile-modal-btn-secondary:hover {
    background: rgba(0, 255, 255, 0.25);
}

.mobile-modal-btn-tertiary {
    background: rgba(255, 100, 100, 0.15);
    color: rgba(255, 150, 150, 0.9);
    border: 1px solid rgba(255, 100, 100, 0.3);
}

.mobile-modal-btn-tertiary:hover {
    background: rgba(255, 100, 100, 0.25);
}

.mobile-modal-link {
    display: block;
    text-align: center;
    color: rgba(0, 255, 255, 0.7);
    font-size: 13px;
    text-decoration: none;
    padding: 8px;
    transition: color 0.2s ease;
}

.mobile-modal-link:hover {
    color: #00ffff;
}

/* ==================== FEEDBACK MODAL SPECIFIC ==================== */

.mobile-feedback-rating {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.mobile-rating-star {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-rating-star:hover {
    transform: scale(1.15);
}

.mobile-rating-star:active {
    transform: scale(1.05);
}

.mobile-rating-star svg {
    stroke: rgba(148, 163, 184, 0.5);
    fill: transparent;
    stroke-width: 1.5;
    transition: stroke 0.2s ease, fill 0.2s ease;
}

.mobile-rating-star:hover svg,
.mobile-rating-star.is-hovered svg {
    stroke: #fbbf24;
}

.mobile-rating-star.is-active svg {
    stroke: #fbbf24;
    fill: #fbbf24;
}

.mobile-feedback-comment {
    width: 100%;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 16px;
    transition: border-color 0.2s ease;
}

.mobile-feedback-comment::placeholder {
    color: rgba(148, 163, 184, 0.5);
}

.mobile-feedback-comment:focus {
    outline: none;
    border-color: #00ffff;
}

.mobile-feedback-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    text-align: center;
}

.mobile-feedback-success p {
    color: #00ffc8;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}
