:root {
    /* Palette: "Studio" */
    --canvas-bg: #f8fafc;
    --studio-bg-1: #4f46e5;
    /* Indigo */
    --studio-bg-2: #06b6d4;
    /* Cyan */
    --studio-bg-3: #ec4899;
    /* Pink/Rose highlight */

    --glass-surface: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;

    --brand-primary: #4338ca;
    /* Indigo 700 */
    --brand-accent: #0ea5e9;
    /* Sky 500 */

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;

    /* Room Colors (Pastel/Modern) */
    --room-living: #86efac;
    --room-bedroom: #93c5fd;
    --room-kitchen: #fde047;
    --room-dining: #fdba74;
    --room-bath: #d8b4fe;
    --room-util: #cbd5e1;
    --room-micro: #6ee7b7;
}

/* ── Reset & Base ────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    background-color: #f1f5f9;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ── Animated Background ─────────────────────────────────── */
.fp-studio-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(at 0% 0%, var(--studio-bg-2) 0px, transparent 50%),
        radial-gradient(at 90% 10%, var(--studio-bg-3) 0px, transparent 50%),
        radial-gradient(at 50% 90%, var(--studio-bg-1) 0px, transparent 60%);
    background-size: 150% 150%;
    filter: blur(80px);
    opacity: 0.15;
    animation: bg-pulse 15s ease infinite alternate;
}

@keyframes bg-pulse {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 100% 50%;
    }
}

/* ── Layout: Studio Grid ─────────────────────────────────── */
.fp-studio {
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--space-md);
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: var(--space-lg);
    min-height: 100vh;
    align-items: start;
}

@media (max-width: 1024px) {
    .fp-studio {
        grid-template-columns: 1fr;
    }
}

/* ── Glass Panel Component ───────────────────────────────── */
.fp-glass-panel {
    background: var(--glass-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    padding: var(--space-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fp-glass-panel:hover {
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.2);
}

/* ── Left Sidebar (Controls) ─────────────────────────────── */
.fp-controls-header {
    margin-bottom: var(--space-lg);
}

.fp-brand-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.fp-brand-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Config Sections */
.fp-config-section {
    margin-bottom: var(--space-lg);
}

.fp-config-heading {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    font-weight: 700;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: 8px;
}

.fp-config-heading::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
}

/* Input Inputs */
.fp-input-group {
    position: relative;
    margin-bottom: var(--space-md);
}

.fp-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.2s;
    font-family: inherit;
    font-weight: 600;
}

.fp-input:focus {
    outline: none;
    background: #fff;
    border-color: var(--brand-accent);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
}

.fp-input-label {
    position: absolute;
    top: -8px;
    left: 12px;
    background: #fff;
    padding: 0 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-radius: 4px;
    font-weight: 600;
}

/* Toggle Pills */
.fp-pills {
    display: flex;
    background: rgba(0, 0, 0, 0.04);
    padding: 4px;
    border-radius: var(--radius-full);
    gap: 4px;
}

.fp-pill-option {
    flex: 1;
    position: relative;
}

.fp-pill-input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    inset: 0;
}

.fp-pill-label {
    display: block;
    text-align: center;
    padding: 8px 12px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.fp-pill-input:checked+.fp-pill-label {
    background: #fff;
    color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Room List */
.fp-room-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fp-room-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.fp-room-row:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.8);
}

.fp-room-check {
    width: 20px;
    height: 20px;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

.fp-room-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

.fp-room-dims {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fp-dim-input {
    width: 50px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.8);
    text-align: center;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 600;
}

.fp-dim-input:focus {
    outline: none;
    border-color: var(--brand-accent);
}

.fp-dim-x {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* Primary Action Button */
.fp-btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(67, 56, 202, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}

.fp-btn-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0));
    transform: translateY(100%);
    transition: transform 0.3s;
}

.fp-btn-primary:active {
    transform: scale(0.98);
}

.fp-btn-primary:hover {
    box-shadow: 0 12px 28px rgba(67, 56, 202, 0.4);
}

.fp-btn-primary:hover::after {
    transform: translateY(-100%);
}

/* ── Main Stage (Right) ──────────────────────────────────── */
.fp-stage {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.fp-canvas-area {
    position: relative;
    height: 600px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #fff;
    box-shadow: var(--glass-shadow);
    display: flex;
    align-items: center;
    justify-content: center;

    /* Drafting Grid Pattern */
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
}

.fp-canvas-area::before {
    content: "DRAFTING GRID";
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    color: rgba(0, 0, 0, 0.1);
    letter-spacing: 0.2em;
    pointer-events: none;
}

.fp-canvas-element {
    max-width: 90%;
    max-height: 90%;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15));
}

.fp-placeholder-text {
    text-align: center;
    color: var(--text-tertiary);
}

.fp-placeholder-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--text-tertiary);
    opacity: 0.5;
}

/* Floating Toolbar on Canvas */
.fp-canvas-toolbar {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.fp-tool-btn {
    border: none;
    background: transparent;
    padding: 8px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s;
}

.fp-tool-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--brand-primary);
}

/* Analytics & Summary Cards */
.fp-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.fp-stat-card {
    background: #fff;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.fp-stat-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.fp-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ── Error & Warning Toasts ───────────────────────────── */
.fp-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.fp-toast {
    background: #fff;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-left: 4px solid;
    pointer-events: auto;
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
    animation: toast-in 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.fp-toast.is-visible {
    display: block;
}

.fp-toast.error {
    border-color: #ef4444;
    color: #991b1b;
}

.fp-toast.warning {
    border-color: #f59e0b;
    color: #92400e;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.fade-in {
    animation: fade-in 0.5s ease forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}