/* ============================================
   Hola AI Dashboard - Mobile-First CSS
   Claude.ai inspired colors & aesthetic
   ============================================ */

/* CSS Custom Properties */
:root {
  /* Claude-inspired Colors - Warm & Elegant */
  --bg-primary: #FAF7F2;
  --bg-secondary: #F5F0E8;
  --bg-card: #FFFFFF;
  --bg-hover: #EBE4D8;
  
  /* Accent - Claude's Warm Tan/Beige */
  --accent: #D97706;
  --accent-hover: #B45309;
  --accent-light: #FEF3C7;
  --accent-subtle: rgba(217, 119, 6, 0.1);
  
  /* Text */
  --text-primary: #1C1917;
  --text-secondary: #44403C;
  --text-muted: #78716C;
  
  /* Status */
  --success: #059669;
  --success-subtle: rgba(93, 155, 107, 0.12);
  --warning: #D97706;
  --error: #C45D5D;
  
  /* Borders & Shadows */
  --border: #EBE4D8;
  --border-light: #F5F0E8;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  
  /* Spacing Scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 0.875rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  
  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
  
  /* Layout */
  --header-height: 64px;
  --bottom-nav-height: 72px;
  --max-width: 560px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* ============================================
   Loading Screen
   ============================================ */

.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  z-index: 1000;
  transition: opacity var(--transition-slow);
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-screen p {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* ============================================
   App Container
   ============================================ */

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ============================================
   Mobile Header
   ============================================ */

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.header-logo {
  height: 32px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.user-avatar:hover {
  transform: scale(1.05);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
  flex: 1;
  padding: var(--space-lg);
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-xl));
  overflow-y: auto;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

/* Tab Content */
.tab-content {
  display: none;
  animation: fadeIn var(--transition-base);
}

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

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

/* ============================================
   Greeting Section
   ============================================ */

.greeting {
  margin-bottom: var(--space-xl);
}

.greeting h1 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.subtitle {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
}

.status-online {
  color: var(--success);
  font-weight: 600;
}

/* ============================================
   Cards
   ============================================ */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.card-title {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ============================================
   Credit Card (Special - Claude style)
   ============================================ */

.credit-card {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: white;
  border: none;
  box-shadow: var(--shadow-md);
}

.credit-card .card-title {
  color: rgba(255, 255, 255, 0.85);
}

.tier-badge {
  background: rgba(255, 255, 255, 0.25);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  backdrop-filter: blur(4px);
}

.credit-display {
  text-align: center;
  margin: var(--space-xl) 0;
}

.credit-percentage {
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -2px;
}

.credit-label {
  font-size: var(--font-size-sm);
  opacity: 0.9;
  margin-top: var(--space-sm);
}

.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.progress-fill {
  height: 100%;
  background: white;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.credit-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  opacity: 0.75;
}

/* ============================================
   Stats Row
   ============================================ */

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
}

.stat-value {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   Connections
   ============================================ */

.connection-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.connection-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.connection-item.connected {
  background: var(--success-subtle);
}

.connection-item.coming-soon {
  opacity: 0.5;
}

.connection-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.connection-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.connection-name {
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.connection-status {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.connection-item.connected .connection-status {
  color: var(--success);
}

/* ============================================
   Section Headers
   ============================================ */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.section-header h2 {
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.skill-counter {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

/* ============================================
   Skills
   ============================================ */

.skill-group {
  margin-bottom: var(--space-xl);
}

.group-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.skills-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.skill-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.skill-item.enabled {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.skill-item.default {
  background: var(--bg-secondary);
  border-color: transparent;
}

.skill-icon {
  font-size: 24px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.skill-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.skill-name {
  font-weight: 600;
  font-size: var(--font-size-base);
}

.skill-desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.skill-badge {
  font-size: var(--font-size-xs);
  color: var(--accent);
  background: var(--accent-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 32px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ============================================
   Model Selector
   ============================================ */

.model-selector {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.model-option {
  display: flex;
  align-items: center;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px solid transparent;
}

.model-option:hover:not(.locked) {
  background: var(--bg-hover);
}

.model-option.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.model-option.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.model-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.model-name {
  font-weight: 600;
  font-size: var(--font-size-base);
}

.model-desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.model-lock, .model-check {
  font-size: var(--font-size-lg);
}

.model-check {
  color: var(--accent);
  font-weight: 700;
}

.hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

/* ============================================
   Personality Input
   ============================================ */

.personality-input {
  width: 100%;
  min-height: 120px;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--font-size-base);
  resize: vertical;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  background: var(--bg-secondary);
}

.personality-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: var(--bg-card);
}

/* ============================================
   Account Info
   ============================================ */

.account-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.account-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  font-size: var(--font-size-sm);
  border-bottom: 1px solid var(--border-light);
}

.account-row:last-child {
  border-bottom: none;
}

.account-row span:first-child {
  color: var(--text-muted);
}

.account-row span:last-child {
  font-weight: 600;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary.success {
  background: var(--success);
}

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

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-sm {
  padding: 8px 14px;
  font-size: var(--font-size-xs);
}

.btn-block {
  width: 100%;
}

/* ============================================
   Bottom Navigation - FIXED & CENTERED
   ============================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.nav-item {
  flex: 1;
  max-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-fast);
  text-decoration: none;
}

.nav-item:hover {
  color: var(--text-secondary);
}

.nav-item.active {
  color: var(--accent);
}

.nav-icon {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

.nav-item span:last-child {
  margin-top: 2px;
}

/* ============================================
   Logout Button
   ============================================ */

.logout-btn {
  margin-top: var(--space-lg);
  width: 100%;
  color: var(--error);
  background: transparent;
  border: 1px solid var(--error);
}

.logout-btn:hover {
  background: rgba(196, 93, 93, 0.1);
}

/* ============================================
   Desktop Styles (768px+)
   ============================================ */

@media (min-width: 768px) {
  :root {
    --max-width: 640px;
    --bottom-nav-height: 0px;
  }
  
  .bottom-nav {
    display: none;
  }
  
  .main-content {
    padding: var(--space-xl);
    padding-bottom: var(--space-xl);
  }
  
  .mobile-header {
    justify-content: center;
    position: relative;
  }
  
  .header-left {
    position: absolute;
    left: var(--space-lg);
  }
  
  .header-right {
    position: absolute;
    right: var(--space-lg);
  }
  
  .stats-row {
    gap: var(--space-md);
  }
  
  .greeting h1 {
    font-size: var(--font-size-3xl);
  }
}

/* ============================================
   Large Desktop (1200px+)
   ============================================ */

@media (min-width: 1200px) {
  :root {
    --max-width: 720px;
  }
  
  .skills-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   Connection Code Display
   ============================================ */

.code-display {
  text-align: center;
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.connection-code {
  display: block;
  font-size: 32px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 8px;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.code-expires {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* ============================================
   Form Elements
   ============================================ */

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-input {
  width: 100%;
  padding: 12px var(--space-md);
  font-size: var(--font-size-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input:read-only {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.input-row {
  display: flex;
  gap: var(--space-sm);
}

.input-row .form-input {
  flex: 1;
}

/* ============================================
   Modal
   ============================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  
  padding: var(--space-lg);
}

/* ============================================
   Dark Mode
   ============================================ */


/* ============================================
   Model Ratings & Badges
   ============================================ */

.model-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.model-stars {
  color: var(--accent);
  font-size: var(--font-size-sm);
  letter-spacing: 1px;
}

.model-badges {
  display: flex;
  gap: 4px;
}

.model-badge {
  font-size: 14px;
  cursor: help;
  transition: transform var(--transition-fast);
}

.model-badge:hover {
  transform: scale(1.2);
}

/* Tooltip styling */
.model-badge[title] {
  position: relative;
}

.model-badge[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-card);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  white-space: nowrap;
  z-index: 10;
  margin-bottom: 4px;
}

.model-badge[title]:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text-primary);
  margin-bottom: -6px;
  z-index: 10;
}
