/* Studio & Customizer Styles - Eye Friendly Light Theme */
.studio-layout {
    display: grid;
    grid-template-columns: 460px 1fr;
    min-height: calc(100vh - 72px);
    height: calc(100vh - 72px);
    overflow: hidden;
    position: relative;
    z-index: 10;
}

/* Sidebar Editor */
.studio-sidebar {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    position: relative;
    z-index: 20;
    box-shadow: 4px 0 20px rgba(15, 23, 42, 0.03);
}

.studio-sidebar::-webkit-scrollbar {
    width: 6px;
}
.studio-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.sidebar-header {
    padding: 1.5rem 1.8rem;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

.sidebar-header h2 {
    font-size: 1.4rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header p {
    font-size: 0.88rem;
    color: #64748b;
    margin-top: 0.2rem;
}

.sidebar-content {
    padding: 1.5rem 1.8rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: #ffffff;
}

/* Accordion Steps */
.editor-step {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.editor-step.active {
    border-color: #fbcfe8;
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.08);
}

.step-header {
    padding: 1.1rem 1.3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    background: #f8fafc;
    transition: background 0.2s ease;
}

.step-header:hover {
    background: #f1f5f9;
}

.step-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 700;
    font-size: 0.96rem;
    color: #0f172a;
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
}

.step-chevron {
    color: #64748b;
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.editor-step.active .step-chevron {
    transform: rotate(180deg);
}

.step-body {
    padding: 1.3rem;
    border-top: 1px solid #e2e8f0;
    display: none;
    flex-direction: column;
    gap: 1.1rem;
    background: #ffffff;
}

.editor-step.active .step-body {
    display: flex;
}

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    color: #0f172a;
    font-family: inherit;
    font-size: 0.94rem;
    transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #e11d48;
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.15);
}

.form-textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.6;
}

/* Template Selector Radios */
.template-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.7rem;
}

.template-option-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-option-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.template-option-card.selected {
    border-color: #e11d48;
    background: #fff1f2;
    box-shadow: 0 2px 10px rgba(225, 29, 72, 0.1);
}

.template-option-thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
}

.template-option-info h5 {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.15rem;
}

.template-option-info p {
    font-size: 0.78rem;
    color: #64748b;
}

/* Upload dropzone */
.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    background: #f8fafc;
    transition: all 0.25s ease;
    color: #475569;
}

.dropzone:hover {
    border-color: #e11d48;
    background: #fff1f2;
    color: #be123c;
}

.dropzone p {
    font-size: 0.88rem;
    color: #64748b;
    margin-top: 0.4rem;
}

/* Photo Cards List in Editor */
.photo-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.photo-item {
    display: flex;
    gap: 0.8rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 0.6rem;
    align-items: center;
    position: relative;
}

.photo-thumb {
    width: 55px;
    height: 55px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
}

