/**
 * TerpTune App Styles v3.0
 * Companion to design-system.css
 */

@import url('./design-system.css');

/* ============================================
 * APP LAYOUT
 * ============================================ */

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--color-bg);
}

.app-container {
  width: 100%;
  max-width: var(--max-width-app);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  position: relative;
}

/* ============================================
 * HEADER - New Top Nav Structure
 * ============================================ */

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

.header-brand {
  font-family: var(--font-body);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.02em;
}

.header-brand .brand-terp {
  color: var(--color-text-primary);
}

.header-brand .brand-tune {
  color: var(--color-accent);
}

.header-nav {
  position: relative;
}

/* Screen Selector Button */
.screen-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-base);
}

.screen-selector:hover {
  border-color: var(--color-accent);
  background: var(--color-surface-hover);
}

.screen-selector .screen-icon {
  font-size: var(--font-size-lg);
  color: var(--color-accent);
}

.screen-selector .screen-caret {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  transition: transform var(--transition-base);
}

.screen-selector[aria-expanded="true"] .screen-caret {
  transform: rotate(180deg);
}

/* Screen Dropdown */
.screen-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  display: none;
  flex-direction: column;
  min-width: 180px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
}

.screen-dropdown.show {
  display: flex;
}

.screen-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: var(--color-text-primary);
  background: transparent;
  border: none;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.screen-option:hover {
  background: var(--color-surface-hover);
}

.screen-option.active {
  background: var(--color-accent-subtle);
}

.screen-option.active .option-icon,
.screen-option.active .option-name {
  color: var(--color-accent);
}

.screen-option .option-icon {
  font-size: var(--font-size-lg);
  width: 24px;
  text-align: center;
}

/* Screen-specific accent colors for dropdown */
.screen-option[data-screen="karl"] .option-icon { color: var(--screen-karl); }
.screen-option[data-screen="profile"] .option-icon { color: var(--screen-profile); }
.screen-option[data-screen="stash"] .option-icon { color: var(--screen-stash); }
.screen-option[data-screen="nearme"] .option-icon { color: var(--screen-nearme); }

.screen-option[data-screen="karl"]:hover { background: rgba(99, 102, 241, 0.1); }
.screen-option[data-screen="profile"]:hover { background: rgba(139, 92, 246, 0.1); }
.screen-option[data-screen="stash"]:hover { background: rgba(16, 185, 129, 0.1); }
.screen-option[data-screen="nearme"]:hover { background: rgba(59, 130, 246, 0.1); }

.dropdown-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-2) 0;
}

.logout-option:hover {
  color: var(--color-danger);
  background: var(--color-danger-bg) !important;
}

.logout-option .option-icon {
  color: var(--color-text-tertiary);
}

.logout-option:hover .option-icon {
  color: var(--color-danger);
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  background: transparent;
  z-index: calc(var(--z-dropdown) - 1);
}

.menu-backdrop.show {
  display: block;
}

/* Screen-specific header accent */
[data-active-screen="karl"] .screen-selector .screen-icon { color: var(--screen-karl); }
[data-active-screen="profile"] .screen-selector .screen-icon { color: var(--screen-profile); }
[data-active-screen="stash"] .screen-selector .screen-icon { color: var(--screen-stash); }
[data-active-screen="nearme"] .screen-selector .screen-icon { color: var(--screen-nearme); }

/* ============================================
 * SCREEN CONTAINERS (Tab Content)
 * ============================================ */

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.screen.active {
  display: flex;
}

/* ============================================
 * KARL SCREEN (Chat)
 * ============================================ */

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  padding-bottom: calc(var(--space-4) + 120px); /* Space for input + nav */
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.message {
  display: flex;
  animation: slideUp var(--transition-slow) ease-out;
}

.message-content {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  max-width: 85%;
  word-break: break-word;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

/* User message - right aligned, raised surface */
.user-message {
  justify-content: flex-end;
}

.user-message .message-content {
  background: var(--color-surface-raised);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
}

/* Karl message - left aligned, emerald accent */
.assistant-message .message-content {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm);
}

.assistant-message .message-content p {
  margin-bottom: var(--space-2);
}

.assistant-message .message-content p:last-child {
  margin-bottom: 0;
}

/* Welcome message */
.welcome-message {
  margin-top: auto;
}

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

.input-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-3) + var(--safe-area-bottom));
  z-index: var(--z-sticky);
}

/* Center input on desktop */
@media (min-width: 481px) {
  .input-container {
    left: 50%;
    transform: translateX(-50%);
    max-width: var(--max-width-app);
  }
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
}

.message-input {
  flex: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  min-height: 48px;
  max-height: 120px;
  resize: none;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  transition: all var(--transition-base);
}

.message-input::placeholder {
  color: var(--color-text-tertiary);
}

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

