/* ==================== COMPILED FROM SCSS ==================== */
/* Boutique Map - Mobile-first responsive styles */

/* ==================== VARIABLES (as CSS Custom Properties) ==================== */
:root {
  --color-bg: #0d1117;
  --color-surface: #161b22;
  --color-surface-hover: #21262d;
  --color-surface-active: #2d333b;
  --color-border: #30363d;
  --color-text: #e6edf3;
  --color-text-secondary: #8b949e;
  --color-text-muted: #6e7681;
  --color-primary: #58a6ff;
  --color-primary-hover: #79b8ff;
  --color-success: #238636;
  --color-success-light: #3fb950;
  --color-danger: #f85149;
  --color-danger-dark: #da3633;
  --color-warning: #f0883e;
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --navbar-height: 57px;
  --navbar-height-mobile: 52px;
  --touch-target-min: 44px;
}

/* ==================== BASE ==================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-primary); background: var(--color-bg); color: var(--color-text); min-height: 100vh; font-size: 14px; }

input, select, textarea {
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface-hover);
  color: var(--color-text);
  font-size: 14px;
  width: 100%;
  font-family: var(--font-primary);
}
input:focus, select:focus { outline: none; border-color: var(--color-primary); }
input::placeholder { color: var(--color-text-secondary); }
input[type="color"] { padding: 4px; height: 40px; cursor: pointer; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--color-text-secondary); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ==================== BUTTONS ==================== */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface-hover);
  color: var(--color-text);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-primary);
}
.btn:hover { background: var(--color-surface-active); }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-danger { background: var(--color-danger); border-color: var(--color-danger); }
.btn-secondary { background: transparent; }
.btn-success { background: var(--color-success); border-color: var(--color-success); color: #fff; font-weight: 500; }
.btn-success:hover { background: var(--color-success-light); }

.tool-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface-hover);
  color: var(--color-text);
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.tool-btn:hover { background: var(--color-surface-active); }
.tool-btn.active { background: var(--color-primary); border-color: var(--color-primary); }

/* ==================== NAVBAR ==================== */
.navbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.navbar .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; text-decoration: none; color: var(--color-text); }
.navbar .logo .icon { font-size: 24px; }
.nav-toggle { display: none; background: none; border: none; color: var(--color-text); font-size: 24px; cursor: pointer; padding: 8px; }
.nav-links { display: flex; gap: 8px; }
.nav-links a { padding: 8px 16px; border-radius: var(--radius-lg); text-decoration: none; color: var(--color-text-secondary); font-size: 14px; transition: all var(--transition-fast); }
.nav-links a:hover { background: var(--color-surface-hover); color: var(--color-text); }
.nav-links a.active { background: var(--color-primary); color: #fff; }

/* ==================== MODAL ==================== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 1000;
}
.modal.show { opacity: 1; visibility: visible; }
.modal-content { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); width: 90%; max-height: 85vh; overflow: auto; }
.modal-large { max-width: 600px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--color-border); }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--color-text-secondary); font-size: 20px; cursor: pointer; padding: 4px 8px; }
.modal-body { padding: 20px; }

/* ==================== EDITOR ==================== */
.editor-layout { display: flex; flex-direction: column; height: calc(100vh - var(--navbar-height)); }
.editor-toolbar { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: var(--color-surface); border-bottom: 1px solid var(--color-border); flex-wrap: wrap; }
.toolbar-section { display: flex; align-items: center; gap: 8px; }
.toolbar-section label { font-size: 13px; color: var(--color-text-secondary); }
.toolbar-section select { width: auto; min-width: 100px; }
.tools { display: flex; gap: 4px; }
.editor-main { display: flex; flex: 1; overflow: hidden; }
.canvas-container { flex: 1; overflow: auto; background: var(--color-bg); }
.canvas-container canvas { display: block; }

.properties-panel { width: 280px; background: var(--color-surface); border-left: 1px solid var(--color-border); overflow-y: auto; }
.properties-panel h3 { padding: 16px; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--color-border); }
.properties-panel #propertiesContent { padding: 16px; }
.empty-props { color: var(--color-text-secondary); font-size: 13px; text-align: center; padding: 20px; }
.prop-group { margin-bottom: 12px; }
.prop-group label { display: block; font-size: 11px; color: var(--color-text-secondary); margin-bottom: 4px; }
.prop-group input, .prop-group select { font-size: 13px; padding: 8px 10px; }
.prop-row { display: flex; gap: 8px; }
.prop-row input { width: 50%; }
.prop-actions { display: flex; gap: 8px; margin-top: 16px; }
.prop-actions .btn { flex: 1; font-size: 12px; padding: 8px; }
.panel-toggle { display: none; position: fixed; bottom: 80px; right: 20px; width: 48px; height: 48px; border-radius: 50%; background: var(--color-primary); border: none; color: #fff; font-size: 20px; cursor: pointer; z-index: 99; box-shadow: 0 4px 12px rgba(0,0,0,0.3); align-items: center; justify-content: center; }
.panel-toggle.hidden { display: none; }

/* ==================== SEARCH ==================== */
.search-layout { display: flex; flex-direction: column; height: calc(100vh - var(--navbar-height)); }
.search-header { padding: 20px; background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.search-box { position: relative; max-width: 500px; }
.search-box input { padding-left: 40px; font-size: 16px; }
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-text-secondary); }
.search-box #clearSearch { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--color-text-secondary); cursor: pointer; display: none; }
#searchResults { position: absolute; top: 100%; left: 0; right: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); margin-top: 8px; max-height: 300px; overflow-y: auto; display: none; z-index: 100; }
#searchResults.show { display: block; }
.search-result-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--color-border); }
.search-result-item:hover { background: var(--color-surface-hover); }
.result-ref { font-weight: 600; font-size: 14px; }
.result-location { font-size: 12px; color: var(--color-text-secondary); margin-top: 2px; }

