/* ============================================
   NexHome Components
   Shared UI components — Dark Enterprise Theme
   Tokens: design-system.css
   ============================================ */

/* ============================================
   1. BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0) scale(0.97);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

/* Primary — gradient cyan-to-indigo */
.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.35), 0 0 40px rgba(129, 140, 248, 0.2);
}

/* Secondary */
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-md);
}

/* Danger */
.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-danger:hover {
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

/* Success */
.btn-success {
  background: var(--color-success);
  color: #fff;
}

.btn-success:hover {
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}

/* Ghost — transparent with border */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.btn-ghost:hover {
  color: var(--text-accent);
  border-color: var(--border-accent);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

/* Gradient */
.btn-gradient {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
}

.btn-gradient:hover {
  box-shadow: 0 6px 24px rgba(0, 212, 255, 0.4), 0 0 40px rgba(99, 102, 241, 0.2);
}

/* Sizes */
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

/* Icon-only */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

.btn-icon.btn-lg {
  width: 52px;
  height: 52px;
}

/* Loading state */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   2. CARDS
   ============================================ */
.card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.card-body {
  padding: var(--space-5) var(--space-6);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

/* Stat Card */
.stat-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.stat-card .stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-card .stat-content {
  display: flex;
  flex-direction: column;
}

.stat-card .stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* StatCard component classes */
.stat-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-card-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.stat-card-trend {
  font-size: 0.85rem;
  font-weight: 600;
}

.stat-card-trend.trend-up {
  color: var(--color-success);
}

.stat-card-trend.trend-down {
  color: var(--color-danger);
}

/* Device Card */
.device-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.device-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.device-card .card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.device-card .card-header .device-icon {
  font-size: 1.25rem;
  color: var(--accent-cyan);
}

.device-card .card-header .device-title {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.device-card .card-body {
  padding: var(--space-5);
}

/* DeviceCard component classes */
.device-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
}

.device-card-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.device-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.device-card-icon.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
}

.device-active .device-card-icon {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
}

.device-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.device-card-status {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.device-card-controls {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
}

.device-active {
  border-color: rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.08);
  background: rgba(56, 189, 248, 0.03);
}

/* Sensor Card */
.sensor-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-6);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: box-shadow var(--transition-normal);
}

.sensor-card:hover {
  box-shadow: var(--shadow-glow);
}

.sensor-card .gauge-area {
  width: 100px;
  height: 100px;
  margin-bottom: var(--space-4);
  position: relative;
}

.sensor-card .sensor-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.sensor-card .sensor-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-2);
}

/* Scene Card */
.scene-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal), transform var(--transition-fast);
}

.scene-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.scene-card.active {
  background: rgba(56, 189, 248, 0.05);
}

.scene-card .scene-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.scene-card .scene-info {
  flex: 1;
  min-width: 0;
}

.scene-card .scene-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.scene-card .scene-description {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* SceneCard component classes (matching template) */
.scene-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.scene-card-info {
  flex: 1;
  min-width: 0;
}

.scene-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.scene-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   3. TOGGLE SWITCH
   ============================================ */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 48px;
  height: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition-normal), border-color var(--transition-normal);
  flex-shrink: 0;
  padding: 0;
}

.toggle-knob {
  display: block;
  width: 18px;
  height: 18px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform var(--transition-normal), background var(--transition-normal);
  margin-left: 2px;
}

.toggle-switch.active {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  border-color: transparent;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.toggle-switch.active .toggle-knob {
  transform: translateX(24px);
  background: #fff;
}

.toggle-sm {
  width: 36px;
  height: 18px;
  border-radius: 9px;
}

.toggle-sm .toggle-knob {
  width: 14px;
  height: 14px;
}

.toggle-sm.active .toggle-knob {
  transform: translateX(18px);
}

.toggle-lg {
  width: 56px;
  height: 28px;
  border-radius: 14px;
}

.toggle-lg .toggle-knob {
  width: 22px;
  height: 22px;
}

.toggle-lg.active .toggle-knob {
  transform: translateX(28px);
}

.toggle-switch.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ============================================
   4. SLIDER
   ============================================ */
.slider-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.slider-container .slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-container .slider-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.slider-container .slider-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-accent);
  font-family: var(--font-mono);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent-cyan);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
  cursor: pointer;
  transition: box-shadow var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent-cyan);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
  cursor: pointer;
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
}

