/* ================================================================
   layout.css — App shell, topbar, bottombar, tabs
   ================================================================ */

/* ===== App Shell ===== */
.app {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

/* ===== Top Bar ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 1rem;
    padding-right: 1rem;
    background: hsla(0, 0%, 100%, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid hsl(var(--border));
}

.topbar__logo {
    display: flex;
    align-items: center;
    height: 32px;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.topbar__logo:active {
    transform: scale(0.96);
}

.topbar__logo img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.topbar__badge {
    font-size: 0.6rem;
    color: hsl(var(--muted-foreground));
    padding: 0.15rem 0.4rem;
    background: hsl(var(--secondary));
    border-radius: 999px;
    font-weight: 500;
    margin-inline-start: 10px;
}

.topbar__install {
    width: 32px;
    height: 32px;
    border-radius: calc(var(--radius) - 2px);
    background: hsl(var(--secondary));
    border: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--primary));
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.topbar__install svg {
    width: 16px;
    height: 16px;
}

.topbar__install:active {
    background: hsla(217, 91%, 60%, 0.12);
    border-color: hsl(var(--primary));
}

.topbar__clear {
    width: 32px;
    height: 32px;
    border-radius: calc(var(--radius) - 2px);
    background: hsla(0, 0%, 50%, 0.05);
    border: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    margin-inline-end: 8px;
}

.topbar__clear:active {
    background: hsla(0, 0%, 0%, 0.08);
    color: hsl(var(--foreground));
}

.topbar__clear svg {
    width: 16px;
    height: 16px;
}

/* ===== Bottom Bar ===== */
.bottombar {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: calc(var(--bottombar-h) + env(safe-area-inset-bottom, 12px));
    display: flex;
    align-items: stretch;
    background: hsla(0, 0%, 100%, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid hsl(var(--border));
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom, 12px);
    box-sizing: border-box;
    flex-shrink: 0;
}

.bottombar__tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    background: none;
    border: none;
    color: hsl(var(--muted-foreground));
    font-size: 0.6rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.bottombar__tab svg {
    width: 24px;
    height: 24px;
    transition: color 0.15s ease;
}

.bottombar__tab.active {
    color: hsl(var(--primary));
}

.bottombar__tab.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    background: hsl(var(--primary));
    border-radius: 0 0 2px 2px;
}

/* ===== Tab Content Area ===== */
.tab-content {
    flex: 1;
    padding: 0.875rem 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-pane {
    display: none;
    flex-direction: column;
    gap: 0.875rem;
    animation: fadeIn 0.2s ease-out;
}

.tab-pane.active {
    display: flex;
}

/* ===== Responsive ===== */
@media (min-width: 640px) {
    .tab-content {
        padding: 1.25rem 1.5rem;
        padding-bottom: calc(var(--bottombar-h) + 1.5rem);
    }

    .topbar__title {
        font-size: 1.15rem;
    }
}