/* =========================================
   TableCloser Premium Design System
   Resy-Inspired Dark Theme with Glassmorphism
   ========================================= */

/* Google Fonts - Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Resy Signature Colors */
  --resy-red: #EE3424;
  --resy-red-dark: #D12A1C;
  --resy-red-light: #FF5347;
  --resy-gradient: linear-gradient(135deg, #EE3424 0%, #FF6B5B 100%);

  /* Dark Theme Base */
  --bg-primary: #0A0A0B;
  --bg-secondary: #111113;
  --bg-tertiary: #18181B;
  --bg-elevated: #1F1F23;

  /* Glass Effect */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.06);

  /* Text Colors */
  --text-primary: #FAFAFA;
  --text-secondary: #A1A1AA;
  --text-muted: #71717A;
  --text-accent: var(--resy-red);

  /* Semantic Colors */
  --success: #22C55E;
  --success-bg: rgba(34, 197, 94, 0.1);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --error: #EF4444;
  --error-bg: rgba(239, 68, 68, 0.1);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(238, 52, 36, 0.3);

  /* Timing */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

/* =========================================
   Animations
   ========================================= */

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

@keyframes glow {

  0%,
  100% {
    box-shadow: 0 0 20px rgba(238, 52, 36, 0.3);
  }

  50% {
    box-shadow: 0 0 40px rgba(238, 52, 36, 0.5);
  }
}

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

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes checkmark {
  0% {
    stroke-dashoffset: 100;
  }

  100% {
    stroke-dashoffset: 0;
  }
}

/* =========================================
   Base Styles
   ========================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle grid background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(238, 52, 36, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(238, 52, 36, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* =========================================
   Layout
   ========================================= */

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 80px;
  animation: fadeIn var(--transition-slow) ease-out;
}

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

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 0;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--glass-border);
  animation: slideUp var(--transition-slow) ease-out;
}

.logo {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 3px;
  background: var(--resy-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-transform: uppercase;
  position: relative;
}

.logo::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--resy-gradient);
  border-radius: 2px;
}

.tagline {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 8px;
  font-weight: 400;
  letter-spacing: 0.5px;
}

/* =========================================
   Cards (Glassmorphism)
   ========================================= */

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  margin-bottom: 24px;
  transition: all var(--transition-base);
  animation: slideUp var(--transition-slow) ease-out;
  animation-fill-mode: both;
}

.card:nth-child(1) {
  animation-delay: 0ms;
}

.card:nth-child(2) {
  animation-delay: 100ms;
}

.card:nth-child(3) {
  animation-delay: 200ms;
}

.card:nth-child(4) {
  animation-delay: 300ms;
}

.card:hover {
  background: var(--glass-hover);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.card h2::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--resy-gradient);
  border-radius: 2px;
}

/* =========================================
   Platform Cards (Logo Selection)
   ========================================= */

.platform-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.platform-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 24px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.platform-card:hover {
  background: var(--bg-elevated);
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.platform-card.active {
  border-color: var(--text-secondary);
  background: var(--bg-elevated);
}

.platform-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.platform-card span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-base);
}

.platform-card.active span {
  color: var(--text-primary);
}

.platform-card .badge {
  margin-top: 4px;
}

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

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

label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transition: all var(--transition-base);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--resy-red);
  box-shadow: 0 0 0 3px rgba(238, 52, 36, 0.15);
  background: var(--bg-elevated);
}

input::placeholder {
  color: var(--text-muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2371717A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 44px;
}

select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--resy-red);
  cursor: pointer;
}

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