.photo-fields {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.photo-fields input {
    padding: 0.35rem 0.6rem;
    font-size: 0.84rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #0f172a;
}

.photo-fields input:focus {
    outline: none;
    border-color: #e11d48;
}

.photo-remove-btn {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.photo-remove-btn:hover {
    background: #dc2626;
    color: #fff;
}

/* Publish bar */
.sidebar-footer {
    padding: 1.2rem 1.8rem;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

.btn-publish {
    width: 100%;
    padding: 0.85rem;
    font-size: 1.05rem;
    font-weight: 700;
}

/* Right Pane - Live Simulator Area */
.studio-preview-pane {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    background: radial-gradient(circle at center, #fdf4ff 0%, #f1f5f9 100%);
    overflow: hidden;
}

.preview-toolbar {
    position: absolute;
    top: 1.2rem;
    display: flex;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    border: 1px solid #e2e8f0;
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    z-index: 50;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.06);
}

.preview-tool-btn {
    background: transparent;
    border: none;
    color: #64748b;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preview-tool-btn.active, .preview-tool-btn:hover {
    color: #0f172a;
    background: #f1f5f9;
}

/* Smartphone Mockup Frame */
.device-phone {
    width: 380px;
    height: 720px;
    max-height: 86vh;
    background: #ffffff;
    border: 11px solid #1e293b;
    border-radius: 46px;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25), 0 0 30px rgba(225, 29, 72, 0.15);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.35s ease;
}

.device-phone.mode-desktop {
    width: 90%;
    height: 82vh;
    border-radius: 16px;
    border-width: 6px;
}

.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 22px;
    background: #1e293b;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    z-index: 100;
}

.phone-screen {
    width: 100%;
    height: 100%;
    border: none;
    background: #f8fafc;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.phone-screen::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* Modal for Published Link & QR Code */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.2), 0 0 30px rgba(225, 29, 72, 0.15);
    width: 90%;
    max-width: 520px;
    padding: 2.2rem;
    text-align: center;
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    color: #0f172a;
}

@keyframes modalPop {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 1.4rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #0f172a;
}

.qr-wrapper {
    background: #ffffff;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    display: inline-block;
    margin: 1.5rem auto;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.qr-wrapper img {
    width: 180px;
    height: 180px;
    display: block;
}

.link-box {
    display: flex;
    gap: 0.5rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 0.4rem;
    margin: 1.2rem 0;
}

.link-box input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: #0f172a;
    padding: 0.4rem 0.8rem;
    font-size: 0.92rem;
    outline: none;
}

/* =====================================================
   MOBILE APP EXPERIENCE & STYLES
   ===================================================== */

.brand-studio-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 800;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    letter-spacing: 0.08em;
    margin-left: 0.3rem;
}

.tag-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: livePulse 2s infinite ease-in-out;
}

@keyframes livePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.6; }
}

.mobile-apk-header {
    display: none;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-bottom: 1px solid #e2e8f0;
    padding: 0.6rem 1rem 0.65rem;
    position: sticky;
    top: 60px;
    z-index: 85;
}

.apk-segmented-bar {
    display: flex;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 3px;
    gap: 4px;
}

.apk-tab-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 0.8rem;
    border: none;
    background: transparent;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 11px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.apk-tab-pill.active {
    background: linear-gradient(135deg, #e11d48, #db2777);
    color: #fff;
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.35);
    font-weight: 700;
}

.apk-live-beacon {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #059669;
    box-shadow: 0 0 8px #059669;
    animation: livePulse 1.8s infinite;
}

.apk-progress-container {
    margin-top: 0.5rem;
}

.apk-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #64748b;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.apk-progress-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.apk-progress-track {
    height: 100%;
    background: linear-gradient(90deg, #e11d48, #db2777, #d97706);
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* Mobile Bottom Navigation Dock */
.mobile-apk-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid #e2e8f0;
    z-index: 100;
    padding: 0 0.8rem;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.05);
}

.apk-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.35rem 0;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.apk-nav-icon {
    font-size: 1.25rem;
    line-height: 1.2;
    position: relative;
}

.apk-nav-label {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 0.15rem;
}

.apk-nav-item.active {
    color: #e11d48;
}

.apk-nav-item.active .apk-nav-icon {
    transform: scale(1.15);
}

