/* =============================================
   COMPONENTS - Buttons, Cards, Tables, Forms, etc.
   ============================================= */

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 8px 18px;
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg, .btn i { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
  color: white;
  box-shadow: 0 2px 8px rgba(6,182,212,0.25);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-500), var(--primary-400)); box-shadow: 0 4px 16px rgba(6,182,212,0.35); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent-600), var(--accent-500));
  color: white;
  box-shadow: 0 2px 8px rgba(59,130,246,0.25);
}
.btn-accent:hover { background: linear-gradient(135deg, var(--accent-500), var(--accent-400)); }

.btn-success {
  background: linear-gradient(135deg, var(--success-600), var(--success-500));
  color: white;
}
.btn-success:hover { background: linear-gradient(135deg, var(--success-500), var(--success-400)); }

.btn-danger {
  background: linear-gradient(135deg, var(--danger-600), var(--danger-500));
  color: white;
}
.btn-danger:hover { background: linear-gradient(135deg, var(--danger-500), var(--danger-400)); }

.btn-warning {
  background: linear-gradient(135deg, var(--warning-600), var(--warning-500));
  color: var(--text-inverse);
}

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

.btn-outline {
  background: transparent;
  color: var(--primary-400);
  border: 1px solid var(--primary-600);
}
.btn-outline:hover { background: rgba(6,182,212,0.1); }

.btn-sm { padding: 5px 12px; font-size: var(--text-xs); }
.btn-lg { padding: 12px 28px; font-size: var(--text-lg); }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 4px; }

/* --- CARDS --- */
.card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  transition: all var(--transition-base);
}
.card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-glow); }
.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.card-header h2, .card-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}
.card-body { padding: var(--space-6); }
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-primary);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Stat card */
.stat-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  border-radius: 0 4px 4px 0;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.stat-card.teal::before { background: linear-gradient(to bottom, var(--primary-400), var(--primary-600)); }
.stat-card.blue::before { background: linear-gradient(to bottom, var(--accent-400), var(--accent-600)); }
.stat-card.green::before { background: linear-gradient(to bottom, var(--success-400), var(--success-600)); }
.stat-card.orange::before { background: linear-gradient(to bottom, var(--orange-400), var(--orange-600)); }
.stat-card.purple::before { background: linear-gradient(to bottom, var(--purple-400), var(--purple-600)); }

.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: var(--space-4);
}
.stat-card.teal .stat-icon { background: rgba(6,182,212,0.12); color: var(--primary-400); }
.stat-card.blue .stat-icon { background: rgba(59,130,246,0.12); color: var(--accent-400); }
.stat-card.green .stat-icon { background: rgba(34,197,94,0.12); color: var(--success-400); }
.stat-card.orange .stat-icon { background: rgba(249,115,22,0.12); color: var(--orange-400); }
.stat-card.purple .stat-icon { background: rgba(168,85,247,0.12); color: var(--purple-400); }

.stat-card .stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* --- FORMS --- */
.form-group { margin-bottom: var(--space-5); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.form-label.required::after { content: ' *'; color: var(--danger-500); }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 14px;
  font-family: var(--font-family);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.12);
  background: var(--bg-card-solid);
}
[data-theme="dark"] .form-input:focus, [data-theme="dark"] .form-select:focus, [data-theme="dark"] .form-textarea:focus {
  background: rgba(15, 23, 42, 0.8);
}
.form-input::placeholder { color: var(--text-tertiary); }
.form-input.error { border-color: var(--danger-500); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; 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='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-select option { background: var(--bg-dropdown); color: var(--text-primary); }
.form-error { font-size: var(--text-xs); color: var(--danger-500); margin-top: var(--space-1); }
.form-hint { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: var(--space-1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); }

.form-input-sm { padding: 6px 10px; font-size: var(--text-sm); }

/* Search input */
.search-input-wrap {
  position: relative;
}
.search-input-wrap .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  width: 16px; height: 16px;
  pointer-events: none;
}
.search-input-wrap .form-input {
  padding-left: 36px;
}