.slider-input {
  background: linear-gradient(to right, var(--slider-color, var(--accent-cyan)) 0%, var(--slider-color, var(--accent-cyan)) var(--slider-pct, 0%), var(--bg-elevated) var(--slider-pct, 0%), var(--bg-elevated) 100%) !important;
}

/* ============================================
   5. BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.6;
  border-radius: 9999px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
  border-color: rgba(34, 197, 94, 0.25);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.25);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-info);
  border-color: rgba(59, 130, 246, 0.25);
}

.badge-online {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
  border-color: rgba(34, 197, 94, 0.25);
}

.badge-online::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
}

.badge-offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.badge-offline::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-danger);
}

/* ============================================
   6. MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
}

.modal {
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  will-change: transform, opacity;
}

/* Vue transition classes for modal */
.modal-enter-active,
.modal-leave-active {
  transition: opacity 0.18s ease;
}
.modal-enter-active .modal,
.modal-leave-active .modal {
  transition: transform 0.18s ease;
}
.modal-enter-from,
.modal-leave-to {
  opacity: 0;
}
.modal-enter-from .modal {
  transform: translateY(24px) scale(0.96);
}
.modal-leave-to .modal {
  transform: translateY(12px) scale(0.98);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

/* ============================================
   7. FORM ELEMENTS
   ============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Input with icon */
.input-icon {
  position: relative;
}

.input-icon .form-input {
  padding-left: var(--space-10);
}

.input-icon i,
.input-icon svg,
.input-icon .icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

/* ============================================
   8. TABLE
   ============================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table thead {
  background: var(--bg-elevated);
}

.data-table thead th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table tbody tr {
  border-top: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.data-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:hover {
  background: rgba(0, 212, 255, 0.04);
}

.data-table tbody td {
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ============================================
   9. TOAST / NOTIFICATION
   ============================================ */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: 400px;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  pointer-events: auto;
}

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
  pointer-events: auto;
}

.toast-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

/* Vue transition-group classes */
.toast-enter-active {
  transition: all 0.3s ease;
}
.toast-leave-active {
  transition: all 0.3s ease;
}
.toast-enter-from {
  opacity: 0;
  transform: translateX(100%);
}
.toast-leave-to {
  opacity: 0;
  transform: translateX(100%);
}
.toast-move {
  transition: transform 0.3s ease;
}

.toast-success {
  border-left: 3px solid var(--color-success);
}

.toast-error {
  border-left: 3px solid var(--color-danger);
}

.toast-warning {
  border-left: 3px solid var(--color-warning);
}

.toast-info {
  border-left: 3px solid var(--color-info);
}

/* ============================================
   10. TABS
   ============================================ */
.tabs {
  display: flex;
  flex-direction: column;
}

.tabs-header {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.tab-item {
  position: relative;
  padding: var(--space-3) var(--space-5);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast);
  border: none;
  background: none;
}

.tab-item:hover {
  color: var(--text-secondary);
}

.tab-item.active {
  color: var(--text-accent);
}

.tab-item.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-cyan);
  border-radius: 1px 1px 0 0;
}

.tab-content {
  padding: var(--space-5) 0;
}

.tab-content > .tab-pane {
  display: none;
}

.tab-content > .tab-pane.active {
  display: block;
}

/* ============================================
   11. DROPDOWN
   ============================================ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  padding: var(--space-1) 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.dropdown.open .dropdown-menu,
.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Vue transition classes for dropdown */
.dropdown-enter-active,
.dropdown-leave-active {
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.dropdown-enter-from,
.dropdown-leave-to {
  opacity: 0;
  transform: translateY(-4px);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-4);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  border: none;
  background: none;
  text-align: left;
}

.dropdown-item:hover {
  background: rgba(0, 212, 255, 0.06);
  color: var(--text-primary);
}

/* ============================================
   12. PROGRESS BAR
   ============================================ */
.progress {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-sm { height: 4px; }
.progress-lg { height: 10px; }

.progress-label {
  position: absolute;
  right: 0;
  top: -18px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--gradient-primary);
  transition: width var(--transition-slow);
}

.progress-bar-success {
  background: var(--color-success);
}

.progress-bar-warning {
  background: var(--color-warning);
}

.progress-bar-danger {
  background: var(--color-danger);
}

