/* ====================================
   AURA AI - RESPONSIVE CSS
   Consolidated tablet & mobile styles
   ==================================== */

/* ====================================
   TABLET (max-width: 1024px)
   iPad, Android tablets, small laptops
   ==================================== */
@media (max-width: 1024px) {

    /* Layout — vertical stack inside scrollable viewport */
    .content-area {
        flex-direction: column !important;
        padding: 16px !important;
        gap: 16px !important;
        overflow-y: scroll !important;
        height: calc(100vh - 60px) !important;
    }

    /* Editing panel: keeps its full content height */
    .editing-panel {
        width: 100% !important;
        flex: none !important;
        min-height: auto !important;
        overflow: visible !important;
        height: auto !important;
    }

    /* Right column: stacks below, sized to content */
    .right-column {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
        height: auto !important;
        align-self: stretch !important;
        overflow: visible !important;
    }

    /* Top-right-bar is fixed, don't let it take space in right-column flow */
    .right-column .top-right-bar {
        position: fixed !important;
    }

    .right-column-body {
        flex-direction: column !important;
        flex: none !important;
        height: auto !important;
        min-height: auto !important;
    }

    .right-column-left {
        flex: none !important;
        height: auto !important;
        min-height: auto !important;
    }

    /* History & Get Inspired: capped at ~4 rows, internal scroll, collapsible */
    .right-column-left .video-list-container,
    .video-list-container {
        flex: none !important;
        height: auto !important;
        max-height: 680px !important;
        overflow-y: auto !important;
    }

    #videoList {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
    }

    .user-content-container {
        height: auto !important;
        max-height: 680px !important;
        overflow-y: auto !important;
    }

    /* Top bar — fixed on tablet, touch-friendly */
    .top-right-bar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 999 !important;
        background: var(--sidebar-bg, #0a0f1a) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        padding: 0 20px !important;
        margin: 0 !important;
        height: 60px !important;
        justify-content: flex-end !important;
        box-sizing: border-box !important;
        gap: 14px !important;
    }

    .top-right-bar .trb-token-item {
        font-size: 15px !important;
        height: 40px !important;
        gap: 7px !important;
    }

    .top-right-bar .trb-token-item svg {
        width: 18px !important;
        height: 18px !important;
    }

    .top-right-bar .trb-btn-pricing {
        font-size: 13px !important;
        padding: 0 18px !important;
        height: 40px !important;
        border-radius: 20px !important;
    }

    .top-right-bar .trb-btn-profile {
        width: 40px !important;
        height: 40px !important;
    }

    .top-right-bar .trb-btn-profile svg {
        width: 20px !important;
        height: 20px !important;
    }

    /* Breadcrumb: visible on tablet */
    .trb-breadcrumb {
        display: flex !important;
    }

    /* Hide Home/AI Video Studio breadcrumb from sidebar (moved to top bar) */
    .sidebar-menu nav[aria-label="breadcrumb"] {
        display: none !important;
    }

    .sidebar-menu .menu-divider:first-of-type {
        display: none !important;
    }

    /* Main container pushes below the fixed bar */
    .main-container {
        padding-top: 60px !important;
    }

    /* Content needs top margin to clear the fixed bar */
    .content-area {
        margin-top: 0 !important;
    }

    /* Spacing between stacked sections */
    .editing-panel > * {
        margin-bottom: 12px;
    }

    /* Main content containers: fixed generous height */
    #mainImageContainer {
        min-height: 400px !important;
        height: 400px !important;
        max-height: 400px !important;
        margin-bottom: 16px;
    }

    .contentImageGenUpl {
        min-height: auto !important;
    }

    /* Upload text: always centered with padding */
    #uploadText,
    .upload-hint {
        text-align: center !important;
        padding: 0 16px !important;
    }

    #mainImageContainer .contentImageGenUpl {
        text-align: center !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Processing queue: compact fixed bottom banner on tablet */
    .right-column-right {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 998 !important;
        flex: none !important;
        background-color: #0a1929 !important;
        background-image:
            linear-gradient(rgba(0, 191, 255, 0.08) 1px, transparent 1px),
            linear-gradient(90deg, rgba(0, 191, 255, 0.08) 1px, transparent 1px) !important;
        background-size: 20px 20px !important;
        border-top: 1px solid rgba(0, 191, 255, 0.15) !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5) !important;
        padding: 8px 16px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
        overflow: hidden !important;
    }

    /* Flatten inner container — no double box */
    .right-column-right #processingVideosContainer {
        background: none !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background-image: none !important;
    }

    /* Hide original h3, show tablet header */
    .right-column-right h3 {
        display: none !important;
    }

    .tablet-processing-header {
        display: flex !important;
        align-items: center;
        gap: 8px;
        margin-bottom: 6px;
        cursor: pointer;
    }

    .tablet-queue-label {
        color: var(--primary-blue);
        font-weight: 600;
        font-size: 14px;
    }

    .tablet-queue-count {
        background: var(--accent-fuchsia);
        color: white;
        font-size: 11px;
        font-weight: 700;
        padding: 1px 8px;
        border-radius: 10px;
    }

    .tablet-processing-toggle {
        background: none;
        border: none;
        color: var(--primary-blue);
        cursor: pointer;
        margin-left: auto;
        padding: 0;
        transition: transform 0.3s ease;
    }

    .tablet-processing-toggle.collapsed {
        transform: rotate(-180deg);
    }

    /* Compact items: row layout */
    .right-column-right .processing-videos-list {
        flex-direction: column !important;
        gap: 6px !important;
    }

    .right-column-right .processing-video-item {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 6px !important;
        border-radius: 8px !important;
        background: rgba(0, 0, 0, 0.35) !important;
    }

    .right-column-right .processing-video-thumbnail {
        flex: 0 0 50px !important;
        width: 50px !important;
        height: 36px !important;
        border-radius: 6px !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .right-column-right .processing-video-thumbnail > div {
        width: 100% !important;
        height: 100% !important;
    }

    .right-column-right .processing-video-thumbnail img {
        width: 50px !important;
        height: 36px !important;
        object-fit: cover !important;
    }

    /* Overlay: reposition as flex sibling, not absolute over thumbnail */
    .right-column-right .processing-overlay {
        position: static !important;
        background: none !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: stretch !important;
        gap: 3px !important;
        padding: 0 !important;
    }

    .right-column-right .processing-overlay .processing-status {
        color: #aaa !important;
        font-size: 11px !important;
        order: -1 !important;
    }

    .right-column-right .processing-overlay .progress-text {
        display: none !important;
    }

    .right-column-right .processing-progress {
        width: 100% !important;
        height: 6px !important;
        margin: 0 !important;
        border-radius: 3px !important;
        overflow: hidden !important;
        background: rgba(255, 255, 255, 0.1) !important;
    }

    .right-column-right .processing-progress .progress-fill,
    .right-column-right .processing-progress .progress-bar,
    .right-column-right .processing-progress > div {
        background: var(--accent-fuchsia, #FF1493) !important;
        border-radius: 3px !important;
    }

    .right-column-right .processing-video-info {
        display: none !important;
    }

    /* Collapsed: show only first item */
    .right-column-right:not(.tablet-expanded) .processing-video-item:not(:first-child) {
        display: none !important;
    }

    /* Expanded: show all + scroll */
    .right-column-right.tablet-expanded {
        max-height: 300px !important;
        overflow-y: auto !important;
    }

    .right-column-right.tablet-expanded .processing-video-item:not(:first-child) {
        display: flex !important;
    }
}


/* ====================================
   MOBILE (max-width: 768px)
   Inherits ALL tablet styles above.
   Only adds: sidebar → horizontal bottom bar,
   processing banner above sidebar, smaller sizes.
   ==================================== */
@media (max-width: 768px) {

    /* --- Hide old mobile-only elements --- */
    .top-bar {
        display: none !important;
    }

    .mobile-bottom-nav {
        display: none !important;
    }

    /* --- Sidebar: horizontal fixed bottom bar --- */
    .sidebar {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        height: 72px !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-evenly !important;
        padding: 0 12px calc(env(safe-area-inset-bottom, 0px)) !important;
        z-index: 1000 !important;
        background: var(--sidebar-bg, #0a0f1a) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-right: none !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3) !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }

    .sidebar::-webkit-scrollbar {
        display: none !important;
    }

    /* Flatten wrappers so links flow horizontally */
    .sidebar .sidebar-top,
    .sidebar .sidebar-menu,
    .sidebar .sidebar-scroll-container {
        display: contents !important;
    }

    /* Hide non-link elements */
    .sidebar-menu nav[aria-label="breadcrumb"],
    .sidebar-menu .menu-divider,
    .sidebar .sidebar-bottom,
    .sidebar #profileButton {
        display: none !important;
    }

    /* Hide upload button on mobile */
    .sidebar-menu a.upload-button {
        display: none !important;
    }

    /* Sidebar links: flex to fill space evenly */
    .sidebar-menu a {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 1 0 !important;
        min-width: 0 !important;
        height: 60px !important;
        padding: 6px 4px !important;
        margin: 0 !important;
        margin-bottom: 0 !important;
        border-radius: 10px !important;
        border-left: none !important;
        gap: 2px !important;
        white-space: normal !important;
        overflow: hidden !important;
    }

    .sidebar-menu a span {
        font-size: 9px !important;
        margin-top: 2px !important;
        line-height: 1.15 !important;
        text-align: center !important;
        word-break: break-word !important;
    }

    .sidebar-menu a svg {
        width: 22px !important;
        height: 22px !important;
    }

    .sidebar-menu a.active {
        border-left: none !important;
        padding-left: 4px !important;
    }

    /* NEW badges: hidden on mobile */
    .sidebar-menu a > span[style*="position: absolute"] {
        display: none !important;
    }

    /* --- Breadcrumb: show "Aura AI" instead of Home > Studio --- */
    .trb-breadcrumb span {
        display: none !important;
    }

    .trb-breadcrumb::before {
        content: "Aura AI" !important;
        color: white !important;
        font-weight: 700 !important;
        font-size: 16px !important;
    }

    /* --- Adjust spacing for sidebar bottom bar --- */
    .main-container {
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .content-area {
        height: calc(100vh - 60px - 72px) !important;
    }

    /* --- Processing banner: sits above sidebar --- */
    .right-column-right {
        bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* --- Hide chatbot on mobile --- */
    #aura-chatbot-widget,
    #aura-chat-button,
    #aura-chat-interface {
        display: none !important;
    }
}
