/* =============================================
   Room Furniture Planner 2D — styles.css
   Light mode, warm blueprint aesthetic
   ============================================= */

:root {
    --primary: #6C5CE7;
    --primary-hover: #5A49D4;
    --secondary: #A29BFE;
    --accent: #FDCB6E;
    --accent-dark: #E0A84A;
    --danger: #E17055;
    --bg: #F8F9FA;
    --bg-surface: #FFFFFF;
    --bg-sidebar: #F0F2F5;
    --border: #DEE2E8;
    --text: #2D3436;
    --text-muted: #636E72;
    --canvas-bg: #EBF0F7;
    --room-fill: #FAFCFF;
    --room-border: #4A5568;
    --grid-line: rgba(100, 120, 180, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.18s ease;
    --header-h: 56px;
    --sidebar-w: 240px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

html {
    font-size: 15px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Header ── */
.site-header {
    height: var(--header-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 50;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.header-inner {
    max-width: 100%;
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1rem;
}

.logo-icon {
    font-size: 1.3rem;
}

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

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-outline:hover {
    color: var(--text);
    border-color: #bbb;
    background: rgba(0, 0, 0, 0.03);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: rgba(225, 112, 85, 0.4);
}

.btn-danger:hover {
    background: rgba(225, 112, 85, 0.08);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.78rem;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.full-width {
    width: 100%;
    justify-content: center;
}

.mt-sm {
    margin-top: 8px;
}

/* ── App Layout ── */
.app-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - var(--header-h));
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sidebar-section {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* ── Room Dimension Inputs ── */
.dim-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.dim-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 52px;
    flex-shrink: 0;
}

.dim-input {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.82rem;
    background: var(--bg-surface);
    color: var(--text);
}

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

.dim-select {
    cursor: pointer;
    appearance: none;
}

.dim-unit {
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ── Furniture Grid ── */
.furniture-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.furniture-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: grab;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    transition: all var(--transition);
    user-select: none;
}

.furniture-item:hover {
    border-color: var(--primary);
    background: rgba(108, 92, 231, 0.06);
    color: var(--primary);
}

.furniture-item:active {
    cursor: grabbing;
}

.furniture-item .f-icon {
    font-size: 1.5rem;
}

.furniture-item .f-name {
    font-size: 0.65rem;
    font-weight: 600;
}

.furniture-item .f-size {
    font-size: 0.58rem;
    color: var(--text-muted);
}

/* ── Selected Item Props ── */
.prop-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.prop-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 52px;
    flex-shrink: 0;
}

/* ── Ruler ── */
.ruler-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ruler-bar {
    height: 8px;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.ruler-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

/* ── Canvas Area ── */
.canvas-area {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--canvas-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-scroller {
    overflow: auto;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#room-canvas {
    cursor: default;
    background: var(--room-fill);
    border: 2px solid var(--room-border);
    border-radius: 4px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    display: block;
}

.canvas-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.78rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 14px;
    pointer-events: none;
    white-space: nowrap;
}

.canvas-hint.hidden {
    display: none;
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    background: var(--text);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 0.84rem;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.25s ease;
    pointer-events: none;
    max-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ── Room Labels on Canvas ── */
.room-label {
    font-family: 'Inter', sans-serif;
}

/* ── Responsive ── */
@media (max-width: 700px) {
    :root {
        --sidebar-w: 180px;
    }

    .header-actions {
        gap: 4px;
    }

    .btn-sm {
        padding: 4px 7px;
        font-size: 0.72rem;
    }
}

@media (max-width: 500px) {
    .sidebar {
        display: none;
    }
}