button {
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

button:active::before {
  width: 300px;
  height: 300px;
}

/* Primary Button */
button:not(.ghost):not(.secondary):not(.platform-card) {
  background: var(--resy-gradient);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

button:not(.ghost):not(.secondary):not(.platform-card):hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

button:not(.ghost):not(.secondary):not(.platform-card):active {
  transform: translateY(0);
}

/* Secondary Button */
button.secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

button.secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

/* Ghost Button */
button.ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

button.ghost:hover {
  background: var(--glass-bg);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Loading State */
button.loading {
  color: transparent;
  pointer-events: none;
}

button.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* =========================================
   Status Badges
   ========================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

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

.badge.error {
  background: var(--error-bg);
  color: var(--error);
}

.badge.neutral {
  background: var(--glass-bg);
  color: var(--text-secondary);
}

/* Pulsing dot for active status */
.badge.active::before {
  content: '';
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* =========================================
   Lists
   ========================================= */

.list {
  display: grid;
  gap: 16px;
}

.list-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  padding: 20px 24px;
  border-radius: var(--radius-md);
  display: grid;
  gap: 16px;
  transition: all var(--transition-base);
  animation: slideUp var(--transition-slow) ease-out;
}

.list-item:hover {
  background: var(--bg-elevated);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

.list-item .row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.list-item strong {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 16px;
}

.list-item .meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.list-item .meta span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* =========================================
   Restaurant Preview Card
   ========================================= */

.restaurant-preview {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  padding: 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-top: 16px;
  animation: scaleIn var(--transition-base) ease-out;
}

.restaurant-preview img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.restaurant-preview .info h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.restaurant-preview .info .cuisine {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.restaurant-preview .info .details {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.restaurant-preview .info .rating {
  color: var(--warning);
}

/* =========================================
   Utility Classes
   ========================================= */

.small {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.error {
  color: var(--error) !important;
}

.success {
  color: var(--success) !important;
}

.text-center {
  text-align: center;
}

.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn var(--transition-base) ease-out;
}

.slide-up {
  animation: slideUp var(--transition-base) ease-out;
}

/* =========================================
   Skeleton Loading
   ========================================= */

.skeleton {
  background: linear-gradient(90deg,
      var(--bg-tertiary) 25%,
      var(--bg-elevated) 50%,
      var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-heading {
  height: 24px;
  width: 60%;
  margin-bottom: 16px;
}

.skeleton-image {
  height: 120px;
}

/* =========================================
   Actions Row
   ========================================= */

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.actions button {
  flex: 1;
  min-width: 140px;
}

/* =========================================
   Mobile-First Responsive Design
   ========================================= */

/* Touch-friendly minimum target size */
:root {
  --touch-target: 44px;
}

/* Tablet breakpoint */
@media (max-width: 1024px) {
  main {
    padding: 0 20px 80px;
  }

  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile breakpoint - Core */
@media (max-width: 768px) {

  /* Safe area padding for notched phones */
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  main {
    padding: 0 16px 100px;
    /* Extra bottom for sticky nav */
  }

  /* Header - Compact mobile layout */
  header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 20px;
    gap: 8px;
  }

  .logo {
    font-size: 20px;
    letter-spacing: 2px;
  }

  .tagline {
    display: none;
    /* Hide on mobile for cleaner look */
  }

  .header-actions {
    gap: 4px;
  }

  .header-actions .ghost {
    padding: 10px;
    font-size: 0;
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    justify-content: center;
  }

  .header-actions .ghost svg {
    width: 20px;
    height: 20px;
    margin: 0;
  }

  /* Cards - Touch optimized */
  .card {
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
  }

  .card:hover {
    transform: none;
    /* Disable hover effects on mobile */
  }

  .card h2 {
    font-size: 17px;
  }

  /* Form Grid - Stack */
  .grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Touch-friendly inputs */
  input,
  select,
  textarea {
    font-size: 16px !important;
    /* Prevent iOS zoom */
    min-height: var(--touch-target);
    padding: 12px 16px;
  }

  input[type="date"],
  input[type="time"] {
    min-height: var(--touch-target);
  }

  /* Touch-friendly buttons */
  button,
  .primary-btn,
  .ghost {
    min-height: var(--touch-target);
    font-size: 15px;
  }

  .primary-btn {
    padding: 14px 20px;
    width: 100%;
  }

  /* Platform cards - Full width */
  .platform-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .platform-card {
    padding: 16px;
    min-height: 60px;
  }

  /* Tab Navigation - Sticky bottom on mobile */
  .tab-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--glass-border);
    border-radius: 0;
    padding: 8px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    margin: 0;
    gap: 8px;
  }

  .tab-btn {
    flex: 1;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    font-size: 11px;
    min-height: var(--touch-target);
  }

  .tab-btn svg {
    width: 22px;
    height: 22px;
  }

  .pro-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 20px);
    font-size: 9px;
    padding: 2px 4px;
  }

  /* Watch items - Touch friendly */
  .watch-item {
    padding: 16px;
  }

  .watch-actions {
    flex-direction: column;
    gap: 8px;
  }

  .watch-actions button {
    width: 100%;
  }

  /* Actions container */
  .actions {
    flex-direction: column;
    gap: 12px;
  }

  .actions button {
    width: 100%;
  }

  /* Restaurant preview */
  .restaurant-preview {
    grid-template-columns: 1fr;
  }

  .restaurant-preview img {
    width: 100%;
    height: 180px;
    border-radius: var(--radius-md);
  }

  /* Restaurant search dropdown */
  .restaurant-dropdown {
    position: fixed;
    left: 16px;
    right: 16px;
    top: auto;
    bottom: calc(60px + env(safe-area-inset-bottom) + 20px);
    max-height: 60vh;
    border-radius: var(--radius-lg);
  }

  .restaurant-item {
    padding: 14px;
  }

  .restaurant-item-photo {
    width: 56px;
    height: 56px;
  }

  .restaurant-item-favorite {
    min-width: var(--touch-target);
    min-height: var(--touch-target);
  }
}

/* Small phones */
@media (max-width: 375px) {
  main {
    padding: 0 12px 100px;
  }

  .logo {
    font-size: 18px;
    letter-spacing: 1px;
  }

  .card {
    padding: 16px;
  }

  .card h2 {
    font-size: 16px;
  }

  input,
  select {
    padding: 10px 14px;
  }

  .primary-btn {
    padding: 12px 16px;
  }
}

/* =========================================
   Mobile Modals (Full-screen sheets)
   ========================================= */

@media (max-width: 768px) {
  .modal-overlay {
    align-items: flex-end;
    /* Slide up from bottom */
  }

  .modal {
    max-width: 100%;
    width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    margin: 0;
    animation: slideUp var(--transition-base) ease-out;
  }

  .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: var(--touch-target);
    height: var(--touch-target);
    font-size: 28px;
  }

  .modal-body {
    max-height: calc(90vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-header h2 {
    font-size: 20px;
  }

  /* Profile modal mobile */
  .profile-modal {
    max-height: 95vh;
  }

  .profile-modal .modal-body {
    max-height: calc(95vh - 140px);
  }

  .profile-avatar {
    width: 60px;
    height: 60px;
    margin-bottom: 12px;
  }

  .profile-avatar svg {
    width: 36px;
    height: 36px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-label {
    font-size: 11px;
  }

  .favorite-item,
  .account-item {
    padding: 14px;
  }
}

/* =========================================
   Pro Chat Mobile Optimizations
   ========================================= */

@media (max-width: 768px) {
  .pro-hero {
    padding: 24px 20px;
  }

  .pro-icon svg {
    width: 40px;
    height: 40px;
  }

  .pro-hero h2 {
    font-size: 22px;
  }

  .pro-description {
    font-size: 14px;
  }

  .chat-container {
    height: calc(100vh - 280px);
    min-height: 300px;
  }

  .chat-messages {
    padding: 16px;
  }

  .chat-message {
    max-width: 90%;
    padding: 12px 16px;
    font-size: 15px;
  }

  .chat-input-container {
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .chat-input-container input {
    padding: 12px 16px;
  }

  .chat-input-container button {
    min-width: var(--touch-target);
    padding: 0 16px;
  }
}

/* =========================================
   Touch Feedback & Interactions
   ========================================= */

@media (hover: none) and (pointer: coarse) {

  /* Remove hover effects on touch devices */
  .card:hover,
  .platform-card:hover,
  .watch-item:hover,
  .ghost:hover {
    transform: none;
  }

  /* Add active states instead */
  .card:active,
  .platform-card:active,
  button:active,
  .ghost:active {
    opacity: 0.8;
    transform: scale(0.98);
  }

  /* Larger touch targets for interactive elements */
  .checkbox-container {
    min-height: var(--touch-target);
    padding: 12px 0;
  }

  /* Better scroll behavior */
  .chat-messages,
  .modal-body,
  .watch-list {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
}

/* =========================================
   Landscape Mobile
   ========================================= */

@media (max-width: 768px) and (orientation: landscape) {
  .tab-nav {
    padding-bottom: 8px;
  }

  .modal {
    max-height: 100vh;
  }

  .chat-container {
    height: calc(100vh - 200px);
  }
}

/* =========================================
   Custom Scrollbar
   ========================================= */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* =========================================
   Selection
   ========================================= */

::selection {
  background: rgba(238, 52, 36, 0.3);
  color: var(--text-primary);
}

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

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 440px;
  width: 90%;
  position: relative;
  animation: slideUp 0.3s ease-out;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: var(--transition-fast);
}

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

.modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.modal-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  border-radius: 16px;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

.guidance-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.guidance-box.success {
  background: var(--success-bg);
  border-color: var(--success);
}

.guidance-box.success svg {
  color: var(--success);
}

.guidance-box svg {
  flex-shrink: 0;
  color: var(--resy-red);
}

.auth-step {
  animation: fadeIn 0.3s ease;
}

.auth-step.hidden {
  display: none;
}

.text-btn {
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.text-btn:hover {
  color: var(--text-primary) !important;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  transition: var(--transition-fast);
}

.form-group input:focus {
  outline: none;
  border-color: var(--resy-red);
  box-shadow: 0 0 0 3px rgba(238, 52, 36, 0.2);
}

.modal-actions {
  margin-top: 24px;
}

.primary-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  background: var(--resy-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.modal-status {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-top: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-status.hidden {
  display: none;
}

.modal-status.loading {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.modal-status.success {
  background: var(--success-bg);
  color: var(--success);
}

.modal-status.error {
  background: var(--error-bg);
  color: var(--error);
}

/* Step Progress */
.modal-steps {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
}

.modal-steps.hidden {
  display: none;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  opacity: 0.4;
  transition: var(--transition-base);
}

.step.active {
  opacity: 1;
}

.step.complete {
  opacity: 1;
}

.step.complete .step-number {
  background: var(--success);
  border-color: var(--success);
}

.step-number {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--glass-border);
  border-radius: 50%;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition-base);
}

.step.active .step-number {
  border-color: var(--resy-red);
  background: rgba(238, 52, 36, 0.2);
  color: var(--resy-red);
}

.step-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Success Modal */
.success-modal {
  text-align: center;
  padding: 48px 32px;
}

.success-icon {
  color: var(--success);
  margin-bottom: 20px;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.success-modal h2 {
  font-size: 28px;
  margin: 0 0 8px 0;
}

.success-modal p {
  color: var(--text-secondary);
  margin: 0 0 24px 0;
}

/* Loading Spinner */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--resy-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* =========================================
   Tab Navigation
   ========================================= */

.tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  width: fit-content;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.tab-btn:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--resy-gradient);
  color: white;
  box-shadow: var(--shadow-glow);
}

.tab-btn svg {
  width: 16px;
  height: 16px;
}

.pro-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  background: var(--warning);
  color: black;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tab-btn.active .pro-badge {
  background: white;
  color: var(--resy-red);
}

.tab-content {
  animation: fadeIn var(--transition-base);
}

.tab-content.hidden {
  display: none;
}

/* =========================================
   Pro Tab Styles
   ========================================= */

.pro-hero {
  text-align: center;
  padding: 48px 24px;
  background: linear-gradient(180deg, rgba(238, 52, 36, 0.1) 0%, transparent 100%);
}

.pro-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--resy-gradient);
  border-radius: 50%;
  box-shadow: var(--shadow-glow);
}

.pro-icon svg {
  stroke: white;
}

.pro-description {
  max-width: 500px;
  margin: 8px auto 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* =========================================
   Chat Interface
   ========================================= */

.chat-card {
  padding: 0;
  overflow: hidden;
}

.chat-messages {
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  display: flex;
  gap: 12px;
  animation: slideUp var(--transition-base);
}

.chat-message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  font-size: 18px;
}

.chat-message.user .message-avatar {
  background: var(--resy-gradient);
  border: none;
  font-size: 14px;
  color: white;
}

.message-content {
  max-width: 80%;
  padding: 12px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  border-top-left-radius: 4px;
}

.chat-message.user .message-content {
  background: var(--resy-gradient);
  border: none;
  border-radius: var(--radius-lg);
  border-top-right-radius: 4px;
  color: white;
}

.message-content p {
  margin: 0;
  line-height: 1.5;
}

.example-prompts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.example-prompt {
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-base);
}

.example-prompt:hover {
  background: var(--glass-hover);
  border-color: var(--resy-red);
  color: var(--text-primary);
}

/* Chat Input */
.chat-input-container {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
  background: var(--bg-secondary);
}

.chat-input-container textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  padding: 12px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
}

.chat-input-container textarea:focus {
  outline: none;
  border-color: var(--resy-red);
  box-shadow: 0 0 0 3px rgba(238, 52, 36, 0.15);
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--resy-gradient);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: all var(--transition-base);
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

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

/* Agent Status Indicator */
.agent-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
}

.agent-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

.agent-status.thinking .dot {
  background: var(--warning);
}

.agent-status.error .dot {
  background: var(--error);
  animation: none;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-4px);
  }
}

/* Watch Created Card in Chat */
.watch-created-card {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.05) 100%);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 8px;
}

