/* Interactive Playground Styles - High Fidelity 1440px Canvas */
.playground-wrapper {
    display: flex;
    gap: 20px;
    background: #0f172a;
    /* Dark outer bg */
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    height: 100%;
    min-height: 600px;
}

/* Sidebar / Palette */
.playground-sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    padding-right: 10px;
}

.palette-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.palette-title {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.draggable-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.draggable-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.2s;
}

.draggable-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
    border-color: rgba(255, 255, 255, 0.3);
}

.draggable-item:hover::before {
    opacity: 1;
    background: #8B5CF6;
}

.draggable-item i {
    color: #8B5CF6;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Main Area Container */
.playground-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Contain the scaled canvas */
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    position: relative;
}

/* Controls */
.playground-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.playground-theme-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.playground-theme-btn:hover {
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.playground-theme-btn.active {
    background: #8B5CF6;
    border-color: #8B5CF6;
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* SCALED CANVAS WRAPPER - The Magic */
.canvas-viewport {
    flex: 1;
    overflow: auto;
    /* ENABLE INDEPENDENT SCROLLING */
    width: 100%;
    height: 100%;
    position: relative;
    background-image:
        linear-gradient(45deg, #1e1e1e 25%, transparent 25%),
        linear-gradient(-45deg, #1e1e1e 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1e1e1e 75%),
        linear-gradient(-45deg, transparent 75%, #1e1e1e 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #111;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    /* Center horizontally if space allows */
    padding: 60px;
}

.playground-canvas {
    width: 1440px;
    /* STANDARD DESKTOP WIDTH */
    min-height: 1200px;
    /* Reasonable starting height */
    flex-shrink: 0;
    /* Prevent shrinking */
    background: var(--theme-bg, #ffffff);
    color: var(--theme-text, #000000);
    box-shadow: 0 0 150px rgba(0, 0, 0, 0.8);
    /* Deep shadow for pop */
    transform-origin: top center;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Scale set in JS. Default 1.0 */
    transform: scale(0.9);
    padding: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 300px;
}

.playground-canvas.drag-over {
    outline: 4px dashed #8B5CF6;
    outline-offset: -4px;
}

/* Canvas Blocks (High Fidelity) */
.canvas-block {
    position: relative;
    width: 100%;
    transition: box-shadow 0.2s;
}

.canvas-block:hover {
    box-shadow: inset 0 0 0 2px #8B5CF6;
    z-index: 10;
}

.canvas-block-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 20;
}

.canvas-block:hover .canvas-block-controls {
    opacity: 1;
}

.control-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.control-btn.delete {
    background: #ef4444;
}

.control-btn.delete:hover {
    background: #dc2626;
}

.control-btn.move {
    background: #3b82f6;
    cursor: grab;
}

/* THEME VARIABLES SYSTEM */
.theme-minimal {
    --theme-bg: #ffffff;
    --theme-text: #0f172a;
    --theme-accent: #0f172a;
    --theme-sec: #f8fafc;
    --theme-border: #e2e8f0;
    --theme-font: 'Inter', sans-serif;
    --theme-radius: 0px;
}

.theme-cyber {
    --theme-bg: #050505;
    --theme-text: #00ff9d;
    --theme-accent: #00ff9d;
    --theme-sec: #0a0a0a;
    --theme-border: #1a1a1a;
    --theme-font: 'Courier New', monospace;
    --theme-radius: 0px;
}

.theme-corporate {
    --theme-bg: #ffffff;
    --theme-text: #334155;
    --theme-accent: #2563eb;
    --theme-sec: #f1f5f9;
    --theme-border: #cbd5e1;
    --theme-font: 'Helvetica Neue', sans-serif;
    --theme-radius: 8px;
}

.theme-brutal {
    --theme-bg: #fdf5e6;
    --theme-text: #000000;
    --theme-accent: #ff5252;
    --theme-sec: #ffffff;
    --theme-border: #000000;
    --theme-font: 'Courier New', monospace;
    --theme-radius: 0px;
}

/* Brutalism often needs specific border overrides, we handle generically via border var */

.theme-luxury {
    --theme-bg: #1a1a1a;
    --theme-text: #e0e0e0;
    --theme-accent: #d4af37;
    /* Gold */
    --theme-sec: #222222;
    --theme-border: #333333;
    --theme-font: 'Playfair Display', serif;
    /* Would need import, fallback serif */
    --theme-radius: 2px;
}

.theme-playful {
    --theme-bg: #fff0f5;
    --theme-text: #4a4a4a;
    --theme-accent: #ff69b4;
    --theme-sec: #ffffff;
    --theme-border: #ffb6c1;
    --theme-font: 'Comic Sans MS', 'Chalkboard SE', sans-serif;
    --theme-radius: 20px;
}

/* COMPONENT TEMPLATE STYLES */
/* Header */
.comp-header {
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 80px;
    border-bottom: 1px solid var(--theme-border);
    background: var(--theme-bg);
}

.comp-logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--theme-accent);
    font-family: var(--theme-font);
    letter-spacing: -0.02em;
}

.comp-nav {
    display: flex;
    gap: 40px;
}

.comp-link {
    font-size: 1.05rem;
    color: var(--theme-text);
    font-weight: 500;
    font-family: var(--theme-font);
    cursor: pointer;
}

.comp-cta {
    padding: 12px 28px;
    background: var(--theme-accent);
    color: var(--theme-bg);
    border-radius: var(--theme-radius);
    font-weight: 600;
    font-family: var(--theme-font);
    border: none;
}

/* Hero */
.comp-hero {
    min-height: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: var(--theme-sec);
    padding: 80px;
    position: relative;
    overflow: hidden;
}

.comp-h1 {
    font-size: 5rem;
    line-height: 1.05;
    margin-bottom: 30px;
    color: var(--theme-text);
    font-family: var(--theme-font);
    font-weight: 800;
    max-width: 1000px;
}

.comp-p {
    font-size: 1.4rem;
    max-width: 700px;
    margin-bottom: 50px;
    color: var(--theme-text);
    opacity: 0.8;
    font-family: var(--theme-font);
    line-height: 1.6;
}

/* Grid */
.comp-grid {
    padding: 120px 80px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    background: var(--theme-bg);
}

.comp-card {
    padding: 50px;
    background: var(--theme-sec);
    border-radius: var(--theme-radius);
    border: 1px solid var(--theme-border);
    transition: transform 0.2s;
}

.comp-card:hover {
    transform: translateY(-5px);
}

.comp-card-icon {
    width: 60px;
    height: 60px;
    background: var(--theme-accent);
    margin-bottom: 30px;
    border-radius: var(--theme-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-bg);
    font-size: 1.5rem;
}

.comp-card-title {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: var(--theme-text);
    font-family: var(--theme-font);
    font-weight: 700;
}

.comp-card-text {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--theme-text);
    opacity: 0.8;
    font-family: var(--theme-font);
}

/* Footer */
.comp-footer {
    padding: 100px 80px;
    background: #0f172a;
    /* Inverted for footer often */
    color: white;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 60px;
}

.theme-cyber .comp-footer {
    background: #000;
    border-top: 1px solid #333;
}

.theme-minimal .comp-footer {
    background: #111;
}

.theme-corporate .comp-footer {
    background: #1e293b;
}

.comp-footer-col h4 {
    margin-bottom: 30px;
    font-family: var(--theme-font);
    font-size: 1.2rem;
}

.comp-footer-link {
    display: block;
    margin-bottom: 15px;
    opacity: 0.6;
    font-family: var(--theme-font);
    font-size: 1rem;
    cursor: pointer;
}

.comp-footer-link:hover {
    opacity: 1;
    color: var(--theme-accent);
}

/* Empty Message */
.empty-canvas-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-family: sans-serif;
    pointer-events: none;
}