/* === Layout === */
body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f172a, #1e3a8a, #06b6d4);
    /* dark navy → indigo → teal */
    color: #e2e8f0;

}

.app-layout {
    display: grid;
    grid-template-columns: 280px 1fr 380px;
    gap: 20px;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden !important;
    /* ✅ prevents double scrollbars */
}



.right-sidebar {
    min-width: 300px;
    /* ensures full visibility */
    background: linear-gradient(180deg, #0f172a, #1e293b);
    border-right: 2px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    /* ✅ enables vertical scroll */
    scrollbar-width: thin;
    /* For Firefox */
    scrollbar-color: #38bdf8 rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;

}

.right-sidebar h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 16px;
    color: #38bdf8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.color-picker,
.image-picker,
.sticker-picker {
    margin-bottom: 20px;
    /* ✅ spacing between groups */
}

/* === Sidebar === */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1e293b, #0f172a);
    /* dark layered */
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.4);
}

.left-sidebar,
.right-sidebar {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #38bdf8 rgba(255, 255, 255, 0.1);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    color: #38bdf8;
    /* cyan */
    margin: 20px 0 10px;
}

/* === Toolbar Buttons === */
.toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toolbar button,
.color-button-label {
    background: linear-gradient(135deg, #06b6d4, #6366f1);
    /* teal → indigo */
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

.toolbar button:hover,
.color-button-label:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.6);
}

/* === Font Controls === */
.font-controls {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.font-controls label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: #cbd5e1;
}

.font-controls select,
.font-controls input[type="color"] {
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #06b6d4;
    background: #111827;
    color: #f3f4f6;
}




/* Fullscreen button */
.fullscreen-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(6, 182, 212, 0.3);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.25s ease;
}

.fullscreen-btn:hover {
    background: rgba(99, 102, 241, 0.4);
}

/* === Background Pickers === */
.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.25s;
}

.color-btn:nth-child(1) {
    background: #06b6d4;
}

/* teal */
.color-btn:nth-child(2) {
    background: #38bdf8;
}

/* light cyan */
.color-btn:nth-child(3) {
    background: #6366f1;
}

/* indigo */
.color-btn:nth-child(4) {
    background: #3b82f6;
}

/* blue */
.color-btn:nth-child(5) {
    background: #9333ea;
}

/* violet */
.color-btn:nth-child(6) {
    background: #1e3a8a;
}

/* navy */

