/* === RESET & BASE === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Be Vietnam Pro', 'Segoe UI', Tahoma, Arial, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === HEADER === */
.header {
  text-align: center;
  padding: 40px 20px 20px;
  background: linear-gradient(180deg, rgba(255,215,0,0.1) 0%, transparent 100%);
}

.logo-text {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffd700, #ffaa00, #ff6b00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  margin-bottom: 8px;
}

.subtitle {
  color: rgba(255,255,255,0.6);
  font-size: 1rem;
  font-weight: 300;
}

/* === LOGOUT BUTTON === */
.header {
  position: relative;
}

.btn-logout {
  position: absolute;
  top: 20px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  color: rgba(255,255,255,0.6);
  font-family: 'Be Vietnam Pro', 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(255,59,48,0.15);
  border-color: rgba(255,59,48,0.3);
  color: #ff3b30;
}

/* === ACTIONS BAR === */
.actions-bar {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 30px 20px;
  flex-wrap: wrap;
}

/* === BUTTONS === */
.btn {
  padding: 12px 28px;
  border: none;
  border-radius: 12px;
  font-family: 'Be Vietnam Pro', 'Segoe UI', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #1a1a2e;
  box-shadow: 0 4px 15px rgba(255,215,0,0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(255,215,0,0.5);
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: rgba(255,255,255,0.7);
}

.btn-ghost:hover {
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: #ffd700;
  border: 1px dashed #ffd700;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
}

.btn-outline:hover {
  background: rgba(255,215,0,0.1);
}

.btn-glow {
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from { box-shadow: 0 4px 15px rgba(255,215,0,0.3); }
  to { box-shadow: 0 4px 30px rgba(255,215,0,0.6); }
}

.btn-large {
  padding: 16px 40px;
  font-size: 1.2rem;
}

.btn-danger {
  background: rgba(255,59,48,0.2);
  color: #ff3b30;
  border: 1px solid rgba(255,59,48,0.3);
}

.btn-danger:hover {
  background: rgba(255,59,48,0.3);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* === MAIN CONTENT === */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* === WHEELS GRID === */
.wheels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  opacity: 0.6;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

/* === WHEEL CARD === */
.wheel-card {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s ease;
}

.wheel-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  border-color: rgba(255,215,0,0.3);
}

.wheel-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.wheel-card .card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffd700;
  word-break: break-word;
}

.wheel-card .card-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.card-status.active {
  background: rgba(52,199,89,0.2);
  color: #34c759;
}

.card-status.inactive {
  background: rgba(255,59,48,0.2);
  color: #ff3b30;
}

.wheel-card .card-meta {
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.wheel-card .card-meta span {
  margin-right: 16px;
}

.wheel-card .card-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.card-items .item-tag {
  background: rgba(255,255,255,0.1);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.item-tag .color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.wheel-card .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* === MODAL === */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(5px);
  z-index: 1000;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  overflow-y: auto;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: linear-gradient(135deg, #1e1e3a, #2a2a4a);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 600px;
  position: relative;
  margin: 40px auto;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal-close:hover {
  background: rgba(255,59,48,0.3);
}

/* === WIZARD === */
.wizard-modal {
  max-width: 650px;
}

.wizard-progress {
  margin-bottom: 24px;
}

.progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  margin-bottom: 12px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffd700, #ff8c00);
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 25%;
}

.steps-indicator {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s;
}

.step-dot.active {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #1a1a2e;
}

.step-dot.done {
  background: #34c759;
  color: #fff;
}

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.wizard-step h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: #ffd700;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
}

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: #fff;
  font-family: 'Be Vietnam Pro', 'Segoe UI', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #ffd700;
}

.form-group small {
  display: block;
  margin-top: 4px;
  color: rgba(255,255,255,0.4);
  font-size: 0.8rem;
}

.form-group input[type="color"] {
  width: 50px;
  height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-row span {
  color: rgba(255,255,255,0.4);
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #ffd700;
}

.required {
  color: #ff3b30;
}

/* === ITEMS LIST (Step 2) === */
.percentage-counter {
  padding: 10px 16px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  text-align: center;
  transition: background 0.3s;
}

.percentage-counter.warning {
  background: rgba(255,204,0,0.15);
  color: #ffcc00;
}

.percentage-counter.error {
  background: rgba(255,59,48,0.15);
  color: #ff3b30;
}

.percentage-counter.perfect {
  background: rgba(52,199,89,0.15);
  color: #34c759;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 80px 46px 70px 38px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  margin-bottom: 8px;
}

.item-row input[type="text"] {
  padding: 8px 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #fff;
  font-family: 'Be Vietnam Pro', 'Segoe UI', sans-serif;
  font-size: 0.85rem;
}

.item-row input[type="number"] {
  padding: 8px 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #fff;
  font-family: 'Be Vietnam Pro', 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  text-align: center;
}

.item-row input[type="color"] {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  padding: 0;
}

.item-row .btn-remove {
  background: rgba(255,59,48,0.2);
  border: none;
  color: #ff3b30;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-row .btn-remove:hover {
  background: rgba(255,59,48,0.4);
}

/* Image upload cell */
.image-upload-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-upload {
  width: 48px;
  height: 48px;
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  overflow: hidden;
}

.btn-upload:hover {
  border-color: #ffd700;
  background: rgba(255,215,0,0.08);
}

.btn-upload.has-image {
  border-style: solid;
  border-color: rgba(255,215,0,0.4);
  padding: 2px;
}

.btn-upload .upload-icon {
  font-size: 1.2rem;
  opacity: 0.6;
}

.btn-upload .img-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 7px;
}

