/* ============================================================
   RCWeb v-c — Mobile-styled Viewer Control
   Mobile-app styled overrides on top of UIKit.
   (the "c2-" class prefix is a stable internal namespace)
   ============================================================ */

:root {
    --c2-bg-0: #0e0f12;
    --c2-bg-1: #15171c;
    --c2-bg-2: #1c1e25;
    --c2-bg-3: #252832;
    --c2-bg-4: #313542;
    --c2-text: #e9ecf2;
    --c2-text-dim: #9aa1ad;
    --c2-text-muted: #6c7280;
    --c2-accent: #4f8cff;
    --c2-accent-2: #6aa1ff;
    --c2-warn: #ffc857;
    --c2-error: #ff5a6a;
    --c2-success: #3ddc84;
    --c2-border: rgba(255, 255, 255, 0.08);
    --c2-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    --c2-radius: 14px;
    --c2-radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body.c2-body {
    background:
        radial-gradient(1100px 600px at 80% -10%, rgba(79, 140, 255, 0.10), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(106, 161, 255, 0.07), transparent 60%),
        var(--c2-bg-0);
    color: var(--c2-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    /* room for fixed navbar (56), segment row (~64), and status bar (40) */
    padding-bottom: 56px;
}

a {
    color: var(--c2-accent-2);
}

/* ============================================================
   TOP NAVBAR — fixed at top, dark themed
   ============================================================ */
.c2-navbar {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background:
        linear-gradient(180deg, rgba(28, 30, 37, 0.97), rgba(20, 22, 28, 0.97)) !important;
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--c2-border);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
    color: var(--c2-text);
    height: 56px;
    display: flex;
    align-items: center;
}

.c2-navbar .uk-container {
    width: 100%;
    height: 100%;
    padding-left: 6px;
    padding-right: 12px;
    display: flex;
    align-items: center;
}

.c2-navbar .uk-navbar {
    width: 100%;
    height: 56px;
    min-height: 56px;
    align-items: center;
}

/* Make every navbar slot vertically centred against the 56px bar */
.c2-navbar .uk-navbar-left,
.c2-navbar .uk-navbar-right,
.c2-navbar .uk-navbar-center {
    display: flex;
    align-items: center;
    height: 56px;
}

/* UIKit defaults `.uk-navbar-item`, `.uk-navbar-toggle`, and
   `.uk-navbar-nav > li > a` all to `min-height: 80px`, which is taller
   than our 56 px bar and prevents flex centring. Reset the lot. */
.c2-navbar .uk-navbar-item,
.c2-navbar .uk-navbar-toggle,
.c2-navbar .uk-navbar-nav>li>a {
    min-height: 0 !important;
    height: 56px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    align-items: center;
}

/* Some UIKit defaults expect a light navbar — force dark text/icons */
.c2-navbar .uk-navbar-toggle,
.c2-navbar .uk-navbar-nav>li>a,
.c2-navbar [uk-icon] {
    color: var(--c2-text) !important;
}

/* Hamburger toggle: explicit flex box so the icon sits dead-centre.
   UIKit's default `.uk-navbar-toggle` has `min-height: 80px` which would
   make the element taller than our 56 px bar and break centring — we
   reset it explicitly. */
.c2-navbar .uk-navbar-toggle.c2-toggle {
    color: var(--c2-text) !important;
    box-sizing: border-box;
    height: 56px !important;
    min-height: 0 !important;
    width: 48px;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.c2-toggle [uk-navbar-toggle-icon],
.c2-toggle>span,
.c2-toggle svg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin: 0;
    padding: 0;
}

/* The room badge wraps the navbar-item — UIKit's `.uk-navbar-item` has
   `min-height: 80px` (same gotcha as `.uk-navbar-toggle`) which would
   make it overflow the 56 px bar and break vertical centring. Override. */
.c2-navbar .uk-navbar-item.c2-roomline {
    box-sizing: border-box;
    height: 56px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    line-height: 1;
}

.c2-room-icon {
    color: var(--c2-accent);
    background: rgba(79, 140, 255, 0.14);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.c2-room-stack {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.c2-roomLabel {
    font-size: 10px;
    color: var(--c2-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 2px;
}

.c2-roomId {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--c2-text);
}

/* The room badge sits in uk-navbar-center. With no navbar-right content
   the badge should stay visually centred — absolutely position it inside
   the navbar so it ignores the empty right side. */
.c2-navbar .uk-navbar {
    position: relative;
}

.c2-navbar .uk-navbar-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* ============================================================
   OFF-CANVAS SIDE MENU
   ============================================================ */
.c2-offcanvas {
    background: linear-gradient(180deg, var(--c2-bg-2), var(--c2-bg-1)) !important;
    border-right: 1px solid var(--c2-border);
    color: var(--c2-text) !important;
    padding: 22px 18px !important;
}

.c2-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 18px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--c2-border);
}

.c2-brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.c2-brand-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.c2-brand-sub {
    font-size: 11px;
    color: var(--c2-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.c2-menuNav .uk-nav-header {
    color: var(--c2-text-muted) !important;
    font-size: 11px !important;
    letter-spacing: 0.16em;
    margin-top: 14px;
}

.c2-menuNav .uk-nav-divider {
    border-color: var(--c2-border) !important;
}

.c2-menuNav a,
.c2-menuNav li>a {
    color: var(--c2-text) !important;
    border-radius: 10px;
    padding: 10px 12px !important;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    transition: background 180ms;
}

.c2-menuNav a:hover,
.c2-menuNav a:focus {
    background: var(--c2-bg-3);
}

.c2-menuStatus {
    color: var(--c2-text-dim);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ============================================================
   SEGMENT NAV — fixed below the navbar, never scrolls
   ============================================================ */
.c2-segmentWrap {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 90;
    padding: 10px 12px 10px 12px;
    background:
        linear-gradient(180deg, rgba(14, 15, 18, 0.96), rgba(14, 15, 18, 0.92));
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--c2-border);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.c2-segment {
    background: var(--c2-bg-2);
    border: 1px solid var(--c2-border);
    border-radius: 14px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0;
}

.c2-segment::-webkit-scrollbar {
    display: none;
}

.c2-segItem {
    flex: 1 0 auto;
    text-align: center;
    color: var(--c2-text-dim) !important;
    text-decoration: none;
    padding: 9px 10px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    transition: background 180ms, color 180ms, transform 180ms;
    min-width: 64px;
}

.c2-segItem:hover {
    color: var(--c2-text) !important;
}

.c2-segItem.c2-active {
    background: linear-gradient(180deg, var(--c2-accent), #3a73e0);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(79, 140, 255, 0.35);
}

.c2-segItem.c2-active:hover {
    color: #fff !important;
}

.c2-segLabel {
    letter-spacing: 0.04em;
}

/* ============================================================
   MAIN CONTENT — sections / cards
   Top padding clears: navbar (56) + segment-row (~84) + a 14px safety
   buffer so the first card's rounded corners and drop-shadow are visible.
   Bottom padding clears: status-bar (40) + 32px so the FAB and last card
   can breathe.
   ============================================================ */
.c2-main {
    padding: 154px 12px 72px 12px;
    max-width: 720px;
    margin: 0 auto;
}

/* The first card in any section needs a tiny extra top margin to keep
   its top shadow comfortably below the segment row's bottom shadow. */
.c2-section>.c2-card:first-child,
.c2-section>.uk-card:first-child {
    margin-top: 4px;
}

.c2-section {
    display: none;
    animation: c2-fade 220ms ease;
}

.c2-section.c2-active {
    display: block;
}

@keyframes c2-fade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.c2-card {
    background: linear-gradient(180deg, var(--c2-bg-2), var(--c2-bg-1));
    border: 1px solid var(--c2-border);
    border-radius: var(--c2-radius);
    padding: 18px 16px !important;
    margin-bottom: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.30);
}

.c2-cardTitle {
    margin: 0 0 4px 0;
    color: var(--c2-text);
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.c2-cardTitle [uk-icon] {
    color: var(--c2-accent);
}

.c2-cardHint {
    margin: 0 0 14px 0;
    color: var(--c2-text-muted);
    font-size: 12px;
}

.c2-fieldLabel {
    display: block;
    color: var(--c2-text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 6px;
    font-weight: 600;
}

.c2-divider {
    height: 1px;
    background: var(--c2-border);
    margin: 16px 0 12px 0;
}

.c2-warn {
    color: var(--c2-warn);
    font-size: 12px;
    margin: 10px 0 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   INPUTS / BUTTONS / TEXTAREA — UIKit overrides
   ============================================================ */
.c2-inputRow {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.c2-input.uk-input {
    background: var(--c2-bg-3);
    border: 1px solid var(--c2-border);
    border-radius: var(--c2-radius-sm);
    color: var(--c2-text);
    height: 42px;
    padding: 0 12px;
    font-size: 14px;
    transition: border-color 160ms, box-shadow 160ms;
    flex: 1;
    min-width: 0;
}

.c2-input.uk-input:focus {
    border-color: var(--c2-accent);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
    outline: none;
    background: var(--c2-bg-3);
    color: var(--c2-text);
}

.c2-input.uk-input::placeholder {
    color: var(--c2-text-muted);
}

.c2-textarea.uk-textarea {
    background: var(--c2-bg-3);
    border: 1px solid var(--c2-border);
    border-radius: var(--c2-radius-sm);
    color: var(--c2-text);
    padding: 12px;
    font-size: 13px;
    line-height: 1.5;
    width: 100%;
    margin-bottom: 12px;
    resize: vertical;
    min-height: 88px;
}

.c2-textarea.uk-textarea:focus {
    border-color: var(--c2-accent);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
    outline: none;
    background: var(--c2-bg-3);
    color: var(--c2-text);
}

.c2-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, "DejaVu Sans Mono", monospace;
    font-size: 12px !important;
    color: #cdd6e3 !important;
}

.c2-btn.uk-button {
    border-radius: var(--c2-radius-sm);
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.02em;
    padding: 0 16px;
    height: 42px;
    line-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 120ms, box-shadow 180ms, background 180ms;
}

.c2-btn.uk-button-primary {
    background: linear-gradient(180deg, var(--c2-accent), #3a73e0);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(79, 140, 255, 0.30);
}

.c2-btn.uk-button-primary:hover,
.c2-btn.uk-button-primary:focus {
    background: linear-gradient(180deg, #6aa1ff, #4985f0);
    color: #fff;
}

.c2-btn.uk-button-primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(79, 140, 255, 0.30);
}

.c2-btn.uk-button-default {
    background: var(--c2-bg-3);
    border: 1px solid var(--c2-border);
    color: var(--c2-text);
}

.c2-btn.uk-button-default:hover,
.c2-btn.uk-button-default:focus {
    background: var(--c2-bg-4);
    color: var(--c2-text);
    border-color: rgba(255, 255, 255, 0.18);
}

.c2-btnFull {
    width: 100%;
    justify-content: center;
}

.c2-fileHidden {
    display: none !important;
}

.c2-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    color: var(--c2-text-dim);
    font-size: 13px;
    cursor: pointer;
}

.c2-toggle .uk-checkbox {
    background: var(--c2-bg-3);
    border-color: var(--c2-border);
}

.c2-toggle .uk-checkbox:checked {
    background-color: var(--c2-accent);
    border-color: var(--c2-accent);
}

/* ============================================================
   COLORS PAD
   ============================================================ */
.c2-colors {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 4px;
}

.c2-color {
    border: none;
    border-radius: 14px;
    height: 70px;
    cursor: pointer;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: transform 150ms, box-shadow 200ms;
    touch-action: manipulation;
    position: relative;
}

.c2-color:hover {
    box-shadow:
        0 6px 14px rgba(0, 0, 0, 0.45),
        inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.c2-color:active {
    transform: scale(0.95);
}

.c2-color.c2-color-light {
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(0, 0, 0, 0.10);
}

/* ============================================================
   APP LAUNCHPAD
   ============================================================ */
.c2-filter {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    margin: 0 -4px 14px -4px;
    padding: 4px;
    scrollbar-width: none;
}

.c2-filter::-webkit-scrollbar {
    display: none;
}

.c2-pill {
    flex: 0 0 auto;
    text-decoration: none;
    background: var(--c2-bg-3);
    color: var(--c2-text-dim);
    border: 1px solid var(--c2-border);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    transition: background 180ms, color 180ms, border-color 180ms;
}

.c2-pill:hover {
    color: var(--c2-text);
    background: var(--c2-bg-4);
}

.c2-pill.c2-active {
    background: var(--c2-accent);
    color: #fff;
    border-color: var(--c2-accent);
}

.c2-groupTitle {
    font-size: 12px;
    color: var(--c2-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin: 18px 0 10px 0;
    padding: 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.c2-groupTitle [uk-icon] {
    color: var(--c2-accent);
}

.c2-appGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media (min-width: 480px) {
    .c2-appGrid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 640px) {
    .c2-appGrid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.c2-appTile {
    background: var(--c2-bg-3);
    border: 1px solid var(--c2-border);
    border-radius: 14px;
    color: var(--c2-text);
    cursor: pointer;
    padding: 14px 8px 10px 8px;
    text-align: center;
    text-decoration: none;
    transition: transform 150ms, background 180ms, border-color 180ms, box-shadow 200ms;
    touch-action: manipulation;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    aspect-ratio: 1 / 1.05;
    justify-content: center;
}

.c2-appTile img {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    object-fit: contain;
}

.c2-appTile span {
    font-size: 11px;
    font-weight: 600;
    color: var(--c2-text-dim);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.c2-appTile:hover,
.c2-appTile:focus {
    background: var(--c2-bg-4);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
    outline: none;
}

.c2-appTile:hover span,
.c2-appTile:focus span {
    color: var(--c2-text);
}

.c2-appTile:active {
    transform: scale(0.96);
}

/* hide groups when filter active */
.c2-groupTitle.c2-hidden,
.c2-appGrid.c2-hidden {
    display: none;
}

/* ============================================================
   FIXED BOTTOM STATUS BAR — matches navbar look
   ============================================================ */
.c2-statusbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 40px;
    background:
        linear-gradient(0deg, rgba(28, 30, 37, 0.97), rgba(20, 22, 28, 0.97));
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-top: 1px solid var(--c2-border);
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.4);
    color: var(--c2-text-dim);
    font-family: ui-monospace, SFMono-Regular, Menlo, "DejaVu Sans Mono", monospace;
    font-size: 11px;
}

.c2-statusbar-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 12px;
    gap: 12px;
    overflow: hidden;
    margin: 0 auto;
}

.c2-statusItem {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--c2-text-muted);
    transition: color 220ms;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}

.c2-statusItem [uk-icon] {
    flex: 0 0 auto;
    color: inherit;
    opacity: 0.85;
}

.c2-statusItem .c2-statusText {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* server connection — fixed-width allotment so the room status is
   always visible without truncation on common widths */
.c2-statusConnection {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 50%;
}

.c2-statusConnection.c2-online {
    color: var(--c2-success);
}

.c2-statusConnection.c2-offline {
    color: var(--c2-error);
}

/* client count badge — clickable, padded pill */
.c2-clientBadge {
    flex: 0 0 auto;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--c2-border);
    border-radius: 999px;
    color: var(--c2-text-dim);
    transition: background 180ms, color 180ms, border-color 180ms;
}

.c2-clientBadge:hover,
.c2-clientBadge:focus {
    background: rgba(79, 140, 255, 0.14);
    border-color: rgba(79, 140, 255, 0.45);
    color: var(--c2-accent-2);
    outline: none;
}

.c2-clientBadge .c2-statusText {
    font-weight: 700;
    letter-spacing: 0.06em;
}

/* chunk-upload item — flex grows to fill, shows muted by default,
   highlights when actively uploading */
.c2-statusItem-flex {
    flex: 1 1 auto;
    min-width: 0;
}

.c2-statusItem-flex.c2-active {
    color: var(--c2-accent-2);
}

/* error/info status — hidden when empty, slides in when populated */
.c2-statusItem-error {
    color: var(--c2-text-muted);
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
    transition: opacity 220ms, transform 220ms;
    flex: 0 1 auto;
}

.c2-statusItem-error.c2-active {
    opacity: 1;
    transform: translateY(0);
}

/* On very narrow screens the chunk-upload "Idle" label is noisy —
   collapse it to icon-only so the connection text and client badge
   don't fight for space. */
@media (max-width: 380px) {
    .c2-statusItem-flex .c2-statusText {
        display: none;
    }

    .c2-statusItem-flex.c2-active .c2-statusText {
        display: inline;
    }

    .c2-statusbar-inner {
        gap: 10px;
        padding: 0 10px;
    }
}

/* ============================================================
   UIKit theme polish — make icons inherit color
   ============================================================ */
.uk-light,
.c2-body {
    color: var(--c2-text);
}

[uk-icon] {
    color: inherit;
}

/* Make sure uikit checkbox shows correctly on dark */
.uk-checkbox {
    background-color: var(--c2-bg-3);
    border: 1px solid var(--c2-border);
}

/* Small screens */
@media (max-width: 380px) {
    .c2-segLabel {
        display: none;
    }

    .c2-segItem {
        min-width: 56px;
        padding: 8px 6px;
    }

    .c2-roomLabel {
        display: none;
    }
}

/* When labels collapse on tiny screens (≤380px) the segment row shrinks
   from ~84px to ~64px, so the main content needs a smaller top inset. */
@media (max-width: 380px) {
    .c2-main {
        padding-top: 134px;
    }
}