:root {
    /* Colors */
    --bg-app: #eef2f6; /* Very light cool gray */
    --bg-panel: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --accent-blue: #3b82f6;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --accent-green: #10b981;
    --border-color: #e5e7eb;
    
    /* Spacing & Radius */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Font */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Utilities */
.hidden { display: none !important; }
.btn {
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
}

/* =========================================
   Landing Page
   ========================================= */
.landing-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: radial-gradient(circle at 50% 10%, #ffffff 0%, #eef2f6 100%);
}

.landing-header {
    width: 100%;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.hero-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 800px;
    padding: 2rem;
    padding-bottom: 6rem;
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    line-height: 1.6;
    max-width: 600px;
}

/* Hero Dropzone */
.hero-dropzone {
    width: 100%;
    max-width: 500px;
    background: white;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.hero-dropzone:hover {
    border-color: var(--accent-blue);
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.dropzone-content .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.dropzone-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.dropzone-content p {
    color: var(--text-secondary);
}

.hero-features {
    display: flex;
    gap: 2rem;
    margin-top: 3rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* =========================================
   Editor Layout (Split Screen)
   ========================================= */
.editor-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-app);
}

.editor-nav {
    height: 60px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    flex-shrink: 0;
}

.split-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Left: Preview Pane */
.preview-pane {
    flex: 1;
    background: var(--bg-app);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 2rem;
    position: relative;
}

.preview-container img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

/* Right: Controls Pane */
.controls-pane {
    width: 400px;
    background: white;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.controls-content {
    padding: 2rem;
    flex: 1;
}

/* Control Elements */
.controls-content > h3 {
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
}

/* Landing Page Drag Active State */
.landing-page.drag-active .hero-dropzone {
    transform: scale(1.05);
    border-color: var(--accent-blue);
    background: #eff6ff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.landing-page.drag-active .hero-title,
.landing-page.drag-active .hero-subtitle,
.landing-page.drag-active .hero-features {
    opacity: 0.5;
    pointer-events: none;
}

/* ... existing styles ... */

/* Template Grid (Swatches) */
/* Main Inputs (Heading/Subheading) */
.main-inputs {
    margin-bottom: 0.5rem;
}

.input-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.25rem;
    margin-top: 0.75rem;
}

.input-label:first-child {
    margin-top: 0;
}

/* Template Grid (Small Swatches) */
.template-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.template-option {
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 2px solid transparent;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.template-option:hover {
    transform: scale(1.15);
    z-index: 2;
}

.template-option.selected {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--accent-blue);
    transform: scale(1.1);
}

.template-preview {
    width: 100%;
    height: 100%;
}

.template-name { display: none; }

/* Inputs */
input[type="text"], select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
    color: var(--text-primary);
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: white;
}

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* Advanced Styling */
.advanced-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--accent-blue);
    font-weight: 500;
    cursor: pointer;
    margin: 1.5rem 0 0.5rem 0;
    padding: 0;
    background: none;
    border: none;
    transition: all 0.2s;
    user-select: none;
    width: fit-content;
}

.advanced-toggle:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

#advancedArrow {
    transition: transform 0.2s ease;
    font-size: 0.8rem;
}

.advanced-options {
    background: white;
    padding: 0 0.5rem;
    margin-bottom: 1rem;
    border-left: 2px solid var(--border-color); /* Subtle indicator of scope */
    margin-left: 0.25rem;
    padding-left: 1rem;
    animation: slideDown 0.2s ease-out;
}

.control-group {
    margin-bottom: 1rem;
}

.has-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1.25rem 0 1rem 0;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: none; /* CHANGED: Removes the forced uppercase */
    color: var(--text-secondary);
    display: block;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}

/* 1. Standardize all input labels (Font, Size, Color) */
.input-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary); /* Ensure this var exists, or use #333 */
    margin-bottom: 0.4rem;
}

/* 2. Fix the alignment for rows like Size and Color */
.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pushes label left, input right */
    margin-bottom: 0.75rem;
}

/* 3. Make the Size/Color labels inside rows align nicely */
.control-row .input-label {
    margin-bottom: 0; /* Remove bottom margin when side-by-side */
}

/* Typography Container - Creates the compact layout */
.typography-group {
    background: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Row for side-by-side controls (Size & Color) */
.compact-row {
    display: grid;
    grid-template-columns: 1fr auto; /* Size takes space, Color takes minimum */
    gap: 1rem;
    align-items: center;
}

/* Standardize the Inputs to look like a set */
.compact-select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    height: 36px; /* Fixed height for consistency */
    background: white;
}

.compact-color {
    height: 36px;
    width: 50px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

/* Mini Labels for the compact view */
.mini-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    display: block;
    text-transform: uppercase;
}

/* Logo Controls */
.logo-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.logo-control-item {
    background: #f9fafb;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.side-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: block;
    text-align: center;
}

.footer-logo-slot, .right-logos-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-height: 60px;
    justify-content: center;
}

/* Controls Footer (Download) */
.controls-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    background: white;
    margin-top: auto; /* Push to bottom if content is short */
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    padding: 1rem;
    width: 100%;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 8px rgba(59, 130, 246, 0.3);
}

.btn-text {
    background: none;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* Footer Layout Editor Styles */
.footer-layout-editor {
    background: #f9fafb;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.footer-side {
    margin-bottom: 1rem;
}
.side-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.footer-logo-slot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.logo-preview {
    width: 40px;
    height: 40px;
    background: #e5e7eb;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.9);
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    backdrop-filter: blur(4px);
}
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }