/* ========== Component Styles ========== */

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  min-width: 280px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  border-left: 3px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  animation: toastIn 0.25s ease-out;
}
.toast.success { border-left-color: var(--success); }
.toast.success i { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error i { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning i { color: var(--warning); }
.toast.info i { color: var(--primary); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== Modal ===== */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 20, 25, 0.5);
  z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  animation: modalIn 0.25s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  cursor: pointer; color: var(--text-secondary);
  font-size: 16px; padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body {
  padding: 20px; overflow-y: auto;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ===== Drawer ===== */
.drawer-mask {
  position: fixed; inset: 0;
  background: rgba(15, 20, 25, 0.4);
  z-index: 8000;
  animation: fadeIn 0.2s;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 90vw;
  background: #fff;
  box-shadow: -4px 0 16px rgba(0,0,0,0.1);
  z-index: 8001;
  display: flex; flex-direction: column;
  animation: drawerIn 0.25s ease-out;
}
@keyframes drawerIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-title { font-size: 16px; font-weight: 600; }
.drawer-body { flex: 1; padding: 20px; overflow-y: auto; }
.drawer-footer {
  padding: 12px 20px; border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ===== Acceptance panel ===== */
.acc-fab {
  position: fixed;
  right: 24px; bottom: 24px;
  width: 56px; height: 56px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 194, 168, 0.4);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 7000;
  font-size: 22px;
  transition: transform 0.2s;
}
.acc-fab:hover { transform: scale(1.05); }
.acc-fab .acc-fab-badge {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--danger);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border: 2px solid #fff;
}
.acc-panel {
  position: fixed;
  right: 24px; bottom: 92px;
  width: 480px; height: 640px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  z-index: 7001;
  display: flex; flex-direction: column;
  animation: accIn 0.22s ease-out;
}
@keyframes accIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.acc-header {
  padding: 14px 16px;
  background: var(--bg-dark); color: #fff;
  border-radius: 12px 12px 0 0;
  display: flex; align-items: center; justify-content: space-between;
}
.acc-header h3 { font-size: 14px; font-weight: 600; }
.acc-progress {
  padding: 12px 16px;
  background: #F9FAFB;
  border-bottom: 1px solid var(--border-light);
}
.acc-progress-bar {
  height: 6px;
  background: #E5E7EB;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.acc-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.3s;
}
.acc-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.acc-item {
  padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border-light);
}
.acc-item:hover { background: #F9FAFB; }
.acc-item input[type="checkbox"] {
  width: 16px; height: 16px;
  flex-shrink: 0;
  accent-color: var(--primary);
}
.acc-item-text {
  flex: 1; font-size: 12.5px;
  color: var(--text-primary);
}
.acc-item.done .acc-item-text {
  color: var(--text-tertiary);
  text-decoration: line-through;
}
.acc-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  display: flex; gap: 8px;
}
.acc-footer .btn { flex: 1; justify-content: center; }

/* ===== Wizard ===== */
.wizard-steps {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.wizard-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.wizard-step .step-no {
  width: 24px; height: 24px; border-radius: 50%;
  background: #E5E7EB; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.wizard-step.active { color: var(--primary); font-weight: 500; }
.wizard-step.active .step-no { background: var(--primary); color: #fff; }
.wizard-step.done .step-no { background: var(--success); color: #fff; }
.wizard-step-line {
  flex: 1; height: 2px; background: #E5E7EB;
}

/* ===== IF/THEN editor ===== */
.if-then-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background: #F9FAFB;
}
.if-then-block .block-label {
  display: inline-block;
  padding: 2px 10px;
  background: var(--primary);
  color: #fff;
  font-size: 12px; font-weight: 600;
  border-radius: 4px;
  margin-bottom: 8px;
}
.if-then-block.then .block-label { background: var(--secondary); }

/* ===== Device cards ===== */
.device-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
}
.device-card .device-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.device-card .device-name {
  font-weight: 500; font-size: 14px;
}
.device-card .device-meta {
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 10px;
}
.device-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
}

/* ===== Schedule calendar ===== */
.calendar-week {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.calendar-cell {
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 8px;
  min-height: 60px;
  font-size: 11px;
  position: relative;
}
.calendar-cell.head {
  background: #F9FAFB;
  font-weight: 600;
  text-align: center;
  min-height: 40px;
}
.calendar-cell.time-col {
  background: #F9FAFB;
  text-align: center;
  color: var(--text-secondary);
}
.schedule-block {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  margin-bottom: 4px;
  color: var(--primary-dark);
}
.schedule-block.done { opacity: 0.6; text-decoration: line-through; }
.schedule-block.blue { background: var(--secondary-light); border-left-color: var(--secondary); color: var(--secondary); }

/* ===== Dashboard chart container ===== */
.chart-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
}
.chart-card .chart-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
}
.chart-container { width: 100%; height: 280px; }

/* AI suggestion */
.ai-card {
  background: linear-gradient(135deg, #EEF3FF 0%, #E6F9F6 100%);
  border-radius: 8px;
  padding: 14px;
  border: 1px solid #DBE7F5;
}
.ai-card .ai-icon {
  width: 32px; height: 32px;
  background: var(--secondary);
  color: #fff;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Mode buttons */
.mode-btn {
  padding: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  transition: all 0.15s;
}
.mode-btn:hover { border-color: var(--primary); }
.mode-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 500;
}
.mode-btn .mode-icon {
  font-size: 22px; margin-bottom: 6px; display: block;
  color: var(--primary);
}

/* Permission matrix */
.perm-matrix th, .perm-matrix td { text-align: center; }
.perm-matrix .perm-yes { color: var(--success); }
.perm-matrix .perm-view { color: var(--info); }
.perm-matrix .perm-edit { color: var(--warning); }
.perm-matrix .perm-no { color: var(--text-tertiary); }

/* Pack card */
.pack-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
  position: relative;
  transition: box-shadow 0.15s;
}
.pack-card:hover { box-shadow: var(--shadow); }
.pack-card .pack-cover {
  height: 120px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 6px;
  margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 28px;
}
.pack-card.coffee .pack-cover { background: linear-gradient(135deg, #C97B5A, #8B4513); }
.pack-card.rnd .pack-cover { background: linear-gradient(135deg, #4D7CFE, #2D5BCC); }

/* Zone card grid */
.zone-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.zone-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.zone-card .zone-name { font-weight: 500; margin-bottom: 6px; }
.zone-card .zone-meta { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }

/* Timeline */
.timeline { padding-left: 8px; }
.timeline-item {
  position: relative;
  padding-left: 20px;
  padding-bottom: 14px;
  border-left: 2px solid var(--border);
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px; top: 4px;
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
}
.timeline-item:last-child { border-left-color: transparent; }
.timeline-item .time { font-size: 11px; color: var(--text-tertiary); }
.timeline-item .text { font-size: 13px; margin-top: 2px; }
