/* Global Styles */
:root {
    --bg-base: #0a0d16;
    --bg-panel: rgba(16, 22, 37, 0.65);
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-active: rgba(0, 229, 255, 0.4);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --color-accent: #00e5ff;
    --color-accent-grad: linear-gradient(135deg, #00b4d8, #00e5ff);
    --color-accent-glow: rgba(0, 229, 255, 0.25);
    
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-room-hover: rgba(0, 229, 255, 0.08);
    --color-room-active: rgba(0, 229, 255, 0.15);
    
    --font-sans: 'Outfit', 'Noto Sans KR', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --sidebar-width: 380px;
    --transition-speed: 0.25s;
    --border-radius: 16px;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
}

/* Glassmorphism utility */
.glass {
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* App Container Layout */
.app-container {
    display: flex;
    height: 100vh;
    padding: 20px;
    gap: 20px;
    background-image: radial-gradient(circle at 70% 30%, rgba(0, 180, 216, 0.05) 0%, transparent 50%),
                      radial-gradient(circle at 10% 80%, rgba(16, 185, 129, 0.03) 0%, transparent 40%);
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto;
    z-index: 10;
}

.sidebar-header {
    margin-bottom: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-dot {
    width: 8px;
    height: 8px;
    background: var(--color-accent-grad);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--color-accent);
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--color-accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Section styling inside sidebar */
.sidebar section {
    margin-bottom: 24px;
}

.sidebar h2 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    transition: all var(--transition-speed) ease;
}

.stat-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--font-sans);
}

.stat-value.text-accent {
    color: var(--color-accent);
    text-shadow: 0 0 12px var(--color-accent-glow);
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Controls button group */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    transition: all var(--transition-speed) ease;
}

.control-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.control-btn.active {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--border-color-active);
    color: var(--color-accent);
}

.btn-icon {
    margin-right: 8px;
    font-size: 1.1rem;
}

/* Room details card */
.room-detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all var(--transition-speed) ease;
}

.room-detail-card.active {
    border-color: var(--border-color-active);
    background: rgba(16, 22, 37, 0.8);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.05);
}

.placeholder-text {
    color: var(--text-muted);
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.4;
}

.room-detail-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.room-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.85rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-lbl {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.detail-val {
    color: var(--text-primary);
    font-weight: 500;
}

.sidebar-footer {
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Main Visualizer Area */
.visualizer-area {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Compass widget */
.compass-container {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 10;
}

.compass {
    width: 60px;
    height: 60px;
    position: relative;
}

.compass-dial {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    position: relative;
}

.direction {
    position: absolute;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
}

.direction.n { top: 2px; left: 50%; transform: translateX(-50%); }
.direction.e { right: 4px; top: 50%; transform: translateY(-50%); }
.direction.s { bottom: 2px; left: 50%; transform: translateX(-50%); }
.direction.w { left: 4px; top: 50%; transform: translateY(-50%); }

.compass-pointer {
    width: 4px;
    height: 40px;
    background: linear-gradient(to bottom, var(--color-accent) 50%, var(--text-muted) 50%);
    position: absolute;
    top: 10px;
    left: 28px;
    border-radius: 2px;
    transform: rotate(135deg); /* Southeast is pointing down, so North points North-West (135deg counter-clockwise) */
}

.compass-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Canvas Container */
.canvas-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    cursor: grab;
}

.canvas-container:active {
    cursor: grabbing;
}

.canvas-zoom-controls {
    position: absolute;
    left: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.canvas-zoom-controls button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed) ease;
}

.canvas-zoom-controls button:hover {
    background: var(--bg-card-hover);
    border-color: var(--color-accent);
}

.floorplan-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
}

#floorplan-svg {
    width: 90%;
    height: 90%;
    max-width: 1000px;
    max-height: 800px;
    user-select: none;
}

/* SVG Elements Styling */
.room-polygon {
    fill: rgba(255, 255, 255, 0.015);
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 2;
    transition: all var(--transition-speed) ease;
    cursor: pointer;
}

.room-polygon:hover {
    fill: var(--color-room-hover);
    stroke: var(--color-accent);
}

.room-polygon.active {
    fill: var(--color-room-active);
    stroke: var(--color-accent);
    stroke-width: 3;
    filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.15));
}

