:root {
  /* Sky Blue Dark Palette */
  --bg-color: #081420;
  --bg-sidebar: #0B1B2B;
  --surface: rgba(15, 30, 48, 0.7);
  --surface-hover: rgba(22, 45, 75, 0.8);
  --border-color: rgba(2, 132, 199, 0.3);
  --border-highlight: rgba(56, 189, 248, 0.5);
  
  --primary: #0284C7;
  --primary-hover: #0369A1;
  --secondary: #38BDF8;
  --accent: #FB923C;
  --danger: #EF4444;
  
  --text-main: #F0F9FF;
  --text-muted: #94A3B8;
  
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.15);
  
  --transition: all 0.2s ease;
  --font-sans: 'Inter', system-ui, sans-serif;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow: hidden; /* App layout handles scrolling */
}

/* Utilities */
.hidden { display: none !important; }
.w-full { width: 100%; }
.w-half { width: 50%; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mb-md { margin-bottom: 1rem; }
.text-primary { color: var(--secondary); }
.text-secondary { color: var(--text-muted); }
.text-accent { color: var(--accent); }

/* Glassmorphism */
.glass-panel {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

/* Typography */
h1, h2, h3, h4 { color: var(--text-main); font-weight: 600; }

/* Buttons */
button, .btn-primary, .btn-outline {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.6rem 1rem;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.4);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
  transform: translateY(-1px);
}

.btn-outline {
  border: 1px solid var(--border-highlight);
  color: var(--text-main);
  padding: 0.6rem 1rem;
}
.btn-outline:hover {
  background: rgba(2, 132, 199, 0.15);
  border-color: var(--secondary);
}

.icon-button {
  padding: 0.5rem;
  color: var(--text-muted);
  border-radius: 50%;
}
.icon-button:hover { color: var(--text-main); background: rgba(255,255,255,0.1); }

/* Form Elements */
input[type="text"], input[type="number"], input[type="date"], select.box-select, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
}
input:focus, select.box-select:focus, textarea:focus { border-color: var(--secondary); box-shadow: var(--shadow-glow); }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.form-group label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.form-row { display: flex; gap: 1rem; }

.input-prefix {
  position: relative;
  display: flex;
  align-items: center;
}
.input-prefix span {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
}
.input-prefix input { padding-left: 1.75rem; }

/* Select standard styling */
.glass-select {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2338BDF8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

/* Layout */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 10;
  border-radius: 0;
}

.sidebar-header { padding: 1.5rem 1.5rem 2rem; }
.logo { display: flex; align-items: center; gap: 0.75rem; }
.logo h2 { font-size: 1.1rem; }

.sidebar-menu { flex: 1; padding: 0 1rem; }
.nav-list { list-style: none; display: flex; flex-direction: column; gap: 0.25rem; }
.nav-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.nav-item.active {
  background: rgba(2, 132, 199, 0.2);
  color: var(--secondary);
  border-left: 3px solid var(--secondary);
}

.sidebar-footer { padding: 1.5rem; }

/* Main Workspace */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.workspace-header {
  border-radius: 0;
  border-left: none; border-right: none; border-top: none;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  width: 300px;
}
.search-bar svg { position: absolute; left: 0.75rem; color: var(--text-muted); }
.search-bar input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 999px;
}

.header-controls { font-size: 0.75rem; color: var(--text-muted); }

/* View Panels */
.view-panel {
  flex: 1;
  padding: 2rem;
  display: none;
  overflow-y: auto;
}
.view-panel.active { display: block; }
.view-panel::-webkit-scrollbar { width: 6px; }
.view-panel::-webkit-scrollbar-thumb { background: var(--border-highlight); border-radius: 4px; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.stat-card h3 { font-size: 0.875rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; }
.stat-value { font-size: 2rem; font-weight: 700; }
.stat-card.highlight { border-color: var(--primary); background: rgba(2, 132, 199, 0.1); }
.stat-desc { font-size: 0.8rem; color: var(--text-muted); }

/* Item Grid (Cards) */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}
.item-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-glow); border-color: var(--secondary); }

.item-img-container {
  height: 140px;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.item-img-container img { width: 100%; height: 100%; object-fit: cover; }
.item-placeholder { color: var(--text-muted); opacity: 0.5; }

.item-info { padding: 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.item-title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.item-room { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.item-val { font-weight: 700; color: var(--secondary); margin-top: 0.4rem; font-size: 1.1rem; }

/* Table View */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th {
  padding: 1rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}
.data-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: middle;
}
.data-table tr:hover { background: rgba(255,255,255,0.02); }

.td-photo img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; }
.td-name { font-weight: 500; display: flex; flex-direction: column; }
.td-cat { font-size: 0.75rem; color: var(--text-muted); }
.td-val { font-family: monospace; font-size: 1rem; font-weight: 600; }

.filter-group { display: flex; gap: 0.5rem; }

/* Rooms Checklists Grid */
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.room-card { padding: 1.5rem; }
.room-card h3 { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.5rem; margin-bottom: 1rem; }
.room-val { color: var(--secondary); font-size: 0.9rem; }
.room-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.85rem;}
.room-list li { display: flex; justify-content: space-between; color: var(--text-muted); }

/* Export Cards */
.export-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.padded-card { padding: 2rem; }
.btn-group { display: flex; gap: 1rem; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal.hidden { display: none !important; }

.modal-content {
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}
.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
}

.photo-uploader {
  width: 100%;
  aspect-ratio: 1;
  background: rgba(0,0,0,0.3);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}
.photo-uploader:hover { border-color: var(--secondary); background: rgba(56, 189, 248, 0.1); }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; color: var(--text-muted); font-size: 0.85rem;}
#photoPreview { width: 100%; height: 100%; object-fit: cover; }

/* Tooltips */
.tooltip { position: relative; }
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: var(--text-main);
  color: var(--bg-color);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}
.tooltip:hover::after { opacity: 1; transform: translateX(-50%) translateY(8px); }

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-main);
  color: var(--bg-color);
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  z-index: 2000;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
}
.toast.hidden { transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; }

/* Scanner Specific */
#reader { width: 100%; overflow: hidden; border-radius: var(--radius-sm); }

@media(max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border-color); flex-direction: row; align-items: center; justify-content: space-between; padding: 0.5rem 1rem;}
  .sidebar-header { padding: 0.5rem; }
  .logo h2 { display: none; }
  .sidebar-menu { display: none; /* simple mobile nav */ }
  .form-grid { grid-template-columns: 1fr; gap: 1rem; }
  .photo-uploader { max-width: 200px; margin: 0 auto; }
}
