/* ========================================
   CSS Variables
   ======================================== */
:root {
  /* Colors - Modern Palette */
  --primary: #FF7E67;
  /* Vibrant Coral */
  --primary-dark: #E86650;
  --secondary: #4ECDC4;
  /* Fresh Teal */
  --accent: #FFD93D;
  /* Sunny Yellow */

  --text-dark: #1A202C;
  /* Deep Blue-Grey */
  --text-light: #718096;
  /* Cool Grey */
  --text-white: #FFFFFF;

  --bg-light: #F7FAFC;
  /* Very subtle cool grey */
  --bg-white: #FFFFFF;
  --border: #E2E8F0;

  --success: #48BB78;
  --warning: #ECC94B;
  --danger: #F56565;

  /* Typography */
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Open Sans', sans-serif;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
  /* Increased for more breathing room */

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  /* Softer corners */

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode */
[data-theme="dark"] {
  --text-dark: #F7FAFC;
  --text-light: #A0AEC0;

  --bg-light: #171923;
  --bg-white: #2D3748;
  --border: #4A5568;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-body);
  color: var(--text-dark);
  line-height: 1.7;
  /* Improved readability */
  background: var(--bg-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  /* Tighter headings */
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

input,
textarea,
select {
  font-family: inherit;
  font-size: 1rem;
  border: 2px solid var(--border);
  /* Thicker border */
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  /* Larger touch target */
  transition: var(--transition);
  background: var(--bg-white);
  color: var(--text-dark);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 126, 103, 0.2);
  /* Focus ring */
}

/* ========================================
   Layout
   ======================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-sm);
}

.main-content {
  flex: 1;
  padding: var(--space-lg) 0;
}

/* ========================================
   Navigation
   ======================================== */
.navbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

[data-theme="dark"] .navbar {
  background: rgba(23, 25, 35, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm);
}

.nav-brand h1 {
  font-size: 1.5rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: var(--space-md);
}

.nav-menu a {
  color: var(--text-dark);
  font-weight: 500;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--primary);
  background: rgba(255, 107, 107, 0.1);
}

[data-theme="dark"] .nav-menu a {
  text-decoration: none;
  border: none;
  box-shadow: none;
  background: transparent;
  border-radius: 0;
}

[data-theme="dark"] .nav-menu a:hover,
[data-theme="dark"] .nav-menu a.active {
  background: transparent;
  color: var(--primary);
}

.nav-toggle {
  display: none;
  background: none;
  font-size: 1.5rem;
  color: var(--text-dark);
}

.nav-auth {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  /* Pill shape */
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--text-white);
  box-shadow: 0 4px 12px rgba(255, 126, 103, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 126, 103, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary) 0%, #3dbcb3 100%);
  color: var(--text-white);
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(78, 205, 196, 0.4);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--text-white);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 126, 103, 0.2);
}

.btn-danger {
  background: var(--danger);
  color: var(--text-white);
}

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 0.8rem 2rem;
  font-size: 1.1rem;
}

/* ========================================
   Cards
   ======================================== */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .card {
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-5px);
}

.card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.card-body {
  padding: var(--space-md);
}

.card-title {
  font-size: 1.1rem;
  margin-bottom: var(--space-xs);
}

.card-text {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ========================================
   Grid
   ======================================== */
.grid {
  display: grid;
  gap: var(--space-md);
}

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

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

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

/* ========================================
   Hero Section
   ======================================== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #FF9F43 100%);
  color: var(--text-white);
  padding: 6rem 0 4rem;
  /* More top padding for fixed nav */
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: var(--space-sm);
}

.hero p {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: var(--space-lg);
}

/* ========================================
   Features Section
   ======================================== */
.features {
  padding: var(--space-xl) 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
}

.feature-card {
  text-align: center;
  padding: var(--space-lg);
}

.feature-icon {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: var(--space-sm);
}

.feature-card h3 {
  margin-bottom: var(--space-xs);
}

/* ========================================
   Forms
   ======================================== */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: var(--transition);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-header h2 {
  margin: 0;
}

.modal-close {
  background: none;
  font-size: 1.5rem;
  color: var(--text-light);
}

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

.modal-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* ========================================
   Footer
   ======================================== */
.footer {
  background: var(--text-dark);
  color: var(--text-white);
  padding: var(--space-md) 0;
  text-align: center;
  margin-top: auto;
}

[data-theme="dark"] .footer {
  background: #1A202C;
  color: #E2E8F0;
}

/* ========================================
   Utilities
   ======================================== */
.text-center {
  text-align: center;
}

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

.text-light {
  color: var(--text-light);
}

