/* Top and Bottom Bar Styles */
:root {
    --topbar-height: 72px;
    --viewer-top-spacing: 12px; /* Extra breathing room for content viewers */
}

.rs-topbar {
    background: #181c20;
    color: #fff;
    border-bottom: 2px solid #222;
    min-height: var(--topbar-height);
    max-height: 80px;
    overflow: hidden;
    align-items: center !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}
.rs-bottombar {
    background: #181c20;
    color: #fff;
    border-top: 2px solid #222;
    min-height: 52px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    flex-wrap: nowrap !important;
    overflow: hidden;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

/* Bottom bar sections - prevent stacking */
.rs-bottombar-left {
    min-width: 0; /* Allow flex shrinking */
    flex: 1 1 auto;
}

.rs-bottombar-right {
    flex: 0 0 auto;
    min-width: 0;
}

/* Bottom bar items - consistent styling */
.rs-bottombar-item {
    min-width: 0;
    flex-shrink: 1;
}

/* Truncatable values in bottom bar */
.rs-bottombar-value {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

/* Version prefix styling */
.rs-version-prefix {
    font-weight: normal;
    opacity: 0.8;
}

/* Button text in bottom bar - hide on smaller screens */
.rs-bottombar-btn-text {
    display: inline;
}

.rs-logo {
    height: 52px;
    flex-shrink: 0;
    display: block;
}
.rs-app-title {
    font-size: 1.5rem;
    letter-spacing: 2px;
}
body {
    background: #23272b;
    color: #fff;
}
.btn-dark, .btn-outline-light {
    border-radius: 0.375rem;
    font-weight: 500;
    padding: 0.75rem 1.25rem !important;
    font-size: 1.05rem !important;
}

/* Top bar specific button styling - desktop */
.rs-topbar .btn {
    padding: 0.75rem !important;
    font-size: 1.05rem !important;
    min-height: 48px;
    min-width: 48px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Allow d-none to override inline-flex on topbar buttons */
.rs-topbar .btn.d-none {
    display: none !important;
}

/* Increase button spacing in top bar */
.rs-topbar .d-flex.gap-2 {
    gap: 1.25rem !important;
}

/* Increase icon size in top bar buttons */
.rs-topbar .btn i {
    font-size: 1.35rem;
    line-height: 1;
}

/* Bottom bar button styling */
.rs-bottombar .btn {
    padding: 0.65rem 1rem !important;
    font-size: 1rem !important;
}

/* Hide help button on desktop - show only when labels are hidden */
.rs-topbar .rs-help-btn {
    display: none !important;
}

/* Desktop: explicitly hide help button when screen is large enough for labels */
@media (min-width: 769px) {
    .rs-topbar .rs-help-btn {
        display: none !important;
    }
}

/* Show help button only on screens smaller than 769px where labels are hidden */
@media (min-width: 769px) {
    .rs-help-btn {
        display: none !important;
    }
}

/* Offcanvas drawer styling */
.offcanvas {
    background: #181c20;
    color: #fff;
    max-width: 320px !important;
}
.offcanvas-header {
    border-bottom: 2px solid #222;
}
.offcanvas-body a:hover {
    background: #23272b;
    border-radius: 0.25rem;
    padding: 0.5rem;
    margin: -0.5rem;
}

/* Legacy selectors - keep for backward compatibility */
.rs-bottombar-user {
    max-width: 180px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Device status items with truncation */
[data-status-label] {
    overflow: visible;
    white-space: nowrap;
}

[data-status-value] {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

@media (max-width: 768px) {
    .rs-bottombar-value {
        max-width: 160px;
    }
    [data-status-value] {
        max-width: 160px;
    }
    .rs-bottombar-user {
        max-width: 140px;
        font-size: 0.95em;
    }
    .rs-bottombar span, .rs-bottombar a {
        font-size: 0.95em;
    }
    [data-status-label] {
        max-width: 180px;
    }
    .offcanvas {
        max-width: 280px !important;
    }
    :root {
        --topbar-height: 56px;
        --viewer-top-spacing: 2px; /* Minimal spacing on mobile */
    }
    
    /* Show help button on mobile when labels are hidden */
    .rs-topbar .rs-help-btn {
        display: flex !important;
    }
    .rs-topbar {
        padding: 0.5rem 0.75rem !important;
        min-height: var(--topbar-height) !important;
        max-height: 60px !important;
        height: var(--topbar-height) !important;
    }
    .rs-logo {
        height: 32px;
    }
    /* Hide button text on small screens, show only icons */
    .rs-topbar .btn span.btn-text {
        display: none !important;
    }
    .rs-topbar .btn {
        padding: 0.5rem !important;
        min-width: 40px;
        min-height: 40px;
        flex-shrink: 0;
        line-height: 1 !important;
        height: auto !important;
    }
    .rs-topbar .btn i {
        margin: 0 !important;
        font-size: 1.1rem;
        line-height: 1 !important;
    }
    .rs-topbar .d-flex.gap-2 {
        gap: 1rem !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        align-items: center !important;
    }
    .rs-topbar .d-flex.gap-2::-webkit-scrollbar {
        display: none;
    }
    /* Hide button text in bottom bar on medium screens */
    .rs-bottombar-btn-text {
        display: none;
    }
}

@media (max-width: 576px) {
    .rs-bottombar-value {
        max-width: 130px;
    }
    [data-status-value] {
        max-width: 130px;
    }
    .rs-bottombar-left {
        gap: 0.4rem !important;
    }
    .rs-bottombar-right {
        gap: 0.4rem !important;
    }
    .rs-topbar {
        padding: 0.5rem 0.75rem !important;
        min-height: 56px !important;
        max-height: 60px !important;
        height: 56px !important;
    }
    .rs-logo {
        height: 28px;
    }
    .rs-topbar .btn {
        padding: 0.45rem !important;
        min-width: 38px;
        min-height: 38px;
    }
    .rs-topbar .d-flex.gap-2 {
        gap: 0.85rem !important;
    }
}

@media (max-width: 480px) {
    .rs-bottombar-value {
        max-width: 100px;
    }
    [data-status-value] {
        max-width: 100px;
    }
    .rs-bottombar-user {
        max-width: 100px;
        font-size: 0.9em;
    }
    .rs-bottombar span, .rs-bottombar a {
        font-size: 0.9em;
    }
    [data-status-label] {
        max-width: 140px;
    }
    .offcanvas {
        max-width: 240px !important;
    }
    .rs-topbar {
        padding: 0.4rem 0.5rem !important;
        min-height: 48px !important;
        max-height: 52px !important;
        height: 48px !important;
    }
    .rs-logo {
        height: 28px;
    }
    .rs-topbar .btn {
        padding: 0.4rem !important;
        min-width: 36px;
        min-height: 36px;
    }
    .rs-topbar .d-flex.gap-2 {
        gap: 0.75rem !important;
    }
}

@media (max-width: 420px) {
    .rs-bottombar-value {
        max-width: 80px;
    }
    [data-status-value] {
        max-width: 80px;
    }
    [data-status-label] {
        max-width: 120px;
    }
    .rs-topbar {
        padding: 0.35rem 0.45rem !important;
        min-height: 44px !important;
        max-height: 48px !important;
        height: 44px !important;
    }
    .rs-logo {
        height: 24px;
    }
    .rs-topbar .btn {
        padding: 0.35rem !important;
        min-width: 34px;
        min-height: 34px;
    }
    .rs-topbar .btn i {
        font-size: 1rem;
    }
    .rs-topbar .d-flex.gap-2 {
        gap: 0.65rem !important;
    }
}

@media (max-width: 380px) {
    .rs-bottombar-value {
        max-width: 65px;
    }
    [data-status-value] {
        max-width: 65px;
    }
    [data-status-label] {
        max-width: 100px;
    }
    .rs-topbar {
        padding: 0.3rem 0.4rem !important;
        min-height: 40px !important;
        max-height: 44px !important;
        height: 40px !important;
    }
    .rs-logo {
        height: 22px;
    }
    .rs-topbar .btn {
        padding: 0.32rem !important;
        min-width: 32px;
        min-height: 32px;
    }
    .rs-topbar .btn i {
        font-size: 0.95rem;
    }
    .rs-topbar .d-flex.gap-2 {
        gap: 0.6rem !important;
    }
}

@media (max-width: 360px) {
    .rs-bottombar-value {
        max-width: 55px;
    }
    [data-status-value] {
        max-width: 55px;
    }
    [data-status-label] {
        max-width: 90px;
    }
    .rs-logo {
        height: 20px;
    }
    .rs-topbar .btn {
        padding: 0.3rem !important;
        min-width: 30px;
        min-height: 30px;
    }
    .rs-topbar .btn i {
        font-size: 0.9rem;
    }
    .rs-topbar .d-flex.gap-2 {
        gap: 0.55rem !important;
    }
}

/* ============================================================
   Landscape Mobile — compact bars for short/wide viewports
   Targets phones rotated to landscape (not fullscreen / pre-PWA).
   Keys off height rather than width so it doesn't fire on tablets
   or desktop browsers that happen to be narrow.
   ============================================================ */
@media (max-height: 450px) and (orientation: landscape) {
    :root {
        --topbar-height: 36px;
        --viewer-top-spacing: 0px;
    }

    .rs-topbar {
        min-height: var(--topbar-height) !important;
        max-height: 40px !important;
        height: var(--topbar-height) !important;
        padding: 0.2rem 0.5rem !important;
    }

    .rs-logo {
        height: 20px;
    }

    .rs-app-title {
        font-size: 1rem;
        letter-spacing: 1px;
    }

    /* Hide button labels, keep icons only */
    .rs-topbar .btn span.btn-text {
        display: none !important;
    }

    /* Always show the help/drawer button when labels are hidden */
    .rs-topbar .rs-help-btn {
        display: flex !important;
    }

    .rs-topbar .btn {
        padding: 0.25rem !important;
        min-width: 32px;
        min-height: 32px;
        font-size: 0.9rem !important;
    }

    .rs-topbar .btn i {
        font-size: 1rem;
        line-height: 1;
    }

    .rs-topbar .d-flex.gap-2 {
        gap: 0.5rem !important;
    }

    .rs-bottombar {
        min-height: 36px !important;
        padding: 0.2rem 0.5rem !important;
    }

    /* Hide status labels ("Microphone:", "Internet:", etc.) — keep icons/values */
    [data-status-label] {
        display: none !important;
    }

    .rs-bottombar-value,
    [data-status-value] {
        max-width: 80px;
        font-size: 0.8em;
    }

    .rs-bottombar span,
    .rs-bottombar a {
        font-size: 0.85em;
    }

    .rs-bottombar-btn-text {
        display: none;
    }

    .rs-bottombar .btn {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.85rem !important;
    }
}