.watch-created-header {
  color: var(--success);
  margin-bottom: 12px;
  font-size: 14px;
}

.watch-created-details {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 14px;
}

.watch-created-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* Agent Status Success */
.agent-status.success {
  background: var(--success-bg);
  border-color: var(--success);
}

.agent-status.success span {
  color: var(--success);
}

/* Restaurant Photo in Watch List */
.watch-photo {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.watch-info {
  display: flex;
  gap: 12px;
  align-items: center;
}

.watch-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #FFB800;
}

.watch-rating svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

/* =========================================
   Header Actions
   ========================================= */

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-actions .ghost {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* =========================================
   Restaurant Search
   ========================================= */

.restaurant-search-container {
  position: relative;
}

.search-input-wrapper {
  position: relative;
}

.search-loading {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.spinner-small {
  width: 18px;
  height: 18px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--resy-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.restaurant-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.restaurant-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--glass-border);
}

.restaurant-item:last-child {
  border-bottom: none;
}

.restaurant-item:hover {
  background: var(--glass-hover);
}

.restaurant-item-photo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.restaurant-item-info {
  flex: 1;
  min-width: 0;
}

.restaurant-item-name {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.restaurant-item-address {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.restaurant-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-top: 4px;
}

.restaurant-item-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #FFB800;
}

.restaurant-item-favorite {
  padding: 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.restaurant-item-favorite:hover,
.restaurant-item-favorite.active {
  color: var(--resy-red);
}

.optional {
  color: var(--text-muted);
  font-weight: normal;
}

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

.profile-modal {
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--resy-red) 0%, var(--resy-red-light) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.profile-avatar svg {
  stroke: white;
}

.profile-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--glass-border);
}

.profile-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.profile-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

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

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--resy-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* Favorites List */
.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.favorite-item:hover {
  background: var(--glass-hover);
}

.favorite-photo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-tertiary);
}

.favorite-info {
  flex: 1;
  min-width: 0;
}

.favorite-name {
  font-weight: 500;
  color: var(--text-primary);
}

.favorite-address {
  font-size: 12px;
  color: var(--text-muted);
}

.favorite-remove {
  padding: 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.favorite-remove:hover {
  color: var(--error);
}

/* Connected Accounts */
.connected-accounts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.account-item-logo {
  width: 32px;
  height: 32px;
}

.account-item-info {
  flex: 1;
}

.account-item-name {
  font-weight: 500;
}

.account-item-email {
  font-size: 12px;
  color: var(--text-muted);
}

.account-item-status {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
}

.account-item-status.connected {
  background: var(--success-bg);
  color: var(--success);
}

.account-item-status.disconnected {
  background: var(--error-bg);
  color: var(--error);
}

.empty-state {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
}