:root {
    --bg-dark: #050505;
    --card-bg: #111111;
    --card-border: #222222;
    --primary-purple: #8A56AC;
    --primary-purple-hover: #734096;
    --action-green: #00C896;
    --action-green-hover: #00a87e;
    --text-main: #ffffff;
    --text-muted: #888888;
    --font-family: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    /* Prevent body scroll, handle inside containers */
    display: flex;
    flex-direction: column;
    height: 100dvh;
    font-size: 14px;
}

/* HEADER */
header {
    height: 60px;
    background: #000;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    flex-shrink: 0;
    z-index: 100;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.brand-logo {
    height: 32px;
    width: auto;
    display: block;
}

.brand-fallback-icon {
    width: 32px;
    height: 32px;
    background: white;
    color: black;
    font-weight: bold;
    border-radius: 4px;
    display: none;
    align-items: center;
    justify-content: center;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-name {
    font-size: 16px;
    margin: 0;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-main);
}

.brand-tag {
    font-size: 10px;
    color: var(--primary-purple);
    letter-spacing: 1px;
    font-weight: 600;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.text-link {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 5px;
}

.shop-btn {
    text-decoration: none;
    background: #222;
    border: 1px solid #333;
    padding: 6px 12px;
    border-radius: 20px;
    color: white;
    font-size: 12px;
    white-space: nowrap;
}

/* MAIN LAYOUT */
main {
    display: flex;
    flex-direction: row;
    height: calc(100dvh - 60px);
    overflow: hidden;
}

/* LEFT: CONTROLS */
#controls-section {
    width: 400px;
    background: var(--bg-dark);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    height: 100%;
}

.scroll-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

/* RIGHT: PREVIEW */
#preview-section {
    flex-grow: 1;
    position: relative;
    background: radial-gradient(circle at center, #2e1a45 0%, #000000 100%);
}

#canvas-container {
    width: 100%;
    height: 100%;
}

.preview-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    color: #aaa;
    pointer-events: none;
}

/* UI ELEMENTS */
h3 {
    color: var(--primary-purple);
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0 0 15px 0;
}

.control-group {
    margin-bottom: 5px;
}

label {
    display: block;
    font-size: 12px;
    margin-bottom: 6px;
    color: var(--text-muted);
}

input[type="text"],
input[type="tel"],
textarea,
select {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: white;
    padding: 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.slider-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.slider-row label {
    margin: 0;
    width: 90px;
}

.slider-row span {
    font-size: 12px;
    color: #666;
    width: 45px;
    text-align: right;
}

input[type="range"] {
    flex-grow: 1;
    height: 4px;
    background: #333;
    border-radius: 2px;
    appearance: none;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-purple);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #000;
}

/* ACTION BUTTONS (Desktop) */
.action-area {
    flex-shrink: 0;
    background: #111;
    padding: 15px;
    border-top: 1px solid var(--card-border);
    z-index: 50;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(90deg, #8A56AC, #68358A);
    border: none;
    padding: 14px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    font-size: 16px;
}

.download-grid {
    display: flex;
    gap: 10px;
}

.download-grid button {
    flex: 1;
    padding: 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 13px;
}

/* Add this to your BUTTONS section */
.btn-secondary {
    width: 100%;
    background: #333;
    border: 1px solid #555;
    padding: 12px;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.btn-secondary:hover {
    background: #444;
    border-color: #777;
}

.btn-success {
    background: var(--action-green);
    color: #000;
}

.btn-outline {
    background: transparent;
    border: 1px solid #444 !important;
    color: white;
}

.footer-branding {
    text-align: center;
    font-size: 10px;
    color: #333;
    margin-top: 10px;
}

/* MODAL */
.hidden {
    display: none !important;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #1a1a1a;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 85dvh;
    position: relative;
    border: 1px solid #333;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 25px 30px 10px 30px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--primary-purple);
}

.modal-header .subtitle {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-body {
    padding: 20px 30px;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.6;
    color: #ddd;
}

.modal-body h3 {
    color: var(--action-green);
    font-size: 15px;
    margin-top: 25px;
    margin-bottom: 10px;
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
}

.modal-body ol,
.modal-body ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 8px;
    color: #ccc;
}

.faq-item {
    margin-bottom: 15px;
    background: #222;
    padding: 15px;
    border-radius: 8px;
}

.faq-item strong {
    display: block;
    color: #fff;
    margin-bottom: 5px;
}

.faq-item p {
    margin: 0;
    font-size: 14px;
    color: #aaa;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #333;
    text-align: center;
    background: #151515;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    padding: 5px 10px;
    cursor: pointer;
    color: #fff;
    z-index: 10;
}

.close:hover {
    color: var(--primary-purple);
}

/* MOBILE RESPONSIVE - THE CRITICAL FIX */
/* MOBILE RESPONSIVE FIXES */
@media (max-width: 768px) {
    .brand-name {
        font-size: 14px;
    }

    .brand-tag {
        font-size: 9px;
    }

    main {
        flex-direction: column;
    }

    /* Preview takes top portion */
    #preview-section {
        height: 35dvh;
        min-height: 250px;
        flex-shrink: 0;
    }

    /* Controls take remaining height */
    #controls-section {
        width: 100%;
        flex-grow: 1;
        border-right: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        /* Contains the scroll inside */
        position: relative;
    }

    /* THE FIX: Force the scroll container to respect boundaries */
    .scroll-content {
        flex: 1 1 0;
        /* Crucial: Forces flex child to stay within parent height */
        overflow-y: scroll;
        /* Massive padding forces content up above the fixed buttons */
        padding-bottom: 300px !important;
    }

    /* Fixed Buttons */
    .action-area {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 9999;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        background: #111;
        /* Ensure background is solid so content doesn't show through */
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.9);
        border-top: 1px solid #333;
    }
}