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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8f9fa;
  color: #1e293b;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  background: white;
  min-height: 100vh;
  position: relative;
  padding-bottom: 80px;
}

/* ========== НИЖНЯЯ НАВИГАЦИЯ ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: white;
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  border-top: 1px solid #e2e8f0;
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #94a3b8;
  font-size: 11px;
  gap: 4px;
  flex: 1;
  text-align: center;
}

.nav-item i {
  font-size: 20px;
}

.nav-item.active {
  color: #f97316;
}

/* ========== ШАПКА ========== */
.search-header {
  padding: 16px;
  background: white;
}

.search-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #f97316;
  margin-bottom: 12px;
}

.search-box {
  background: #f1f5f9;
  border-radius: 12px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box i {
  color: #94a3b8;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  width: 100%;
  font-size: 16px;
}

/* ========== КАРТОЧКА ПРОЕКТА ========== */
.project-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
  border-color: #f97316;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.project-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #f97316;
}

.project-date {
  font-size: 11px;
  color: #94a3b8;
}

.project-address, .project-client {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.project-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.edit-btn { background: #f1f5f9; color: #f97316; }
.rooms-btn { background: #f1f5f9; color: #10b981; }
.spec-btn { background: #f1f5f9; color: #8b5cf6; }
.delete-btn { background: #fee2e2; color: #dc2626; }

.project-btn:hover { opacity: 0.8; transform: translateY(-1px); }

/* ========== КАРТОЧКА ПОМЕЩЕНИЯ ========== */
.room-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.room-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.room-area {
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 12px;
}

.room-dimensions {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 8px;
}

.room-note {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

.room-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.room-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  color: #475569;
}

.room-btn:hover { opacity: 0.8; }

/* ========== ЭЛЕМЕНТЫ НА СТЕНЕ ========== */
.element-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 8px;
}

.element-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.element-icon {
  width: 32px;
  text-align: center;
  font-size: 20px;
}

.element-details {
  font-size: 14px;
}

.element-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  color: #64748b;
}

/* ========== ПАНЕЛЬ ДОБАВЛЕНИЯ ========== */
.add-element-panel {
  margin-top: 16px;
  padding: 16px;
  background: #f1f5f9;
  border-radius: 12px;
}

.element-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.type-badge {
  padding: 6px 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.type-badge.selected {
  background: #f97316;
  color: white;
  border-color: #f97316;
}

.coord-inputs {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.coord-inputs input {
  flex: 1;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
}

.add-element-btn {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: #f97316;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.add-element-btn:hover {
  background: #ea580c;
  transform: translateY(-1px);
}

/* ========== СПЕЦИФИКАЦИЯ ========== */
.spec-section {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.spec-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1e293b;
}

.spec-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 14px;
}

.spec-item.total {
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 600;
  border-top: 2px solid #e2e8f0;
  border-bottom: none;
  color: #f97316;
}

/* ========== FAB КНОПКА ========== */
.fab {
  position: fixed;
  bottom: 90px;
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: #f97316;
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
  font-size: 24px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}

.fab:hover { transform: scale(1.05); }

/* ========== ФОРМЫ ========== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
}

.back-btn, .save-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: #f97316;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
  transition: background 0.2s;
}

.back-btn:hover, .save-btn:hover {
  background: #f1f5f9;
}

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

.form-container, .edit-container {
  padding: 16px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group.required .form-label::after {
  content: '*';
  color: #dc2626;
  margin-left: 4px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.1);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.input-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.form-actions {
  margin-top: 16px;
  margin-bottom: 16px;
}

.rooms-section-btn {
  width: 100%;
  padding: 14px;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.rooms-section-btn:hover {
  background: #059669;
  transform: translateY(-1px);
}

/* ========== ПУСТОЕ СОСТОЯНИЕ ========== */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: #94a3b8;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  color: #cbd5e1;
}

.empty-state p {
  font-size: 16px;
}

.empty-sub {
  font-size: 14px;
  margin-top: 8px;
}

/* ========== ЗАГРУЗКА ========== */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  color: #f97316;
  gap: 12px;
}

.loading-spinner i {
  font-size: 32px;
}

.loading-spinner span {
  font-size: 14px;
  color: #64748b;
}

/* ========== СООБЩЕНИЕ ОБ ОШИБКЕ ========== */
.error-message {
  text-align: center;
  padding: 48px 16px;
  color: #dc2626;
}

.error-message i {
  font-size: 48px;
  margin-bottom: 16px;
}

.error-message p {
  font-size: 16px;
  margin-bottom: 16px;
}

.retry-btn {
  background: #f97316;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}

.retry-btn:hover {
  background: #ea580c;
}

/* ========== TOAST-УВЕДОМЛЕНИЯ ========== */
.toast-container {
  position: fixed;
  bottom: 100px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: auto;
}

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

.toast-success {
  background: #10b981;
}

.toast-error {
  background: #ef4444;
}

.toast-warning {
  background: #f59e0b;
}

/* ========== КНОПКИ В ШАПКЕ ========== */
.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: #f97316;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: #f1f5f9;
}

/* ========== ВОЛЛ КАНВАС ========== */
.wall-canvas-container {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  overflow-x: auto;
  text-align: center;
}

canvas {
  display: block;
  margin: 0 auto;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: crosshair;
  max-width: 100%;
  height: auto;
}

.wall-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.wall-btn {
  padding: 8px 16px;
  background: #f1f5f9;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.wall-btn.active {
  background: #f97316;
  color: white;
}

/* ========== АДАПТАЦИЯ ========== */
@media (max-width: 480px) {
  .project-header h3, .room-header h3 {
    font-size: 15px;
  }
  
  .project-actions, .room-actions {
    gap: 6px;
  }
  
  .project-btn, .room-btn {
    padding: 4px 10px;
    font-size: 11px;
  }
  
  .coord-inputs {
    flex-direction: column;
    gap: 8px;
  }
  
  .wall-controls {
    justify-content: center;
  }
  
  .wall-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}