/* ===================================
   Mobile App Layout Styles
   =================================== */

/* Hide mobile components on Desktop */
.bottom-nav,
.mobile-header {
    display: none;
}

/* App Shell Mobile */
@media screen and (max-width: 768px) {

    /* Hide Desktop Navbar */
    .navbar {
        display: none !important;
    }

    /* Mobile-only Header */
    .mobile-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 70px;
        background: rgba(10, 10, 12, 0.95);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        z-index: 2000;
        align-items: center;
        justify-content: center;
        padding: 0 20px;
    }

    body.mobile-app {
        padding-top: 70px;
        /* Space for mobile header */
        padding-bottom: 70px;
        /* Space for bottom nav */
        background: #0a0a0c;
        overflow-x: hidden;
        min-height: 100vh;
    }

    /* Full-screen App Mode */
    body.studio-active .mobile-header,
    body.studio-active .bottom-nav {
        display: none !important;
    }

    body.mobile-app.studio-active {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        overflow: hidden !important;
    }

    /* Bottom Navigation Bar */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        background: rgba(10, 10, 12, 0.98);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        z-index: 2000;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .bottom-nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        color: #555;
        text-decoration: none;
        font-size: 0.65rem;
        font-weight: 500;
        transition: all 0.2s ease;
        padding: 8px 16px;
        position: relative;
    }

    .bottom-nav-link svg {
        width: 22px;
        height: 22px;
    }

    .bottom-nav-link.active {
        color: var(--primary);
    }

    .bottom-nav-link.active svg {
        stroke: var(--primary);
    }

    /* Profile tab when logged in */
    .bottom-nav-link.logged-in {
        color: #4ade80;
    }

    .bottom-nav-link.logged-in svg {
        stroke: #4ade80;
    }

    /* ===================================
       Hero Section Mobile
       =================================== */
    .hero {
        padding: 30px 0 40px;
        min-height: auto;
    }

    .hero .container {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }

    .hero-title {
        font-size: 1.8rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        margin: 0 auto;
        max-width: 90%;
    }

    .hero-content {
        padding: 0 10px;
        align-items: center;
    }

    .hero-stats {
        justify-content: center;
    }

    .comparison-container {
        flex-direction: column;
        gap: 15px;
    }

    .comparison-arrow {
        transform: rotate(90deg);
    }

    .image-frame {
        width: 150px;
        height: 150px;
    }

    .phone-frame {
        width: 220px;
        height: 450px;
        margin: 0 auto;
        transform: none;
    }

    /* ===================================
       Editor Section - FULL SCREEN STUDIO
       =================================== */
    .editor-section {
        padding: 0 !important;
        height: 100vh;
        width: 100vw;
        position: fixed;
        top: 0;
        left: 0;
        background: #0a0a0c;
        z-index: 3000;
    }

    .design-studio {
        display: flex;
        flex-direction: column;
        height: 100vh;
        width: 100%;
        border-radius: 0;
        border: none;
        background: #0a0a0c;
    }

    /* Toolbar - Top Bar of the App */
    .studio-toolbar {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        height: 80px;
        /* Slightly taller for tools */
        min-height: 80px;
        padding: 0 10px;
        background: #111114;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 3100;
        position: fixed;
        top: 0;
        left: 0;
    }

    .btn-studio-exit,
    .btn-studio-reset {
        display: flex !important;
        /* Force visible on mobile */
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #fff;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        padding: 0;
        flex-shrink: 0;
    }

    .btn-studio-reset {
        margin-left: 6px;
    }

    .toolbar-title {
        display: none !important;
    }

    .toolbar-items {
        display: flex !important;
        flex-direction: row !important;
        gap: 8px;
        flex: 1;
        justify-content: center;
        padding: 0 2px;
    }

    .toolbar-items .tool-item {
        padding: 6px 8px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        min-width: 40px;
    }

    .toolbar-items .tool-item span {
        display: none !important;
        /* Icons only in top bar */
    }

    .toolbar-items .tool-icon svg {
        width: 20px;
        height: 20px;
    }

    .btn-generate-desktop {
        display: none !important;
    }

    /* Fixed Generate Button in Toolbar for Mobile */
    .studio-toolbar .btn-generate {
        display: flex !important;
        position: relative !important;
        /* Override desktop fixed */
        bottom: auto !important;
        right: auto !important;
        width: auto !important;
        min-width: 60px;
        /* Ensure minimum width */
        height: 36px !important;
        padding: 0 10px !important;
        background: var(--primary) !important;
        border: none !important;
        color: #fff !important;
        font-weight: 700;
        font-size: 0.8rem;
        border-radius: 20px !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        box-shadow: 0 4px 10px rgba(255, 107, 0, 0.3);
        overflow: hidden !important;
    }

    .btn-generate::after {
        display: none !important;
        /* Hide "GERAR" content on mobile */
    }

    .btn-generate .btn-label {
        display: inline !important;
        margin-left: 4px;
        font-weight: 800;
    }

    .studio-toolbar .btn-generate .btn-icon {
        width: 16px;
        height: 16px;
        margin-right: 4px;
    }

    .studio-toolbar .btn-generate span:not(.token-badge) {
        display: inline !important;
    }

    .studio-toolbar .btn-download-ghost {
        display: none !important;
    }

    /* Fixed Generate Button in Toolbar for Mobile */
    .studio-toolbar .btn-generate {
        display: flex !important;
        width: auto !important;
        height: 38px !important;
        padding: 0 10px !important;
        font-size: 0.8rem;
        border-radius: 20px;
        margin-left: 5px;
        /* Reduced margin */
    }

    .studio-toolbar .btn-generate .btn-icon {
        width: 18px;
        height: 18px;
        margin-right: 5px;
    }

    .studio-toolbar .btn-generate span:not(.token-badge) {
        display: inline !important;
    }

    .studio-toolbar .btn-generate .token-badge {
        position: static;
        margin-left: 5px;
        font-size: 0.65rem;
    }

    .studio-toolbar .btn-download-ghost {
        display: none !important;
    }

    .tool-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px 12px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .tool-item:active {
        background: rgba(255, 255, 255, 0.1);
        transform: scale(0.95);
    }

    .tool-icon {
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .tool-icon svg {
        width: 20px;
        height: 20px;
    }

    .tool-item span {
        font-size: 0.6rem;
        color: #888;
    }

    /* Tool Items Logic */
    .action-divider {
        display: none !important;
    }

    .toolbar-items .tool-item span {
        display: none;
        /* Hide labels for more space */
    }

    /* Workspace - App Canvas (Mesa) */
    .studio-workspace {
        position: fixed !important;
        top: 80px !important;
        /* Exact height of top studio-toolbar */
        bottom: 90px !important;
        /* Exact height of bottom mobile-app-dashboard */
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        height: auto !important;
        /* Controlled by top/bottom */
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: #0a0a0c !important;
        z-index: 50;
        overflow: hidden;
        touch-action: none;
        padding: 0;
        margin: 0 !important;
    }

    /* Fixed Bottom Dashboard for App Feel */
    .mobile-app-dashboard {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #111114;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 12px 15px;
        z-index: 3100;
        display: flex;
        flex-direction: column;
        gap: 10px;
        height: 90px;
        box-sizing: border-box;
    }


    /* Canvas Container - NO white background on mobile */
    .canvas-container,
    #dropZone {
        width: 100% !important;
        height: 100% !important;
        background: transparent !important;
        box-shadow: none !important;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        /* Fina borda cinza clara */
        box-sizing: border-box;
    }

    /* Canvas itself - only background if specifically needed, usually handled by draw */
    #previewCanvas {
        max-width: 95%;
        max-height: 95%;
        background: #666666 !important;
        /* Keep it transparent when empty */
        border-radius: 8px;
    }

    /* Empty State - Clean text on dark background */
    .empty-state {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        padding: 10px 15px;
        /* Reduced side padding */
        text-align: center;
        width: 100%;
        max-width: 340px;
        /* Increased max-width */
        z-index: 10;
        pointer-events: auto;
        background: transparent !important;
        /* Force transparent */
        box-shadow: none !important;
        border: none !important;
    }

    .empty-state h3 {
        font-size: 1.25rem;
        color: #fff;
        margin-bottom: 15px;
        font-weight: 600;
        text-align: center;
    }

    .pulse-icon {
        width: 64px;
        height: 64px;
        margin: 0 auto 15px;
        background: transparent !important;
        display: flex;
        align-items: center;
        justify-content: center;
        animation: pulse 2s ease-in-out infinite;
    }

    .pulse-icon svg {
        width: 32px;
        height: 32px;
    }

    .creation-guide {
        margin-top: 25px;
        width: 100%;
        display: flex;
        justify-content: flex-start;
    }

    .creation-guide ul {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
        /* Reduced vertical gap */
        width: 100%;
        text-align: left;
    }

    .creation-guide li {
        display: grid;
        grid-template-columns: 22px 1fr;
        /* Narrower number column */
        align-items: center;
        /* Better vertical alignment for single line */
        gap: 10px;
        /* Reduced gap */
        font-size: 0.82rem;
        /* Reduced font-size */
        color: #ffffff;
        line-height: 1.2;
        text-align: left !important;
        margin-bottom: 8px;
        /* Reduced vertical margin */
        touch-action: auto;
        /* Allow interaction */
    }

    .creation-guide li div {
        text-align: left !important;
        display: block;
        word-break: break-word;
        /* Prevent overflow */
    }

    .creation-guide li div strong,
    .creation-guide li div span {
        display: inline !important;
        /* Force inline within the text block */
        margin: 0 2px;
        /* Small horizontal breathing room for bold words */
    }

    .creation-guide li span:first-child {
        width: 22px;
        height: 22px;
        min-width: 22px;
        background: transparent;
        border: 1px solid rgba(0, 0, 0, 0.2);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 0.7rem;
        color: #333 !important;
        flex-shrink: 0;
        margin-top: 0;
    }

    .creation-guide li strong {
        color: #fff;
        font-weight: 700;
        display: inline !important;
    }

    /* Dashboard Row - Formats */
    .mobile-format-row {
        width: 100%;
        margin-bottom: 5px;
    }

    .mobile-format-row .format-buttons {
        display: flex;
        gap: 8px;
        justify-content: center;
    }

    .mobile-format-row .format-btn {
        flex: 1;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        padding: 8px 5px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        color: #888;
        font-size: 0.65rem;
    }

    .mobile-format-row .format-btn.active {
        background: rgba(255, 107, 0, 0.1);
        border-color: var(--primary);
        color: var(--primary);
    }

    .mobile-format-row .format-btn svg {
        width: 18px;
        height: 18px;
    }

    .mobile-dashboard-divider {
        width: 1px;
        height: 25px;
        background: rgba(255, 255, 255, 0.1);
        margin: auto 8px;
    }

    .btn-download-mobile {
        background: rgba(255, 107, 0, 0.1);
        border: 1px solid var(--primary);
        color: var(--primary);
        border-radius: 12px;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        padding: 0;
    }

    .btn-download-mobile:disabled {
        opacity: 0.3;
        border-color: rgba(255, 255, 255, 0.1);
        color: #666;
    }

    /* Properties Panel Logic - Hidden in Favor of Dashboard Tools */
    .studio-properties {
        display: none !important;
    }

    .properties-header,
    .properties-content,
    .no-selection {
        display: none !important;
    }

    /* Generate and Download are now in Top Bar or Dashboard */
    .btn-generate:not(.studio-toolbar .btn-generate) {
        display: none !important;
    }

    .btn-download-ghost {
        display: none !important;
    }

    /* ===================================
       Pricing Section Mobile
       =================================== */
    .pricing-section {
        padding: 30px 0 50px;
    }

    .pricing-section .section-header {
        display: block;
        margin-bottom: 20px;
    }

    .section-title-large {
        font-size: 1.5rem;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 15px;
    }

    .pricing-card {
        padding: 20px;
    }

    /* ===================================
       AI Processing Overlay
       =================================== */
    .ai-processing-overlay {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100dvh;
        /* Use dynamic viewport height */
        background: rgba(0, 0, 0, 0.9) !important;
        z-index: 5000 !important;
        /* Reset flex alignment to allow absolute child positioning */
        display: block;
    }

    .processing-card {
        width: 85% !important;
        max-width: 320px;
        position: absolute !important;
        top: 40% !important;
        /* Visually higher than center */
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        margin: 0 !important;
    }

    /* ===================================
       Footer Mobile
       =================================== */
    .footer {
        padding: 30px 15px 100px;
    }

    .footer-content {
        display: none !important;
    }

    .footer-links {
        flex-direction: column;
        gap: 20px;
    }

    .footer-bottom {
        padding-top: 0;
        border-top: none;
    }
}