/* --- TABLES --- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--bg-card-hover);
  border-bottom: 1px solid var(--border-primary);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-primary);
  color: var(--text-primary);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--bg-table-hover); }
.table tbody tr:nth-child(even) { background: var(--bg-table-stripe); }
.table tbody tr:nth-child(even):hover { background: var(--bg-table-hover); }
.table td.actions { white-space: nowrap; }

/* --- BADGES --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.badge-success { background: rgba(34,197,94,0.12); color: var(--success-400); }
.badge-warning { background: rgba(234,179,8,0.12); color: var(--warning-400); }
.badge-danger { background: rgba(239,68,68,0.12); color: var(--danger-400); }
.badge-info { background: rgba(59,130,246,0.12); color: var(--accent-400); }
.badge-purple { background: rgba(168,85,247,0.12); color: var(--purple-400); }
.badge-teal { background: rgba(6,182,212,0.12); color: var(--primary-400); }
.badge-orange { background: rgba(249,115,22,0.12); color: var(--orange-400); }
.badge-gray { background: rgba(100,116,139,0.12); color: var(--text-tertiary); }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Status badges for bookings */
.status-reserved { background: rgba(249,115,22,0.12); color: var(--orange-400); }
.status-confirmed { background: rgba(59,130,246,0.12); color: var(--accent-400); }
.status-checked-in { background: rgba(168,85,247,0.12); color: var(--purple-400); }
.status-checked-out { background: rgba(34,197,94,0.12); color: var(--success-400); }
.status-cancelled { background: rgba(100,116,139,0.12); color: var(--text-tertiary); }

/* --- AVATAR --- */
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-600), var(--accent-500));
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: var(--text-sm);
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: var(--text-xs); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-lg); }
.avatar-xl { width: 64px; height: 64px; font-size: var(--text-2xl); }

/* --- MODAL --- */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  animation: fadeIn 0.2s ease-out;
}
.modal {
  background: var(--bg-modal);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 640px;
  animation: scaleIn 0.25s ease-out;
  position: relative;
}
.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1100px; }
.modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-size: var(--text-xl); font-weight: 600; }
.modal-close {
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 24px; cursor: pointer;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.modal-body { padding: var(--space-6); max-height: 70vh; overflow-y: auto; }
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-primary);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* --- TOAST --- */
.toast-container {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}
.toast {
  background: var(--bg-modal);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  pointer-events: auto;
  animation: slideInRight 0.3s ease-out;
  border-left: 3px solid;
}
.toast-success { border-left-color: var(--success-500); }
.toast-error { border-left-color: var(--danger-500); }
.toast-warning { border-left-color: var(--warning-500); }
.toast-info { border-left-color: var(--accent-500); }
.toast-message { flex: 1; font-size: var(--text-sm); }
.toast-close {
  background: none; border: none;
  color: var(--text-tertiary); cursor: pointer;
  font-size: 16px; padding: 0;
}

/* --- TABS --- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-primary);
  gap: 0;
  overflow-x: auto;
}
.tab {
  padding: 10px 20px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-family);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary-400); border-bottom-color: var(--primary-500); }
.tab-content { padding: var(--space-6) 0; }

/* --- PAGINATION --- */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: center;
  padding: var(--space-4) 0;
}
.pagination button {
  width: 34px; height: 34px;
  border: 1px solid var(--border-primary);
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  font-family: var(--font-family);
  transition: all var(--transition-fast);
  display: flex; align-items: center; justify-content: center;
}
.pagination button:hover { border-color: var(--border-hover); color: var(--text-primary); }
.pagination button.active { background: var(--primary-600); color: white; border-color: var(--primary-600); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

/* --- DROPDOWN --- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: 100%; right: 0;
  min-width: 180px;
  background: var(--bg-dropdown);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  padding: var(--space-2);
  animation: slideDown 0.2s ease-out;
  display: none;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 12px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-family);
}
.dropdown-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.dropdown-divider { height: 1px; background: var(--border-primary); margin: var(--space-2) 0; }

/* --- EMPTY STATE --- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-tertiary);
}
.empty-state-icon { font-size: 48px; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state-title { font-size: var(--text-lg); font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state-desc { font-size: var(--text-sm); max-width: 400px; margin: 0 auto; }

/* --- LOADING OVERLAY --- */
.loading-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}
[data-theme="dark"] .loading-overlay { background: rgba(10, 14, 26, 0.7); }
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

/* --- TOOLTIP --- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%; left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--bg-tooltip);
  color: var(--text-primary);
  font-size: var(--text-xs);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  box-shadow: var(--shadow-md);
}
[data-tooltip]:hover::after { opacity: 1; }