.mt-sm {
  margin-top: var(--space-sm);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mb-sm {
  margin-bottom: var(--space-sm);
}

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

.mb-lg {
  margin-bottom: var(--space-lg);
}

.hidden {
  display: none !important;
}

/* ========================================
   Recipe Specific
   ======================================== */
.recipe-meta {
  display: flex;
  gap: var(--space-md);
  color: var(--text-light);
  font-size: 0.85rem;
  margin-top: var(--space-xs);
}

.recipe-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.tag {
  background: rgba(78, 205, 196, 0.2);
  color: var(--secondary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ========================================
   Search & Filter Bar
   ======================================== */
.search-bar {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.search-bar input {
  flex: 1;
  min-width: 200px;
}

.search-bar select {
  min-width: 150px;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-light);
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

/* ========================================
   Loading
   ======================================== */
.loading {
  display: flex;
  justify-content: center;
  padding: var(--space-xl);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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


/* ========================================
   Favorites
   ======================================== */
.favorite-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
}

.favorite-btn:hover,
.favorite-btn.active {
  color: var(--danger);
}

.favorite-btn.active i {
  font-weight: 900;
}

/* ========================================
   Star Rating
   ======================================== */
.star-rating {
  display: flex;
  gap: 4px;
}

.star-rating i {
  color: var(--border);
  cursor: pointer;
  font-size: 1.2rem;
  transition: var(--transition);
}

.star-rating i:hover,
.star-rating i.active {
  color: var(--accent);
}

.star-rating.readonly i {
  cursor: default;
}

/* ========================================
   Dark Mode Toggle
   ======================================== */
.theme-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-dark);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.theme-toggle:hover {
  background: var(--bg-light);
}

/* ========================================
   Timer
   ======================================== */
.timer-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-md);
  z-index: 150;
  min-width: 200px;
  display: none;
}

.timer-widget.active {
  display: block;
}

.timer-display {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  font-family: monospace;
  color: var(--primary);
}

.timer-controls {
  display: flex;
  gap: var(--space-xs);
  justify-content: center;
  margin-top: var(--space-sm);
}

.timer-controls button {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

/* ========================================
   Recipe Scaling
   ======================================== */
.scaling-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
  padding: var(--space-sm);
  background: var(--bg-light);
  border-radius: var(--radius-md);
}

.scaling-control button {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: white;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scaling-control span {
  font-weight: 600;
  min-width: 80px;
  text-align: center;
}

/* ========================================
   Loading States
   ======================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

[data-theme="dark"] .loading-overlay {
  background: rgba(22, 33, 62, 0.9);
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-text {
  color: var(--text-light);
  font-size: 0.95rem;
}

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

.skeleton-card {
  height: 280px;
  border-radius: var(--radius-lg);
}

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

.skeleton-text.short {
  width: 60%;
}

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

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

/* ========================================
   Success Animations
   ======================================== */
@keyframes popIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

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

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

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

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

  100% {
    stroke-dashoffset: 0;
  }
}

.animate-pop {
  animation: popIn 0.3s ease-out;
}

.animate-slide {
  animation: slideUp 0.3s ease-out;
}

.animate-pulse {
  animation: pulse 0.3s ease-out;
}

/* Card hover animation */
.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Button click feedback */
.btn:active {
  transform: scale(0.96);
}

/* Success checkmark */
.success-check {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
  animation: popIn 0.4s ease-out;
}

.success-check i {
  color: white;
  font-size: 2.5rem;
}

/* ========================================
   Empty States
   ======================================== */
.empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  color: var(--text-light);
}

.empty-state-icon {
  width: 120px;
  height: 120px;
  margin: 0 auto var(--space-md);
  background: var(--bg-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon i {
  font-size: 3rem;
  color: var(--primary);
  opacity: 0.7;
}

.empty-state h3 {
  color: var(--text-dark);
  margin-bottom: var(--space-xs);
}

.empty-state p {
  margin-bottom: var(--space-md);
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* ========================================
   Confirmation Dialog
   ======================================== */
.confirm-dialog {
  text-align: center;
  padding: var(--space-md);
}

.confirm-dialog-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto var(--space-md);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.confirm-dialog-icon.warning {
  background: rgba(253, 203, 110, 0.2);
  color: var(--warning);
}

.confirm-dialog-icon.danger {
  background: rgba(214, 48, 49, 0.2);
  color: var(--danger);
}

.confirm-dialog-icon.success {
  background: rgba(0, 184, 148, 0.2);
  color: var(--success);
}

.confirm-dialog h3 {
  margin-bottom: var(--space-xs);
}

.confirm-dialog p {
  color: var(--text-light);
  margin-bottom: var(--space-md);
}

.confirm-dialog-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

/* ========================================
   Toast Improvements
   ======================================== */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: white;
  font-weight: 500;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: slideUp 0.3s ease-out;
  box-shadow: var(--shadow-lg);
}

.toast i {
  font-size: 1.2rem;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.toast.info {
  background: var(--text-dark);
}

.toast.warning {
  background: var(--warning);
  color: var(--text-dark);
}

/* ========================================
   Onboarding Tour
   ======================================== */
.tour-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 400;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.tour-overlay.active {
  opacity: 1;
  visibility: visible;
}

.tour-tooltip {
  position: absolute;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  max-width: 300px;
  box-shadow: var(--shadow-lg);
  z-index: 401;
  animation: popIn 0.3s ease-out;
}

.tour-tooltip::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--bg-white);
  transform: rotate(45deg);
}

.tour-tooltip.bottom::before {
  top: -6px;
  left: 50%;
  margin-left: -6px;
}

.tour-tooltip h4 {
  margin-bottom: var(--space-xs);
  color: var(--primary);
}

.tour-tooltip p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: var(--space-md);
}

.tour-progress {
  display: flex;
  gap: 4px;
  margin-bottom: var(--space-sm);
}

.tour-progress span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.tour-progress span.active {
  background: var(--primary);
}

.tour-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tour-skip {
  color: var(--text-light);
  font-size: 0.85rem;
  cursor: pointer;
}

.tour-skip:hover {
  color: var(--text-dark);
}

/* Highlight element during tour */
.tour-highlight {
  position: relative;
  z-index: 401;
  box-shadow: 0 0 0 4px var(--primary), 0 0 0 8px rgba(255, 107, 107, 0.3);
  border-radius: var(--radius-md);
}