/* Solid structural walls */
.wall-line {
    stroke: #ffffff;
    stroke-width: 12;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.wall-center {
    stroke: #1e293b;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Room texts */
.room-label {
    fill: var(--text-primary);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 18px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    transition: fill var(--transition-speed);
}

.room-polygon:hover + .room-label,
.room-polygon.active + .room-label {
    fill: var(--color-accent);
}

.room-area-label {
    fill: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 13px;
    text-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Windows styling */
.window-line {
    stroke: #ffea00;
    stroke-width: 5;
    stroke-linecap: round;
}

.window-glass {
    stroke: rgba(255, 234, 0, 0.3);
    stroke-width: 14;
    stroke-linecap: round;
    opacity: 0.8;
}

.window-frame {
    stroke: #ffffff;
    stroke-width: 2;
}

/* Doors styling */
.door-line {
    stroke: #e2e8f0;
    stroke-width: 3;
    stroke-linecap: round;
}

.door-arc {
    fill: none;
    stroke: rgba(226, 232, 240, 0.4);
    stroke-width: 1.5;
    stroke-dasharray: 4 4;
}

/* Dimensions lines */
.dim-line {
    stroke: var(--color-accent);
    stroke-width: 1;
    stroke-dasharray: 2 2;
    opacity: 0.65;
    transition: opacity var(--transition-speed);
}

.dim-extension {
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 0.8;
}

.dim-arrow {
    fill: var(--color-accent);
    opacity: 0.8;
}

.dim-text-bg {
    fill: #0a0d16;
    rx: 4;
    ry: 4;
}

.dim-text {
    fill: var(--color-accent);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: bold;
    text-anchor: middle;
    alignment-baseline: middle;
}

/* Controls toggling classes */
.hide-grid #grid-rect {
    display: none;
}

.hide-dims .dim-group {
    display: none;
}

.hide-labels .label-group {
    display: none;
}

/* Terrace Custom Pattern Fill & Outlines */
.terrace-polygon {
    fill: url(#decking) !important;
    stroke: rgba(0, 229, 255, 0.4) !important;
    stroke-width: 2px;
    filter: drop-shadow(0 0 5px rgba(0, 229, 255, 0.1));
}

.terrace-polygon:hover {
    fill: rgba(0, 229, 255, 0.08) !important;
    stroke: var(--color-accent) !important;
}

/* Public Corridor Styling (Amber/Yellow) */
#poly-public-corridor {
    fill: rgba(245, 158, 11, 0.15);
    stroke: rgba(245, 158, 11, 0.3);
}
#poly-public-corridor:hover {
    fill: rgba(245, 158, 11, 0.25);
    stroke: rgba(245, 158, 11, 0.5);
}

/* Railing Walls */
.wall-line-railing {
    stroke: rgba(255, 255, 255, 0.35);
    stroke-width: 4px;
    stroke-dasharray: 6 5;
    stroke-linecap: round;
}

.wall-center-railing {
    stroke: transparent;
    stroke-width: 0;
}

/* Sliding Doors */
.sliding-door-panel {
    stroke: var(--color-accent);
    stroke-width: 3.5px;
    stroke-linecap: round;
    opacity: 0.95;
    filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.4));
}

.sliding-door-frame {
    stroke: rgba(255, 255, 255, 0.25);
    stroke-width: 1.5px;
    stroke-linecap: round;
}

/* Fixtures (Sink & Burners) */
.fixture-counter {
    fill: rgba(255, 255, 255, 0.025);
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 1.5px;
}

.fixture-divide-line {
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1px;
}

.fixture-bowl {
    fill: rgba(0, 229, 255, 0.04);
    stroke: rgba(0, 229, 255, 0.25);
    stroke-width: 1.5px;
}

.fixture-faucet {
    fill: #ffffff;
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 0.5px;
}

.fixture-faucet-spout {
    stroke: #ffffff;
    stroke-width: 1.5px;
    stroke-linecap: round;
}

.fixture-burner {
    fill: rgba(255, 255, 255, 0.01);
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 1.2px;
}

.fixture-label {
    fill: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 500;
    pointer-events: none;
    letter-spacing: 0.5px;
}

.door-label-text {
    fill: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 9px;
    font-weight: 500;
    pointer-events: none;
    letter-spacing: 0.5px;
}

/* Bathroom Fixtures Specific Styles */
.fixture-basin {
    fill: rgba(0, 229, 255, 0.04);
    stroke: rgba(0, 229, 255, 0.25);
    stroke-width: 1.5px;
}

.fixture-tank {
    fill: rgba(255, 255, 255, 0.025);
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 1.5px;
    rx: 2px;
    ry: 2px;
}

.fixture-toilet-seat {
    fill: rgba(255, 255, 255, 0.03);
    stroke: rgba(255, 255, 255, 0.18);
    stroke-width: 1.5px;
}

.fixture-toilet-hole {
    fill: rgba(10, 13, 22, 0.6);
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1px;
}


