/* FreeCooking.tools - Custom Styles */
/* Extends Tailwind with cooking-specific utilities */

/* Custom Properties - Design Tokens */
:root {
  /* Warm Kitchen Palette */
  --color-cream: #FFFBF7;
  --color-cream-dark: #FFF5EB;
  --color-white: #FFFFFF;

  /* Accent Colors */
  --color-terracotta: #E07A5F;
  --color-terracotta-dark: #C96A52;
  --color-amber: #F2CC8F;
  --color-amber-dark: #E5BC7A;
  --color-sage: #81B29A;
  --color-sage-dark: #6A9B82;

  /* Text Colors */
  --color-charcoal: #3D405B;
  --color-gray: #6B7280;
  --color-gray-light: #9CA3AF;

  /* Borders & Shadows */
  --color-border: #E5E1DA;
  --color-border-dark: #D1CCC3;

  /* Functional Colors */
  --color-warning: #F59E0B;
  --color-danger: #EF4444;
  --color-success: #22C55E;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(61, 64, 91, 0.05);
  --shadow-md: 0 4px 6px rgba(61, 64, 91, 0.07);
  --shadow-lg: 0 10px 15px rgba(61, 64, 91, 0.1);

  /* Touch Target Minimum */
  --touch-target: 48px;
}

/* Base Resets */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--color-cream);
  color: var(--color-charcoal);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile */
}

/* Focus States - Accessibility */
:focus-visible {
  outline: 2px solid var(--color-terracotta);
  outline-offset: 2px;
}

/* Touch-Friendly Inputs */
input[type="number"],
input[type="text"],
input[type="time"],
input[type="datetime-local"],
select,
button {
  min-height: var(--touch-target);
  font-size: 16px; /* Prevents iOS zoom on focus */
}

/* Number Input - Hide Spinners (cleaner mobile UX) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Custom Select Styling */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

/* Card Component */
.card {
  background: var(--color-white);
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

/* Input Group */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--color-gray);
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  background: var(--color-white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-group input:focus,
.input-group select:focus {
  border-color: var(--color-terracotta);
  box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.15);
}

/* Button Base */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--touch-target);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--color-terracotta-dark);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--color-cream-dark);
  color: var(--color-charcoal);
  border: 1px solid var(--color-border);
}

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

.btn-ghost {
  background: transparent;
  color: var(--color-terracotta);
}

.btn-ghost:hover {
  background: rgba(224, 122, 95, 0.1);
}

/* Result Display */
.result-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--color-charcoal);
}

.result-unit {
  font-size: 0.875rem;
  color: var(--color-gray);
  margin-left: 0.25rem;
}

/* Expandable Section */
.expandable-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.expandable-header:active {
  background: var(--color-cream-dark);
}

.expandable-icon {
  transition: transform 0.2s ease;
}

.expandable-icon.open {
  transform: rotate(180deg);
}

.expandable-content {
  display: none;
  padding: 0 1rem 1rem;
}

.expandable-content.open {
  display: block;
}

/* Source Citation */
.source-citation {
  font-size: 0.75rem;
  color: var(--color-gray-light);
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.source-citation a {
  color: var(--color-terracotta);
  text-decoration: none;
}

.source-citation a:hover {
  text-decoration: underline;
}

/* Warning/Info Boxes */
.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #92400E;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #991B1B;
}

.alert-info {
  background: rgba(129, 178, 154, 0.15);
  border: 1px solid rgba(129, 178, 154, 0.3);
  color: #1E5631;
}

/* Timeline (for Multi-Dish Planner) */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.625rem;
  top: 0.375rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--color-terracotta);
  border: 2px solid var(--color-white);
  box-shadow: var(--shadow-sm);
}

.timeline-item.active::before {
  background: var(--color-sage);
  box-shadow: 0 0 0 4px rgba(129, 178, 154, 0.3);
}

.timeline-item.warning::before {
  background: var(--color-warning);
}

/* Responsive Grid */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .tool-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .tool-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Page Container */
.page-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: 6rem; /* Space for mobile nav */
}

@media (min-width: 1024px) {
  .page-container {
    max-width: 1024px;
    padding: 2rem;
  }
}

/* Header */
.site-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header-inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-charcoal);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-logo:hover {
  color: var(--color-terracotta);
}

/* Navigation */
.nav-link {
  color: var(--color-gray);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: var(--color-charcoal);
  background: var(--color-cream-dark);
}

.nav-link.active {
  color: var(--color-terracotta);
  background: rgba(224, 122, 95, 0.1);
}

/* Tool Card (for homepage) */
.tool-card {
  background: var(--color-white);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  display: block;
}

.tool-card:hover {
  border-color: var(--color-terracotta);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.tool-card:active {
  transform: translateY(0);
}

.tool-card-icon {
  width: 3rem;
  height: 3rem;
  background: var(--color-cream-dark);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.tool-card-title {
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
  color: var(--color-charcoal);
}

.tool-card-desc {
  font-size: 0.875rem;
  color: var(--color-gray);
  line-height: 1.5;
}

/* Support Box */
.support-box {
  max-width: 500px;
  margin: 2rem auto;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
}

.support-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.support-links a,
.support-link-btn {
  color: var(--color-gray);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.support-links a:hover,
.support-link-btn:hover {
  color: var(--color-terracotta);
}

.support-divider {
  color: var(--color-gray-light);
}

.feedback-form-container {
  margin-top: 1rem;
  background: var(--color-cream-dark);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  text-align: left;
}

.feedback-field {
  margin-bottom: 0.75rem;
}

.feedback-field textarea,
.feedback-field input {
  width: 100%;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.625rem;
  color: var(--color-charcoal);
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
}

.feedback-field textarea:focus,
.feedback-field input:focus {
  outline: none;
  border-color: var(--color-terracotta);
}

.feedback-actions {
  display: flex;
  gap: 0.5rem;
}

.feedback-success {
  color: var(--color-success);
  padding: 1rem;
  text-align: center;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* Utility: Safe Area Padding (for notched phones) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .page-container {
    padding-bottom: calc(6rem + env(safe-area-inset-bottom));
  }
}

/* Print Styles */
@media print {
  .site-header,
  .btn,
  .no-print {
    display: none !important;
  }

  body {
    background: white;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