.color-btn:hover {
    transform: scale(1.15);
    border-color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

.image-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.image-picker img {
    width: 100%;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.25s ease;
}

.image-picker img:hover {
    transform: scale(1.05);
    border-color: #06b6d4;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.sticker {
    position: absolute;
    width: 120px;
    top: 50%;
    left: 50%;
    cursor: move;
    user-select: none;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.sticker img {
    width: 100%;
    height: auto;
    pointer-events: none;
    border-radius: 6px;
}

/* Hide controls by default */
.resize-handle,
.delete-sticker {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Show only when hovered */
.sticker:hover .resize-handle,
.sticker:hover .delete-sticker {
    opacity: 1;
    pointer-events: auto;
}

/* Glow when hovered */
.sticker:hover {
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.8);
    z-index: 10;
}

.resize-handle {
    width: 14px;
    height: 14px;
    background: #06b6d4;
    border-radius: 50%;
    position: absolute;
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
    border: 2px solid white;
}

.delete-sticker {
    position: absolute;
    top: -10px;
    right: -10px;
    background: red;
    border: none;
    color: white;
    font-size: 12px;
    border-radius: 50%;
    cursor: pointer;
    width: 22px;
    height: 22px;
    line-height: 18px;
    text-align: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.sticker-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.sticker-picker img {
    width: 100%;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.25s ease;
}

.sticker-picker img:hover {
    transform: scale(1.05);
    border-color: #06b6d4;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.sticker {
    position: absolute;
    top: 50px;
    left: 50px;
    width: 120px;
    cursor: move;
    user-select: none;
}

.sticker img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    /* allows dragging over image */
}

.resize-handle {
    width: 14px;
    height: 14px;
    background: #06b6d4;
    border-radius: 50%;
    position: absolute;
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

.hashtag-sticker {
    position: absolute;
    width: 300px;
    height: auto;
    cursor: move;
    user-select: none;
}

.followx-sticker {
    position: absolute;
    width: 300px;
    /* adjust as needed */
    height: auto;
    cursor: move;
    user-select: none;
}

.frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* so user can still drag stickers/text inside */
    border-radius: 16px;
    /* match container’s rounded edges */
}



/* Eraser Sub-panel */
.eraser-panel {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-left: 12px;
    /* indent inside sidebar */
}

.eraser-panel button {
    background: #5a2aa5;
    font-size: 13px;
    padding: 8px 10px;
}

.eraser-panel button:hover {
    background: #783cd0;
}

.left-sidebar,
.right-sidebar {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 10px;
    /* same for both */
}

/* Ensure proper grid sizing and no clipping */


/* Fix left sidebar cut-off issue */
.left-sidebar {
    min-width: 300px;
    /* ensures full visibility */
    background: linear-gradient(180deg, #0f172a, #1e293b);
    border-right: 2px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Make toolbar buttons fully visible */
.toolbar button {
    width: 100%;
    text-align: left;
    box-sizing: border-box;
}

/* Optional: visual boundary between left sidebar and workspace */
.workspace {
    border-left: 2px solid rgba(255, 255, 255, 0.08);
    border-right: 2px solid rgba(255, 255, 255, 0.08);
}

/* === Fullscreen Toolbar Styling === */
.fullscreen-toolbar {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 50;
}

.fullscreen-toolbar button {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    border: none;
    color: white;
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
    transition: all 0.25s ease;
}

.fullscreen-toolbar button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.6);
}

/* When fullscreen is active */
:fullscreen .fullscreen-toolbar {
    top: 25px;
    right: 25px;
    gap: 12px;
}

:fullscreen .fullscreen-toolbar button {
    font-size: 16px;
    padding: 12px 18px;
}

/* Ensure the fullscreen icon always stays visible */
.fullscreen-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(6, 182, 212, 0.3);
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    z-index: 50;
    transition: background 0.25s ease;
}

.fullscreen-btn:hover {
    background: rgba(99, 102, 241, 0.4);
}

/*Responsive */
/* === Default Desktop Layout === */

.app-layout {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    grid-template-areas: "left workspace right";
    gap: 1px;
    height: 100vh;
    /* ✅ allows full height expansion */
    overflow: visible;
    /* ✅ shows workspace properly */
}

.left-sidebar,
.right-sidebar {
    width: 260px;
    padding: 20px;
    background: #111a2e;
    border-right: 2px solid #1e2a45;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: all 0.3s ease-in-out;
    z-index: 10;

    /* 👇 New scroll styling */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #38bdf8 rgba(255, 255, 255, 0.1);
}

/* Right sidebar borders */
.right-sidebar {
    border-left: 2px solid #1e2a45;
    border-right: none;
}



/* Assign areas */
.left-sidebar {
    grid-area: left;
}

.workspace {
    grid-area: workspace;
}

.right-sidebar {
    grid-area: right;
}

/* ================= WORKSPACE ================= */

.workspace {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Main container */
.character-container {
    width: 900px;
    /* Fixed design size */
    height: 600px;
    /* Fixed design size */
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border-radius: 16px;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
    position: relative;
    overflow: hidden;

    transition: transform 0.4s ease;
    transform-origin: center center;
}

/* Model always fills container */
.hero-model,
model-viewer {
    width: 100%;
    height: 100%;
}

/* FULLSCREEN = ONLY SCALE */

.character-container:fullscreen {
    width: 900px;
    height: 600px;

    transform: scale(1.6);
    /* Zoom amount */
}





/* === Mobile Header === */
.mobile-header {
    display: none;
    /* hidden on desktop */
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: #fff;
    text-align: center;
    font-weight: 800;
    font-size: 20px;
    padding: 14px 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    width: 100%;
    z-index: 999;
}



/* === Fix Panels Placement === */
.font-controls {
    display: none;
    /* hidden by default */
    margin-top: 10px;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 12px;
}
/* ===== Sidebar Section Cards ===== */
.sidebar-section {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 14px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    backdrop-filter: blur(6px);
    transition: 0.3s ease;
}

.sidebar-section:hover {
    border-color: #38bdf8;
    box-shadow: 0 0 15px rgba(56,189,248,0.3);
}

.sidebar-section h3 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: #38bdf8;
    text-transform: uppercase;
}
.mobile-bottom-bar,
.mobile-panel {
    display: none;
}
/* ========================= */
/* ================= MOBILE OPTIMIZED ================= */
@media (max-width: 768px) {

    body, html {
        height: 100%;
        overflow-x: hidden;
    }

    .mobile-header {
        display: block;
        font-size: 16px;
        padding: 12px;
    }

    /* Hide desktop sidebars */
    .left-sidebar,
    .right-sidebar {
        display: none !important;
    }

    .app-layout {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .workspace {
        flex: 1;
        padding: 12px;
        padding-bottom: 90px; /* space for bottom bar */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .character-container {
        width: 100%;
        height: 75vh;
        border-radius: 20px;
    }

    /* Model fits perfectly */
    .hero-model,
    model-viewer {
        width: 100%;
        height: 100%;
    }

    /* Bottom Toolbar */
    .mobile-bottom-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        display: flex;
        justify-content: space-around;
        align-items: center;
        background: #111a2e;
        padding: 12px 0;
        z-index: 9999;
        border-top: 1px solid #1e2a45;
    }

    .mobile-bottom-bar button {
        background: linear-gradient(135deg,#06b6d4,#3b82f6);
        border: none;
        color: white;
        font-size: 18px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Sliding Panels */
    .mobile-panel {
        position: fixed;
        bottom: -100%;
        left: 0;
        width: 100%;
        background: #0f172a;
        padding: 20px;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
        border-radius: 20px 20px 0 0;
        transition: bottom 0.35s ease;
        z-index: 9998;
        max-height: 60vh;
        overflow-y: auto;
    }

    .mobile-panel.active {
        bottom: 70px;
    }

    .mobile-panel button {
        background: #1e293b;
        border: 1px solid #38bdf8;
        color: white;
        padding: 10px 14px;
        border-radius: 12px;
        font-size: 14px;
    }
}