.apk-nav-publish {
    background: linear-gradient(135deg, #e11d48, #db2777) !important;
    color: #fff !important;
    border-radius: 14px !important;
    padding: 0.45rem 0.6rem !important;
    box-shadow: 0 4px 15px rgba(225, 29, 72, 0.35);
    transform: translateY(-3px);
}

.apk-beacon-dot {
    position: absolute;
    top: -2px;
    right: -4px;
    width: 6px;
    height: 6px;
    background: #059669;
    border-radius: 50%;
    box-shadow: 0 0 6px #059669;
}

/* Luxury Studio Header Buttons */
.btn-app-action {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.52rem 1.15rem;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    font-family: 'Outfit', sans-serif;
    font-size: 0.86rem;
    font-weight: 700;
    backdrop-filter: blur(12px);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.btn-app-action:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-app-publish {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.4rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #e11d48 0%, #db2777 50%, #9333ea 100%);
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: none;
    box-shadow: 0 4px 18px rgba(225, 29, 72, 0.35);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.btn-app-publish::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
}

.btn-app-publish:hover::before {
    left: 140%;
}

.btn-app-publish:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(225, 29, 72, 0.55);
}

.mobile-icon-only {
    display: none;
}

/* =====================================================
   RESPONSIVE STUDIO & MOBILE VIEW OVERHAUL (max-width: 900px)
   ===================================================== */
@media (max-width: 900px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-icon-only {
        display: inline-block !important;
    }

    .studio-navbar {
        padding: 0.55rem 0.9rem !important;
        position: sticky;
        top: 0;
        z-index: 95;
    }

    .brand-logo-img {
        height: 38px !important;
        max-width: 190px !important;
    }

    .btn-app-action, .btn-app-publish {
        padding: 0.42rem 0.75rem !important;
        font-size: 0.85rem !important;
        border-radius: 10px !important;
    }

    .mobile-apk-header {
        display: block !important;
    }

    .mobile-apk-bottom-bar {
        display: flex !important;
    }

    .studio-layout {
        display: block !important;
        height: auto !important;
        min-height: calc(100vh - 130px) !important;
        overflow: visible !important;
        padding-bottom: 70px; /* Space for bottom APK dock */
    }

    /* In Editor View: Show Sidebar Form, Hide Preview Pane */
    .studio-layout.view-editor .studio-preview-pane {
        display: none !important;
    }

    .studio-layout.view-editor .studio-sidebar {
        display: flex !important;
        width: 100% !important;
        height: auto !important;
        border-right: none !important;
    }

    /* In Preview View: Hide Sidebar Form, Show Fullscreen App Simulator */
    .studio-layout.view-preview {
        padding-bottom: 64px !important;
        overflow: hidden !important;
        height: calc(100vh - 130px) !important;
    }

    .studio-layout.view-preview .studio-sidebar {
        display: none !important;
    }

    .studio-layout.view-preview .studio-preview-pane {
        display: flex !important;
        width: 100% !important;
        height: calc(100vh - 140px) !important;
        min-height: auto !important;
        max-height: calc(100vh - 140px) !important;
        padding: 0.3rem !important;
        background: #f1f5f9 !important;
        overflow: hidden !important;
    }

    /* Native App Screen Simulator */
    .studio-layout.view-preview .device-phone {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border: 2px solid #cbd5e1 !important;
        border-radius: 20px !important;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15) !important;
    }

    .studio-layout.view-preview .phone-notch {
        display: none !important;
    }

    .studio-layout.view-preview .phone-screen {
        width: 100% !important;
        height: 100% !important;
        border-radius: 18px !important;
    }

    .preview-toolbar {
        top: 0.6rem !important;
        padding: 0.25rem 0.5rem !important;
        border-radius: 20px !important;
        gap: 0.4rem !important;
    }

    .preview-tool-btn {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.76rem !important;
    }

    /* Sidebar Content & Step Enhancements */
    .sidebar-header {
        padding: 1.1rem 1.1rem 0.6rem !important;
    }

    .sidebar-content {
        padding: 0.8rem 1.1rem !important;
        gap: 0.9rem !important;
    }

    .step-header {
        padding: 0.95rem 1.1rem !important;
        border-radius: var(--radius-md) !important;
    }

    .step-body {
        padding: 1.1rem !important;
    }

    /* Form Fields for Mobile - Prevent auto-zoom */
    .form-input, .form-select, .form-textarea {
        font-size: 16px !important;
        padding: 0.7rem 0.9rem !important;
    }

    /* Template Cards: Playful 2-column grid */
    .template-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.65rem !important;
    }

    .template-card {
        padding: 0.65rem !important;
        border-radius: 16px !important;
    }

    .template-thumb {
        height: 75px !important;
        border-radius: 10px !important;
    }

    .template-card-title {
        font-size: 0.82rem !important;
    }

    .template-card-desc {
        font-size: 0.72rem !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .sidebar-footer {
        padding: 0.9rem 1.1rem !important;
    }
}