/* ============================================
   13. CIRCULAR GAUGE
   ============================================ */
.gauge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gauge-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.gauge-circle {
  transform: rotate(-90deg);
}

.gauge-circle .gauge-track {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 6;
}

.gauge-circle .gauge-fill {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--transition-slow);
}

.gauge-circle .gauge-fill.success {
  stroke: var(--color-success);
}

.gauge-circle .gauge-fill.warning {
  stroke: var(--color-warning);
}

.gauge-circle .gauge-fill.danger {
  stroke: var(--color-danger);
}

.gauge-center {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.gauge-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.2;
  white-space: nowrap;
}

.gauge-center .gauge-value {
  position: static;
}

.gauge-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 2px;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   14. SKELETON LOADING
   ============================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-circle {
  border-radius: 50%;
}

.skeleton-card {
  height: 160px;
  border-radius: var(--radius-lg);
}

/* ============================================
   15. ALERT PANEL
   ============================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--border-default);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.alert .alert-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1.4;
}

.alert .alert-message {
  flex: 1;
  line-height: 1.5;
}

.alert-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.alert-content {
  flex: 1;
}

.alert-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

.alert-dismiss:hover {
  color: var(--text-primary);
}

.alert-success {
  border-left-color: var(--color-success);
  background: rgba(34, 197, 94, 0.06);
}

.alert-success .alert-icon {
  color: var(--color-success);
}

.alert-warning {
  border-left-color: var(--color-warning);
  background: rgba(245, 158, 11, 0.06);
}

.alert-warning .alert-icon {
  color: var(--color-warning);
}

.alert-danger {
  border-left-color: var(--color-danger);
  background: rgba(239, 68, 68, 0.06);
}

.alert-danger .alert-icon {
  color: var(--color-danger);
}

/* ============================================
   16. LANGUAGE SWITCH
   ============================================ */
.lang-switch {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.lang-option {
  padding: var(--space-1) var(--space-3);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  border: none;
  background: none;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.lang-option:hover {
  color: var(--text-secondary);
}

.lang-option.active {
  background: var(--accent-cyan);
  color: var(--bg-base);
}

.lang-divider {
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0 2px;
}

/* ============================================
   17. CONNECTION STATUS INDICATOR
   ============================================ */
.connection-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.connection-label {
  white-space: nowrap;
}

.connection-status.connected {
  color: var(--color-success);
}

.connection-status.connected .connection-dot {
  background: var(--color-success);
  animation: connection-pulse 2s ease-in-out infinite;
}

.connection-status.disconnected {
  color: var(--color-danger);
}

.connection-status.disconnected .connection-dot {
  background: var(--color-danger);
}

@keyframes connection-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0);
  }
}

/* ============================================
   18. CUSTOM SCROLLBAR (scoped containers)
   ============================================ */
.custom-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.custom-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

.custom-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* ============================================
   19. ACCESSIBILITY & INTERACTION ENHANCEMENTS
   ============================================ */

/* Focus visibility - WCAG AAA compliant */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Unified cursor styles */
button,
a,
[role="button"],
.clickable,
.sidebar-nav-item,
.device-card,
.scene-card,
.note-item,
.status-card-header,
.device-mini-card,
.fp-zone,
.fp-toolbar-btn {
  cursor: pointer;
}

button:disabled,
[aria-disabled="true"],
[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Enhanced button hover states */
button:not(:disabled):hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Card hover states with transform */
.device-card:hover,
.scene-card:hover,
.device-mini-card:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.15);
  transform: translateY(-2px);
}

/* Touch feedback for mobile devices */
@media (hover: none) {
  button:active,
  .clickable:active,
  .sidebar-nav-item:active {
    transform: scale(0.98);
    opacity: 0.8;
  }

  .device-card:active,
  .scene-card:active {
    transform: scale(0.98);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mobile touch targets - minimum 44x44px */
@media (max-width: 768px) {
  button,
  .clickable,
  .sidebar-nav-item {
    min-height: 44px;
    min-width: 44px;
  }

  .btn-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Remove hover effects on touch devices */
  .device-card:hover,
  .scene-card:hover {
    transform: none;
  }

  /* Use active state instead */
  .device-card:active,
  .scene-card:active {
    background: rgba(0, 212, 255, 0.1);
  }
}