/* COA Upload Button */
.coa-upload-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.coa-upload-btn:hover {
  background: var(--color-surface-hover);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.coa-upload-btn:active {
  transform: scale(0.95);
}

.coa-upload-btn.processing {
  opacity: 0.5;
  pointer-events: none;
}

/* Send Button */
.send-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.send-btn:active {
  transform: translateY(0);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Input Hint */
.input-hint {
  margin-top: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  text-align: center;
}

/* ============================================
 * LOADING INDICATOR
 * ============================================ */

.loading-indicator {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  z-index: var(--z-sticky);
}

.loading-indicator.hidden {
  display: none;
}

.loading-dots {
  display: flex;
  gap: 4px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  animation: dotPulse 1.2s infinite ease-in-out;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.loading-text {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

/* ============================================
 * BOTTOM NAVIGATION - REMOVED (now using top dropdown)
 * Keeping styles commented for reference
 * ============================================ */

/* Bottom nav has been replaced with top header dropdown */

/* ============================================
 * PROFILE SCREEN
 * ============================================ */

.profile-screen {
  padding: var(--space-4);
  padding-bottom: var(--space-8);
  overflow-y: auto;
}

.profile-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--color-accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-3);
  font-size: 2rem;
}

.profile-name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.profile-email {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.profile-section {
  margin-bottom: var(--space-6);
}

.profile-section-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

/* Profile Type Card */
.profile-type-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.profile-type-label {
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-relaxed);
}

.profile-type-description {
  margin-top: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* Tolerance State */
.tolerance-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tolerance-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.tolerance-days {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

.tolerance-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.tolerance-badge {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
}

.tolerance-badge.active {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.tolerance-badge.reset {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.tolerance-badge.full-reset {
  background: var(--color-success-bg);
  color: var(--color-success);
}

/* Threshold Sliders */
.threshold-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.threshold-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

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

.threshold-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  text-transform: capitalize;
}

.threshold-value {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent);
  font-family: var(--font-mono);
}

.threshold-type {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-2);
  text-transform: capitalize;
}

.threshold-bar {
  height: 8px;
  background: var(--color-surface-raised);
  border-radius: var(--radius-full);
  overflow: hidden;
}

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

.threshold-fill.safe { background: var(--color-success); }
.threshold-fill.warning { background: var(--color-warning); }
.threshold-fill.danger { background: var(--color-danger); }

/* Signatures */
.signatures-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.signature-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.signature-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.signature-content {
  flex: 1;
  min-width: 0;
}

.signature-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

.signature-formula {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
  margin-top: var(--space-1);
}

/* Session Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
}

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

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-1);
}

/* Share Button */
.share-button {
  width: 100%;
  margin-top: var(--space-6);
}

/* ============================================
 * STASH SCREEN
 * ============================================ */

.stash-screen {
  padding: var(--space-4);
  padding-bottom: var(--space-8);
  overflow-y: auto;
}

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

.stash-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.stash-count {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
}

.stash-group {
  margin-bottom: var(--space-6);
}

.stash-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.stash-group-icon {
  font-size: 1rem;
}

.stash-group-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
}

.stash-group-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  background: var(--color-surface-raised);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
}

.stash-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Stash Card */
.stash-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  cursor: pointer;
  transition: all var(--transition-base);
}

.stash-card:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-strong);
}

.stash-card:active {
  transform: scale(0.98);
}

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

.stash-strain-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.stash-brand {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-1);
}

.stash-indicator {
  font-size: 1rem;
}

.stash-card-meta {
  display: flex;
  gap: var(--space-4);
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.stash-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.stash-rating {
  color: var(--color-warning);
  font-weight: var(--font-weight-semibold);
}

/* Stash Card Expanded */
.stash-card.expanded {
  border-color: var(--color-accent);
}

.stash-card-details {
  display: none;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.stash-card.expanded .stash-card-details {
  display: block;
}

.stash-terpene-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.stash-terpene {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
}

.stash-terpene-name {
  color: var(--color-text-secondary);
  text-transform: capitalize;
}

.stash-terpene-value {
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-mono);
  margin-left: var(--space-1);
}

.stash-actions {
  display: flex;
  gap: var(--space-2);
}

/* Show More Button */
.show-more-btn {
  width: 100%;
  padding: var(--space-3);
  background: transparent;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.show-more-btn:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text-secondary);
  background: var(--color-surface);
}

/* ============================================
 * NEAR ME SCREEN
 * ============================================ */

.nearme-screen {
  padding: var(--space-4);
  padding-bottom: var(--space-8);
  overflow-y: auto;
  min-height: calc(100vh - var(--header-height));
}

/* Near Me Header */
.nearme-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.nearme-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0;
}

.nearme-location {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
}

.nearme-location .location-icon {
  font-size: 1rem;
}

/* Dispensary List */
.nearme-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Dispensary Card */
.dispensary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: border-color var(--transition-base);
}

.dispensary-card:hover {
  border-color: var(--color-border-hover);
}

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

.dispensary-name {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-1) 0;
}

