/* ===== QR Asset ID — Design System ===== */
:root {
  /* Core palette — deep navy + vivid teal */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a1f35;
  --bg-card-hover: #232942;
  --bg-elevated: rgba(30, 41, 82, 0.7);
  --bg-glass: rgba(26, 31, 53, 0.85);
  --bg-input: #0f1422;

  --text-primary: #f0f2f7;
  --text-secondary: #8b95b5;
  --text-muted: #5a6484;

  --accent: #00d4aa;
  --accent-hover: #00f0c0;
  --accent-glow: rgba(0, 212, 170, 0.25);
  --accent-soft: rgba(0, 212, 170, 0.12);

  --danger: #ff4d6a;
  --danger-soft: rgba(255, 77, 106, 0.12);
  --warning: #ffb340;
  --warning-soft: rgba(255, 179, 64, 0.12);
  --info: #5b8def;
  --info-soft: rgba(91, 141, 239, 0.12);
  --success: #00d4aa;

  --border: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(0, 212, 170, 0.5);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px var(--accent-glow);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Pages ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== Login ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 20%, rgba(0, 212, 170, 0.08) 0%, transparent 60%),
              var(--bg-primary);
}

.login-brand {
  text-align: center;
  margin-bottom: 40px;
  animation: fadeSlideUp 0.6s ease-out;
}



.login-brand h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), #5b8def);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-brand p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 8px;
}

.login-form {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  animation: fadeSlideUp 0.6s ease-out 0.1s backwards;
}

.login-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' fill='%238b95b5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #00b894);
  color: #000;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--accent-glow);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text-primary); }

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #e8435c);
  color: #fff;
}

.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }

/* ===== Top Nav ===== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 18px;
  font-weight: 700;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Tab Bar ===== */
.tab-bar {
  display: flex;
  gap: 2px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-secondary); background: var(--bg-card); }
.tab-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.tab-content { display: none; padding: 20px; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

/* ===== QR Scanner ===== */
.scan-container {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

.scan-header {
  margin-bottom: 24px;
}
.scan-header h2 {
  font-size: 22px;
  font-weight: 700;
}
.scan-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.qr-reader-box {
  width: 100%;
  max-width: 360px;
  margin: 0 auto 20px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--border);
  background: #000;
  min-height: 50px;
}

.qr-reader-box video {
  border-radius: var(--radius-lg);
}

.scan-actions {
  margin-bottom: 24px;
}

.manual-input {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.manual-input p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.input-row {
  display: flex;
  gap: 8px;
}
.input-row input { flex: 1; }

/* ===== Scan Result ===== */
.scan-result {
  max-width: 480px;
  margin: 20px auto 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  animation: fadeSlideUp 0.4s ease;
}

.result-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}
.status-blank { background: var(--warning-soft); color: var(--warning); }
.status-registered { background: rgba(0, 212, 170, 0.12); color: var(--accent); }

/* ===== Form Container ===== */
.form-container {
  max-width: 560px;
  margin: 0 auto;
}

.form-header {
  margin-bottom: 24px;
}
.form-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 8px 0 4px;
}

.qr-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

/* ===== Asset List ===== */
.list-header {
  margin-bottom: 20px;
}
.list-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.filter-select {
  min-width: 140px;
}

.asset-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asset-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}
.asset-card:hover {
  background: var(--bg-card-hover);
  transform: translateX(4px);
  border-color: rgba(0, 212, 170, 0.2);
}

.asset-icon {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.asset-info {
  flex: 1;
  min-width: 0;
}
.asset-info h4 {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asset-info p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.asset-meta {
  text-align: right;
  flex-shrink: 0;
}
.asset-meta .code {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}
.asset-meta .value {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}
.pagination button {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  transition: var(--transition);
}
.pagination button:hover { background: var(--bg-card-hover); }
.pagination button.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}

/* ===== Dashboard ===== */
.dashboard h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon { font-size: 24px; margin-bottom: 8px; }
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}
.chart-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chart-bar-label {
  width: 100px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg-elevated);
  border-radius: 6px;
  overflow: hidden;
}
.chart-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), #5b8def);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: #000;
  min-width: fit-content;
}

.chart-bar-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 30px;
  text-align: right;
}

/* ===== Activity list ===== */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.activity-item .activity-icon { font-size: 18px; }
.activity-item .activity-text { flex: 1; color: var(--text-secondary); }
.activity-item .activity-time { font-size: 11px; color: var(--text-muted); }

/* ===== QR Management ===== */
.create-batch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.create-batch-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.batch-form {
  max-width: 600px;
}

.batch-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.batch-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
  flex-wrap: wrap;
  gap: 12px;
}
.batch-card:hover { background: var(--bg-card-hover); }

.batch-info h4 {
  font-size: 15px;
  font-weight: 600;
}
.batch-info p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.batch-stats {
  display: flex;
  gap: 16px;
}
.batch-stat {
  text-align: center;
}
.batch-stat .num {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}
.batch-stat .lbl {
  font-size: 11px;
  color: var(--text-muted);
}

.batch-actions {
  display: flex;
  gap: 8px;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}
.modal-content {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  animation: fadeSlideUp 0.3s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.modal-header h2 { font-size: 18px; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.detail-item label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.detail-item p {
  font-size: 14px;
  font-weight: 500;
  margin-top: 4px;
}
.detail-item.full { grid-column: 1 / -1; }

/* ===== Form Sections ===== */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.section-animate {
  animation: sectionSlideIn 0.35s ease-out;
}

@keyframes sectionSlideIn {
  from { opacity: 0; transform: translateY(-8px); max-height: 0; }
  to { opacity: 1; transform: translateY(0); max-height: 800px; }
}

/* Detail section titles */
.detail-section-title {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

input[type="date"] {
  color-scheme: dark;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease;
  max-width: 360px;
}
.toast-success { background: #065f46; color: #6ee7b7; border: 1px solid #10b981; }
.toast-error { background: #7f1d1d; color: #fca5a5; border: 1px solid #ef4444; }
.toast-info { background: #1e3a5f; color: #93c5fd; border: 1px solid #3b82f6; }

/* ===== Utilities ===== */
.hidden { display: none !important; }

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

.condition-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.condition-good { background: rgba(0, 212, 170, 0.12); color: var(--accent); }
.condition-used { background: var(--warning-soft); color: var(--warning); }
.condition-damaged { background: var(--danger-soft); color: var(--danger); }
.condition-disposed { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .tab-bar { gap: 0; padding: 4px 8px; }
  .tab-btn { padding: 8px 6px; font-size: 12px; }
  .tab-content { padding: 16px; }

  .filter-bar { flex-direction: column; }
  .filter-select { min-width: 100%; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }

  .detail-grid { grid-template-columns: 1fr; }

  .batch-card { flex-direction: column; align-items: flex-start; }
  .batch-stats { width: 100%; justify-content: space-around; }

  .nav-user { display: none; }

  .asset-card { padding: 12px; gap: 10px; }
  .asset-meta { display: none; }
}

@media (max-width: 480px) {
  .login-brand h1 { font-size: 26px; }
  .login-form { padding: 24px 20px; }
  .stat-card .stat-value { font-size: 22px; }
}
