/* --- Master Layout --- */
html, body {
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    font-family: 'Segoe UI', Roboto, sans-serif;
    background-color: #1a252f;
    overflow: hidden; /* Important: Prevents the browser window from scrolling */
    display: flex;
    flex-direction: column; /* Forces Header at top, App below */
}

/* --- 1. TOP HEADER --- */
.main-header {
    height: 60px;
    background: #1a252f;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    border-bottom: 1px solid #34495e;
    flex-shrink: 0; /* Prevents header from shrinking */
    z-index: 1000;
}

.header-logo { font-size: 1.2rem; letter-spacing: 1px; }
.header-logo strong { color: #f1c40f; } /* Makes 'Designer' pop */

.btn-back { 
    color: #adb5bd; 
    text-decoration: none; 
    font-size: 0.9rem; 
    transition: color 0.2s;
}
.btn-back:hover { color: #ffffff; }

.btn-save-header { 
    background: #f1c40f; 
    border: none; 
    padding: 10px 25px; 
    border-radius: 4px; 
    font-weight: bold; 
    cursor: pointer;
    transition: background 0.2s;
}
.btn-save-header:hover { background: #d4ac0d; }

/* --- 2. THE APP WRAPPER --- */
.app-container {
    display: flex; /* Forces Sidebars and Canvas side-by-side */
    flex-direction: row; /* Horizontal alignment */
    flex-grow: 1;  
    height: calc(100vh - 60px); 
    overflow: hidden; /* Map scrolling is handled by the container below */
}

/* --- SIDEBARS --- */
.sidebar-left, .sidebar-right {
    width: 280px;
    height: 100%;
    background: #2c3e50;
    color: #ecf0f1;
    padding: 20px;
    box-sizing: border-box;
    flex-shrink: 0; /* Critical: Stops sidebars from narrowing */
    z-index: 100;
    overflow-y: auto;
}

.sidebar-right {
    background: #ffffff;
    color: #333;
    border-left: 1px solid #dcdde1;
    display: none; /* Controlled by JS in floorplan.js */
}

/* --- CENTER VIEWPORT --- */
#canvas-container {
    flex-grow: 1; /* Occupies all space between sidebars */
    height: 100%;
    overflow: auto; /* Enables scrollbars for big maps */
    background: #7f8c8d; /* "Floor" color */
    position: relative;
    display: block; 
}

canvas {
    background: #ffffff;
    display: block;
    margin: 400px auto; /* Allows scrolling past edges when zoomed */
    box-shadow: 0 0 50px rgba(0,0,0,0.4);
    border: 1px solid #000;
    cursor: crosshair;
    touch-action: none;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

/* --- UI Elements --- */
.section { margin-bottom: 25px; }
.sidebar-hr { border: 0; border-top: 1px solid #34495e; margin: 15px 0; }

label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #95a5a6;
    margin-bottom: 8px;
    font-weight: bold;
}

/* General button styling */
.btn, .btn-zoom, .btn-rotate, .btn-close {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    transition: opacity 0.2s;
}
.btn:hover, .btn-zoom:hover { opacity: 0.9; }

.btn-8ft { background: #3498db; color: white; }
.btn-6ft { background: #2ecc71; color: white; }
.btn-booth { background: #9b59b6; color: white; }
.btn-zoom { background: #6c757d; color: white; margin-bottom: 5px; }
.btn-rotate { background: #fd7e14; color: white; }
.btn-close { background: #6c757d; color: white; }

/* --- CVI Status --- */
#cvi-status-indicator {
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    border: 1px solid #ddd;
    margin-top: 10px;
    background: #f8f9fa;
}

.status-approved { background: #d4edda !important; color: #155724 !important; border-color: #c3e6cb !important; }
.status-pending { background: #fff3cd !important; color: #856404 !important; border-color: #ffeeba !important; }
.status-missing { background: #f8d7da !important; color: #721c24 !important; border-color: #f5c6cb !important; }

/* --- Mobile Responsiveness --- */
@media (max-width: 1024px) {
    .app-container { flex-direction: column; overflow-y: auto; }
    .sidebar-left, .sidebar-right { width: 100%; height: auto; }
    #canvas-container { height: 500px; order: -1; }
}