/* Animations */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Mobile Text Toolbar Styles */
.mobile-text-tools {
    position: fixed;
    bottom: 100px;
    /* Above dashboard */
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 400px;
    background: rgba(20, 20, 25, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 10px 15px;
    z-index: 3100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 20px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.text-tools-scroll {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 5px;
    /* Scrollbar space */
    scrollbar-width: none;
    /* Firefox */
}

.text-tools-scroll::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* Tool Items */
.tool-group-mobile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: max-content;
}

.tool-group-mobile span {
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.tool-group-mobile.wide {
    flex: 1;
    min-width: 100px;
    padding: 0 5px;
}

/* Controls */
.mobile-select {
    background: #1a1a1c;
    /* Solid dark background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.85rem;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
}

.mobile-select option {
    background: #1a1a1c;
    color: #fff;
}

.mobile-color-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.mobile-color-wrapper input[type="color"] {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

#mobileSizeInput {
    width: 100%;
    accent-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
}

.tool-btn-mobile {
    background: transparent;
    border: none;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 5px;
    min-width: 44px;
}

.tool-btn-mobile svg {
    width: 20px;
    height: 20px;
}

.tool-btn-mobile span {
    font-size: 0.6rem;
    color: #888;
}

.tool-btn-mobile.danger {
    color: #ef4444;
    margin-left: auto;
    /* Push to end */
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 12px;
}

/* Mobile Side Menu Styles */
.mobile-side-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4000;
    visibility: hidden;
    pointer-events: none;
}

.mobile-side-menu.active {
    visibility: visible;
    pointer-events: auto;
}

.mobile-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-side-menu.active .mobile-menu-overlay {
    opacity: 1;
}

.mobile-menu-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background: #111114;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    display: flex;
    flex-direction: column;
}

