/* ==========================================
   ROBUST SPLIT-SCREEN & MOBILE TABS LAYOUT
   ========================================== */

/* 1. Global Reset for this layout */
body.portfolio-body {
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent body scroll, panels will scroll */
    background: #0f0a18;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
}

/* 2. Desktop Layout (Split Screen) */
.split-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

/* Left Panel: Configurator */
.split-left {
    flex: 1;
    max-width: 600px;
    height: 100%;
    overflow-y: auto;
    padding: 2rem 3rem;
    background: rgba(20, 15, 30, 0.6);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Hide scrollbar for a cleaner look in left panel */
.split-left::-webkit-scrollbar {
    width: 6px;
}
.split-left::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Right Panel: Preview */
.split-right {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(30, 20, 40, 0.8) 0%, rgba(10, 5, 15, 1) 100%);
    position: relative;
}

/* Headers & Sections */
.portfolio-header {
    margin-bottom: 1rem;
}
.split-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.split-section h2.section-label {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    color: #FACC15;
    margin: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Themes Grid — 2 columns desktop, 1 column mobile */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    align-content: start;
}

@media (max-width: 600px) {
    .themes-grid {
        grid-template-columns: 1fr;
    }
}

/* Phone Frame Adjustments */
.phone-wrapper {
    width: 380px;
    height: 800px;
    max-height: 90vh;
    position: relative;
    transform: scale(1);
    transition: transform 0.3s ease;
}

/* Mobile Tabs Bar (Hidden on Desktop) */
.mobile-bottom-tabs {
    display: none;
}


/* ==========================================
   MOBILE LAYOUT (Tabs)
   ========================================== */
@media (max-width: 1024px) {
    body.portfolio-body {
        overflow: hidden; /* Still prevent body scroll */
    }

    .split-layout {
        flex-direction: column;
        height: calc(100vh - 65px); /* Leave room for bottom tabs */
    }

    .split-left {
        max-width: 100%;
        padding: 1.5rem 1rem;
        display: none; /* Hidden by default, controlled by tabs */
        border-right: none;
    }

    .split-right {
        display: none; /* Hidden by default */
        padding: 1rem;
    }

    /* Active state for mobile panels */
    .split-left.mobile-active {
        display: block !important;  /* block, not flex, so children (grid) work correctly */
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .split-right.mobile-active {
        display: flex !important;
    }

    /* Phone scaling on small screens */
    .phone-wrapper {
        width: 100%;
        max-width: 360px;
        height: 100%;
        max-height: 100%;
    }

    /* Bottom Navigation Bar */
    .mobile-bottom-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65px;
        background: rgba(15, 10, 20, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 100;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-tab-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        background: transparent;
        border: none;
        color: rgba(255, 255, 255, 0.5);
        font-family: 'Montserrat', sans-serif;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-tab-btn svg {
        transition: transform 0.2s ease;
    }

    .mobile-tab-btn.active {
        color: #FACC15;
    }
    
    .mobile-tab-btn.active svg {
        transform: scale(1.1);
    }
}
/* Phone Frame Styles */
.phone-frame {
    width: 320px;
    height: 650px;
    background: #18181f;
    border-radius: 40px;
    border: 12px solid #2d2d3a;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 25px;
    background: #2d2d3a;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    z-index: 10;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

/* Fix mobile viewport issues for iframe container */
@media (max-width: 1024px) {
    .phone-frame {
        width: 100%;
        max-width: 380px;
        height: 100%;
        max-height: 800px;
        border-width: 8px;
        border-radius: 30px;
    }
    
    .phone-notch {
        height: 20px;
        width: 100px;
    }
}