.btn-remove-img {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ff3b30;
  border: none;
  color: #fff;
  font-size: 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  z-index: 2;
}

.btn-remove-img:hover {
  background: #cc0000;
}

.tag-thumb {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
  margin-right: 2px;
}

.items-header {
  display: grid;
  grid-template-columns: 1fr 80px 46px 70px 38px;
  gap: 8px;
  padding: 0 10px 6px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === SETTINGS GRID === */
.settings-grid {
  display: grid;
  gap: 4px;
}

/* === PREVIEW === */
.preview-container {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

#previewCanvas {
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(255,215,0,0.3);
}

.preview-info {
  text-align: center;
  margin-top: 12px;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
}

/* === STATS MODAL === */
.stats-modal {
  max-width: 750px;
}

/* Header */
.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.stats-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffd700;
  margin-bottom: 4px;
}

.stats-wheel-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  word-break: break-word;
}

.btn-reset-stats {
  background: rgba(255,59,48,0.15);
  color: #ff3b30;
  border: 1px solid rgba(255,59,48,0.35);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 16px;
  margin-top: 4px;
}

.btn-reset-stats:hover {
  background: rgba(255,59,48,0.3);
  transform: none;
}

/* Stats grid */
.stats-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

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

.stat-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: #ffd700;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.45);
  margin-top: 4px;
}

/* Date range */
.stats-date-range {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.45);
  margin-bottom: 20px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  text-align: center;
}

/* Section */
.stats-section {
  margin-bottom: 20px;
}

.stats-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

/* New chart */
.stats-chart-new {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-label {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 140px;
  flex-shrink: 0;
  font-size: 0.85rem;
  overflow: hidden;
}

.chart-label span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-track {
  flex: 1;
  height: 26px;
  background: rgba(255,255,255,0.05);
  border-radius: 13px;
  overflow: hidden;
}

.chart-fill {
  height: 100%;
  border-radius: 13px;
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(0,0,0,0.7);
  min-width: 32px;
}

.chart-pct {
  width: 46px;
  text-align: right;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.45);
  flex-shrink: 0;
}

/* History */
.stats-history {
  max-height: 220px;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.07);
}

.stats-history table {
  width: 100%;
  border-collapse: collapse;
}

.stats-history th,
.stats-history td {
  padding: 9px 14px;
  text-align: left;
  font-size: 0.83rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.stats-history th {
  color: rgba(255,255,255,0.4);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  background: #1e1e3a;
}

.stats-history tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

.stats-history tbody tr:last-child td {
  border-bottom: none;
}

.history-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid;
  font-size: 0.82rem;
  font-weight: 600;
}

.history-device {
  color: rgba(255,255,255,0.35);
  font-size: 0.78rem;
  font-family: monospace;
}

/* === QR MODAL === */
.qr-modal {
  max-width: 400px;
  text-align: center;
}

.qr-modal h2 {
  color: #ffd700;
  margin-bottom: 16px;
}

.qr-content img {
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  max-width: 280px;
}

.qr-content .qr-url {
  margin-top: 12px;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  font-size: 0.85rem;
  word-break: break-all;
  color: rgba(255,255,255,0.6);
}

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 12px 24px;
  background: #34c759;
  color: #fff;
  border-radius: 12px;
  font-family: 'Be Vietnam Pro', 'Segoe UI', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 2000;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

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

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .logo-text {
    font-size: 1.8rem;
  }

  .header {
    padding: 24px 16px 16px;
  }

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

  .item-row {
    grid-template-columns: 1fr 60px 40px 56px 34px;
    gap: 4px;
    padding: 8px;
  }

  .items-header {
    grid-template-columns: 1fr 60px 40px 56px 34px;
    gap: 4px;
  }

  .btn-upload {
    width: 42px;
    height: 42px;
  }

  .modal {
    padding: 20px;
    margin: 10px auto;
  }

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

  .chart-label {
    width: 100px;
  }

  .actions-bar {
    padding: 20px 16px;
  }
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}