.mobile-side-menu.active .mobile-menu-content {
    transform: translateX(0);
}

/* Desktop Floating Tools Override */
.desktop-floating-tools {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 400px;
    background: #1a1a1c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    padding: 10px 20px;
    z-index: 5000;
}

.desktop-floating-tools .text-tools-scroll {
    overflow-x: visible;
    justify-content: center;
    gap: 20px;
}

.mobile-menu-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.close-menu-btn {
    background: transparent;
    border: none;
    color: #888;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-links {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.menu-section h4 {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.menu-link {
    display: block;
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    padding: 8px 0;
    transition: color 0.2s;
}

.menu-link:hover {
    color: var(--primary);
}

.mobile-menu-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    text-align: center;
}

/* Header specific styles to accommodate the button */
.mobile-header {
    justify-content: space-between !important;
}

.mobile-menu-btn {
    background: transparent;
    border: none;
    color: #fff;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
}

/* ===================================
   Studio Arrow Indicator
   =================================== */
.studio-arrow-indicator {
    display: none;
}

@media screen and (max-width: 768px) {
    .studio-arrow-indicator {
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-bottom: 8px;
        z-index: 2100;
        display: flex;
        flex-direction: column;
        align-items: center;
        animation: arrowBounce 1s ease-in-out infinite;
        pointer-events: none;
    }

    .studio-arrow-indicator.hidden {
        display: none !important;
    }

    .arrow-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        background: linear-gradient(135deg, #FFD700, #FFA500);
        padding: 8px 16px 6px;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5), 0 0 30px rgba(255, 165, 0, 0.3);
    }

    .arrow-text {
        font-size: 0.75rem;
        font-weight: 800;
        color: #000;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        white-space: nowrap;
        margin-bottom: 2px;
    }

    .arrow-svg {
        width: 20px;
        height: 20px;
        color: #000;
    }

    @keyframes arrowBounce {

        0%,
        100% {
            transform: translateX(-50%) translateY(0);
        }

        50% {
            transform: translateX(-50%) translateY(8px);
        }
    }

    /* Glow pulse effect */
    .arrow-content::before {
        content: '';
        position: absolute;
        top: -2px;
        left: -2px;
        right: -2px;
        bottom: -2px;
        background: linear-gradient(135deg, #FFD700, #FFA500);
        border-radius: 14px;
        z-index: -1;
        animation: glowPulse 2s ease-in-out infinite;
        opacity: 0.5;
    }

    @keyframes glowPulse {

        0%,
        100% {
            opacity: 0.3;
            transform: scale(1);
        }

        50% {
            opacity: 0.6;
            transform: scale(1.05);
        }
    }
}