.dispensary-location {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.dispensary-match-count {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--color-success-bg);
  color: var(--color-success);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

/* Top Match Display */
.top-match {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.top-match-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.top-match-strain {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-match-info {
  flex: 1;
}

.top-match-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

.top-match-details {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

.match-score {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

.match-score.excellent {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.match-score.good {
  background: rgba(251, 191, 36, 0.1);
  color: #FBBF24;
}

.match-score.fair {
  background: rgba(251, 146, 60, 0.1);
  color: #FB923C;
}

/* Dispensary Actions */
.dispensary-actions {
  display: flex;
  gap: var(--space-2);
}

.dispensary-actions .btn {
  flex: 1;
  justify-content: center;
}

.btn-directions {
  background: var(--color-accent);
  color: var(--color-bg);
  border: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: background var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.btn-directions:hover {
  background: var(--color-accent-hover);
}

/* Empty and Loading States */
.nearme-empty,
.nearme-no-thresholds {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8);
  min-height: 300px;
}

.nearme-empty .empty-icon,
.nearme-no-thresholds .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.nearme-empty .empty-title,
.nearme-no-thresholds .empty-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.nearme-empty .empty-message,
.nearme-no-thresholds .empty-message {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-6);
}

.nearme-cta {
  color: var(--color-accent);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: color var(--transition-base);
}

.nearme-cta:hover {
  color: var(--color-accent-hover);
}

.nearme-loading .skeleton {
  background: linear-gradient(90deg, var(--color-surface) 25%, var(--color-bg) 50%, var(--color-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ============================================
 * LOGIN OVERLAY
 * ============================================ */

.login-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(12, 12, 12, 0.9);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
}

.login-overlay:not(.hidden) {
  display: flex;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.login-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

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

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
}

.form-input {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  transition: all var(--transition-base);
}

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

.login-btn {
  width: 100%;
  padding: var(--space-4);
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all var(--transition-base);
}

.login-btn:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.login-message {
  display: none;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  text-align: center;
}

.login-message.success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

.login-message.error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

.login-message.show {
  display: block;
}

.login-footer {
  text-align: center;
  margin-top: var(--space-4);
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

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

@media (max-width: 480px) {
  .app-container {
    border-radius: 0;
  }

  .profile-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================
 * DARK MODE MEDIA QUERY (future-proofing)
 * ============================================ */

@media (prefers-color-scheme: dark) {
  /* Already dark by default */
}

/* ============================================
 * REDUCED MOTION
 * ============================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
 * SHARE CODE MODAL (P3-03)
 * ============================================ */

.share-code-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(12, 12, 12, 0.9);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  animation: fadeIn var(--transition-base) ease-out;
}

.share-code-content {
  width: 100%;
  max-width: 360px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  animation: slideUp var(--transition-slow) ease-out;
}

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

.share-code-header h2 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}

.share-code-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--color-text-tertiary);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.share-code-close:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.share-code-body {
  padding: var(--space-6);
  text-align: center;
}

.share-code-display {
  font-family: var(--font-mono);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  letter-spacing: 0.1em;
  padding: var(--space-4);
  background: var(--color-surface-raised);
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}

.share-code-instructions {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-2);
}

.share-code-expiry {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-4);
}

.share-code-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
}

.share-code-actions .btn {
  min-width: 120px;
}

/* ============================================
 * SCREEN-SPECIFIC ACCENT COLORS
 * Each screen has its own terpene identity
 * ============================================ */

/* Profile Screen - Nerolidol Purple */
.profile-screen .profile-avatar {
  background: var(--terpene-nerolidol-subtle);
  color: var(--terpene-nerolidol);
}

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

.profile-screen .btn-primary:hover {
  background: var(--terpene-nerolidol-light);
}

.profile-screen .profile-section-title {
  color: var(--terpene-nerolidol);
}

.profile-screen .threshold-bar-fill {
  background: var(--screen-profile);
}

/* Stash Screen - Limonene Green */
.stash-screen .stash-title {
  color: var(--screen-stash);
}

.stash-screen .stash-count {
  color: var(--screen-stash);
}

.stash-screen .stash-group-icon {
  color: var(--screen-stash);
}

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

.stash-screen .btn-primary:hover {
  background: var(--terpene-limonene-light);
}

/* Near Me Screen - Pinene Blue */
.nearme-screen .nearme-title {
  color: var(--screen-nearme);
}

.nearme-screen .location-icon {
  color: var(--screen-nearme);
}

.nearme-screen .btn-directions {
  background: var(--screen-nearme);
}

.nearme-screen .btn-directions:hover {
  background: var(--terpene-pinene-light);
}

.nearme-screen .nearme-cta {
  color: var(--screen-nearme);
}

.nearme-screen .nearme-cta:hover {
  color: var(--terpene-pinene-light);
}

/* Karl Screen - Linalool Indigo (primary, already default) */
/* Karl uses the main accent color */