.map-section { flex: 1; display: flex; flex-direction: column; }
.niveau-tabs { display: flex; gap: 8px; padding: 12px 20px; background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.niveau-tab { padding: 8px 16px; border-radius: var(--radius-lg); border: 1px solid var(--color-border); background: transparent; color: var(--color-text-secondary); cursor: pointer; font-size: 13px; font-family: var(--font-primary); transition: all var(--transition-fast); }
.niveau-tab:hover { background: var(--color-surface-hover); }
.niveau-tab.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.map-wrapper { flex: 1; overflow: auto; padding: 20px; }
.map-controls { position: fixed; bottom: 20px; right: 20px; display: flex; gap: 8px; }

/* ==================== VIEW 3D ==================== */
.view3d-layout { height: calc(100vh - var(--navbar-height)); display: flex; flex-direction: column; }
.view3d-toolbar { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.view3d-toolbar .search-box { flex: 1; max-width: 300px; }
#canvas3d { flex: 1; display: block; }
.view3d-toolbar .search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); margin-top: 8px; max-height: 300px; overflow-y: auto; z-index: 100; }

/* ==================== EMPLACEMENT GRID ==================== */
.emplacement-grid { display: grid; gap: 3px; margin-bottom: 16px; max-height: 280px; overflow: auto; }
.emplacement-grid button { padding: 6px 4px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface-hover); color: var(--color-text); font-size: 10px; cursor: pointer; font-family: var(--font-primary); transition: all var(--transition-fast); }
.emplacement-grid button:hover { background: var(--color-surface-active); }
.emplacement-grid button.has-products { background: var(--color-primary); }

#emplacementGrid { display: grid; gap: 4px; max-height: 300px; overflow: auto; }

