/**
 * Shared Styles for SPA Apps
 * Used by Home, Decks, Workshop, Admin, and About apps
 * 
 * This ensures consistent styling across all website apps (not participant/facilitator)
 * 
 * Design System:
 * - Primary buttons: Orange (#f59e0b)
 * - Secondary buttons: Grey (#6b7280)
 * - Accent colors: Orange for active states
 * - Typography: Segoe UI, Tahoma, Geneva, Verdana, sans-serif
 */

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
  /* Brand colors */
  --color-primary: #f59e0b;
  --color-primary-hover: #d97706;
  --color-secondary: #6b7280;
  --color-secondary-hover: #4b5563;
  
  /* Text colors */
  --color-text-primary: #111827;
  --color-text-secondary: #6b7280;
  --color-text-muted: #9ca3af;
  
  /* Background colors */
  --bg-white: #ffffff;
  --bg-gray-50: #f9fafb;
  --bg-gray-100: #f3f4f6;
  --bg-gray-200: #e5e7eb;
  
  /* Border colors */
  --border-gray: #e5e7eb;
  --border-gray-dark: #d1d5db;
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 24px;
  
  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--color-text-primary);
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  color: var(--color-text-primary);
}

h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

.muted {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.code {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 2px;
}

.link {
  color: #2563eb;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

/* ============================================
   BUTTONS - Standardized orange/grey theme
   ============================================ */

.btn {
  appearance: none;
  border: 1px solid #f59e0b;
  background: #f59e0b;
  color: white;
  border-radius: 8px;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: #d97706;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Secondary button - grey */
.btn.secondary {
  background: #6b7280;
  border-color: #6b7280;
  color: white;
}

.btn.secondary:hover:not(:disabled) {
  background: #4b5563;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.btn.secondary:disabled {
  background: #6b7280;
  opacity: 0.5;
}

/* Loading state */
.btn.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.85;
}

.btn.loading::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Large button variant - for landing pages/CTAs */
.btn-large {
  padding: 12px 24px;
  font-size: 16px;
}

/* Small button variant - for compact toolbars */
.btn-small {
  padding: 6px 12px;
  font-size: 14px;
}

/* ============================================
   PANELS
   ============================================ */

.panel {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 24px;
}

.panel.min-tall {
  min-height: calc(100vh - 120px);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e5e7eb;
}

.panel-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #111827;
}

.subpanel {
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  padding: 16px;
}

/* ============================================
   CONTAINER
   ============================================ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* ============================================
   TABS
   ============================================ */

.tabs-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e5e7eb;
}

.tab-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: #374151;
}

.tab-btn.active {
  color: #f59e0b;
  border-bottom-color: #f59e0b;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 6px;
  background: #374151;
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 10000;
  transition: opacity 0.3s, transform 0.3s;
}

.toast.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.toast.success {
  background: #10b981;
}

.toast.error {
  background: #ef4444;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

/* ============================================
   COMMON UTILITIES
   ============================================ */

.row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.col {
  flex: 1;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.card {
  border: 1px solid var(--border-gray);
  border-radius: 10px;
  padding: 12px;
  background: var(--bg-white);
}

.kvs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.kv {
  background: var(--bg-gray-100);
  border: 1px solid var(--border-gray);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--color-text-primary);
}

/* ============================================
   TOGGLE SWITCHES
   ============================================ */

.switch {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 28px;
}

.switch .slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background: var(--color-primary);
  box-shadow: inset 0 0 0 1px var(--color-primary-hover);
}

.switch input:checked + .slider:before {
  transform: translateX(26px);
}

/* Disabled switches: show a distinct "locked" state (different from off) */
.switch input:disabled + .slider {
  background: var(--bg-gray-200);
  box-shadow: inset 0 0 0 1px var(--border-gray-dark);
  cursor: not-allowed;
  opacity: 0.9;
}
.switch input:disabled + .slider:before {
  background: var(--bg-gray-100);
}
/* Disabled + checked: show a muted "on" */
.switch input:disabled:checked + .slider {
  background: rgba(245, 158, 11, 0.45); /* var(--color-primary) with opacity */
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.45); /* var(--color-primary-hover) with opacity */
}

/* ============================================
   LIST ITEMS (for Admin, etc.)
   ============================================ */

.user-item,
.product-item {
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 4px;
}

.user-item:hover,
.product-item:hover {
  background: var(--bg-gray-100);
}

.user-item.selected,
.product-item.selected {
  background: #fef3c7;
  border: 1px solid var(--color-primary);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .container {
    padding: 16px;
  }
  
  .panel {
    padding: 16px;
  }
  
  .row {
    flex-direction: column;
  }
}