.emplacement-cell {
  background: var(--color-surface-hover);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 6px;
  min-height: 60px;
  min-width: 60px;
  width: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 10px;
  text-align: center;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.emplacement-cell:hover { transform: scale(1.05); box-shadow: 0 0 0 2px var(--color-primary); }
.emplacement-cell.selected { box-shadow: 0 0 0 3px var(--color-warning) !important; }
.emplacement-cell.has-products { background: var(--color-primary); }
.emplacement-cell.highlighted { background: var(--color-success); border: 2px solid var(--color-success-light); box-shadow: 0 0 10px var(--color-success); }
.emplacement-cell .cell-coords { font-weight: 600; margin-bottom: 4px; color: var(--color-text-secondary); }
.emplacement-cell.has-products .cell-coords,
.emplacement-cell.highlighted .cell-coords { color: #fff; }
.emplacement-cell .cell-products { font-family: var(--font-mono); font-size: 9px; color: #fff; word-break: break-all; line-height: 1.3; }

.product-management { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--color-border); }
.product-management .selected-label { margin-bottom: 12px; color: var(--color-text-secondary); font-size: 12px; }
.product-management .add-product-form { display: flex; gap: 8px; margin-bottom: 12px; }
.product-management .add-product-form input { flex: 1; padding: 8px 12px; background: var(--color-surface-hover); border: 1px solid var(--color-border); border-radius: var(--radius-md); color: var(--color-text); font-size: 13px; }
.product-management .add-product-form button { padding: 8px 16px; background: var(--color-success); border: none; border-radius: var(--radius-md); color: #fff; font-weight: 500; cursor: pointer; }
.product-management .add-product-form button:hover { background: var(--color-success-light); }

.products-list { max-height: 250px; overflow-y: auto; }
.produit-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--color-surface-hover); border-radius: var(--radius-md); margin-bottom: 6px; }
.produit-row .ref { font-family: var(--font-mono); font-size: 13px; }
.produit-row button { background: none; border: none; color: var(--color-text-secondary); cursor: pointer; padding: 4px 8px; }
.produit-row .delete-btn { background: var(--color-danger-dark); border: none; border-radius: var(--radius-sm); color: #fff; padding: 4px 8px; cursor: pointer; font-size: 11px; }
.produits-toolbar { display: flex; gap: 8px; margin-bottom: 16px; }
.produits-toolbar input { flex: 1; }
.empty-produits { color: var(--color-text-secondary); font-size: 13px; text-align: center; padding: 20px; }
.modal-info { margin-bottom: 16px; }
.modal-info strong { color: var(--color-text); }

/* ==================== RESPONSIVE - TOUCH DEVICES ==================== */
@media (pointer: coarse) {
  .btn, .tool-btn, .niveau-tab { min-height: var(--touch-target-min); min-width: var(--touch-target-min); }
  .nav-links a { padding: 12px 16px; }
  .search-result-item { padding: 16px; }
  .produit-row { padding: 14px; }
  .emplacement-grid button { padding: 10px 8px; font-size: 12px; }
  .emplacement-cell { min-height: 70px; padding: 10px 8px; }
}

/* ==================== RESPONSIVE - TABLET (<=1024px) ==================== */
@media screen and (max-width: 1024px) {
  .navbar { padding: 12px 16px; }
  .navbar .logo span:not(.icon) { display: none; }
  .nav-links a { padding: 10px 12px; font-size: 13px; }
  .properties-panel { width: 240px; }
  .editor-toolbar { padding: 10px 16px; gap: 12px; }
  .toolbar-section { gap: 6px; }
  .search-box { max-width: 400px; }
  .view3d-toolbar .search-box { max-width: 250px; }
  .map-controls { bottom: 16px; right: 16px; }
}

/* ==================== RESPONSIVE - MOBILE (<=768px) ==================== */
@media screen and (max-width: 768px) {
  :root {
    --navbar-height: var(--navbar-height-mobile);
  }

  /* Navbar */
  .navbar { flex-wrap: wrap; padding: 10px 16px; }
  .navbar .logo span:not(.icon) { display: inline; font-size: 16px; }
  .nav-toggle { display: flex; align-items: center; justify-content: center; }
  .nav-links {
    display: none; width: 100%; flex-direction: column; gap: 4px;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border);
  }
  .nav-links.open { display: flex; }
  .nav-links a { width: 100%; text-align: center; padding: 12px; border-radius: var(--radius-lg); }

  /* Editor */
  .editor-layout { height: calc(100vh - 52px); }
  .editor-main { flex-direction: column; position: relative; }
  .properties-panel {
    position: fixed; bottom: 0; left: 0; right: 0;
    width: 100%; height: 50vh; max-height: 400px;
    border-left: none; border-top: 1px solid var(--color-border);
    transform: translateY(100%); transition: transform var(--transition-normal);
    z-index: 90; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  .properties-panel.open { transform: translateY(0); }
  .properties-panel h3 { padding: 12px 16px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
  .properties-panel h3::after { content: '\25B2'; font-size: 12px; color: var(--color-text-secondary); }
  .panel-toggle { display: flex; }

  /* Toolbar */
  .editor-toolbar { padding: 8px 12px; gap: 8px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .toolbar-section { flex-shrink: 0; }
  .toolbar-section label { display: none; }
  .toolbar-section select { min-width: 80px; font-size: 13px; }
  .tool-btn { width: 44px; height: 44px; }
  #gridSize { font-size: 11px; white-space: nowrap; }

  /* Search */
  .search-layout { height: calc(100vh - 52px); }
  .search-header { padding: 16px; }
  .search-box { max-width: 100%; }
  .search-box input { font-size: 16px; padding: 12px 12px 12px 40px; }
  #searchResults { max-height: 250px; }

  /* Level tabs */
  .niveau-tabs { padding: 10px 16px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .niveau-tab { flex-shrink: 0; padding: 10px 14px; font-size: 13px; }

  /* Map */
  .map-wrapper { padding: 12px; }
  .map-controls { bottom: 12px; right: 12px; gap: 6px; }
  .map-controls .btn { width: 44px; height: 44px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; }

  /* View 3D */
  .view3d-layout { height: calc(100vh - 52px); }
  .view3d-toolbar { padding: 10px 12px; gap: 10px; flex-wrap: wrap; }
  .view3d-toolbar .toolbar-section label { display: none; }
  .view3d-toolbar .search-box { flex: 1; max-width: none; min-width: 150px; }

  /* Modals */
  .modal-content { width: 95%; max-height: 90vh; margin: 10px; }
  .modal-header { padding: 14px 16px; }
  .modal-header h3 { font-size: 15px; }
  .modal-body { padding: 16px; }
  .modal-close { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }

  /* Forms */
  .form-row { flex-direction: column; gap: 0; }
  .form-group { margin-bottom: 14px; }
  input, select, textarea { padding: 12px; font-size: 16px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; padding: 14px; }

  /* Properties */
  .prop-row { flex-direction: column; gap: 8px; }
  .prop-row input { width: 100%; }
  .prop-actions { flex-direction: column; }
  .prop-actions .btn { padding: 12px; }

  /* Products */
  .products-list { max-height: 200px; }
  .produits-toolbar { flex-direction: column; }
  .emplacement-grid { max-height: 200px; }
  #emplacementGrid { max-height: 250px; }

  /* Product management */
  .product-management .add-product-form { flex-direction: column; }
  .product-management .add-product-form button { width: 100%; padding: 12px; }
}

/* ==================== RESPONSIVE - SMALL PHONES (<=480px) ==================== */
@media screen and (max-width: 480px) {
  .navbar .logo { font-size: 15px; }
  .navbar .logo .icon { font-size: 20px; }
  .tool-btn { width: 40px; height: 40px; font-size: 16px; }
  .tools { gap: 3px; }
  .niveau-tab { padding: 8px 12px; font-size: 12px; }
  .search-box input { font-size: 16px; }
  .modal-content { width: 100%; margin: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 95vh; position: fixed; bottom: 0; }
}

/* ==================== RESPONSIVE - LANDSCAPE MOBILE ==================== */
@media screen and (max-width: 900px) and (orientation: landscape) {
  .editor-main { flex-direction: row; }
  .properties-panel {
    position: static; width: 220px; height: auto; max-height: none;
    transform: none; border-radius: 0; border-top: none; border-left: 1px solid var(--color-border);
  }
  .panel-toggle { display: none; }
  .modal-content { max-height: 85vh; }
}

/* ==================== SAFE AREA (NOTCHED DEVICES) ==================== */
@supports (padding: max(0px)) {
  .navbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .editor-toolbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .map-controls { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .panel-toggle { right: max(20px, env(safe-area-inset-right)); bottom: max(80px, calc(env(safe-area-inset-bottom) + 80px)); }
}
