/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=IBM+Plex+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&family=Inter:wght@100..900&display=swap');

/* Reset and Custom Variables */
:root {
  /* Colors */
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --secondary: #14B8A6;
  --secondary-hover: #0D9488;
  --tertiary: #F59E0B;
  --bg-color: #F3F4F6;
  --surface-color: #FFFFFF;
  --text-primary: #1F2937;
  --text-secondary: #4B5563;
  --text-tertiary: #9CA3AF;
  --border-color: #E5E7EB;
  
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --info: #6366F1;
  
  /* Fonts */
  --font-headline: 'Inter', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Shadows */
  --shadow-subtle: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-medium: 0 2px 6px 0 rgba(0, 0, 0, 0.06);
  --shadow-large: 0 6px 16px 0 rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 20px;
  color: var(--text-primary);
  background-color: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 24px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Container */
.app-container {
  width: 100%;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.app-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  background-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.app-title {
  font-family: var(--font-headline);
  font-size: 22px;
  font-weight: 700;
  line-height: 28px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.app-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Main Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
  gap: 16px;
  width: 100%;
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Sidebar column (left) and details column (right) */
.dashboard-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Widget Card styling */
.widget-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow-subtle);
  transition: box-shadow 150ms ease, transform 150ms ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.widget-card:hover {
  box-shadow: var(--shadow-medium);
}

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

.widget-overline {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.widget-title {
  font-family: var(--font-headline);
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
  color: var(--text-primary);
}

/* Form inputs & controls */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.text-input {
  width: 100%;
  height: 36px;
  border: 1px solid #D1D5DB;
  background-color: var(--surface-color);
  border-radius: 8px;
  padding: 0 12px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

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

.text-input:hover {
  border-color: #9CA3AF;
}

.text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}

/* Buttons */
.button-row {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 150ms ease;
  user-select: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #FFFFFF;
}

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

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

.btn-secondary:hover {
  background-color: #EEF2FF;
}

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

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Badge count */
.badge {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  background-color: #EEF2FF;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 9999px;
}

/* Results List Widget */
.results-container {
  max-height: 320px;
  overflow-y: auto;
  margin-right: -4px;
  padding-right: 4px;
}

/* Scrollbar styling */
.results-container::-webkit-scrollbar,
.details-content::-webkit-scrollbar {
  width: 4px;
}
.results-container::-webkit-scrollbar-track,
.details-content::-webkit-scrollbar-track {
  background: transparent;
}
.results-container::-webkit-scrollbar-thumb,
.details-content::-webkit-scrollbar-thumb {
  background: #E5E7EB;
  border-radius: 9999px;
}
.results-container::-webkit-scrollbar-thumb:hover,
.details-content::-webkit-scrollbar-thumb:hover {
  background: #D1D5DB;
}

.recipe-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.recipe-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 80ms ease, border-left 80ms ease;
  border-left: 2px solid transparent;
}

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

.recipe-item:hover {
  background-color: #F9FAFB;
}

.recipe-item:active {
  background-color: #EEF2FF;
}

.recipe-item.active {
  background-color: #EEF2FF;
  border-left-color: var(--primary);
}

.recipe-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
}

.recipe-item-name {
  font-family: var(--font-headline);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Info and Empty State alerts */
.info-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  color: var(--text-tertiary);
  gap: 8px;
}

.info-state-icon {
  font-size: 24px;
  color: var(--text-tertiary);
  opacity: 0.7;
}

.info-state-text {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Alert styles for empty queries or error states */
.alert-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background-color: #FEF2F2;
  border: 1px solid #FEE2E2;
  color: var(--error);
  font-size: 12px;
}

.alert-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background-color: #FEF3C7;
  border: 1px solid #FCD34D;
  color: #D97706;
  font-size: 12px;
  margin-top: 8px;
}

/* Recipe Details Widget Content */
.details-container {
  min-height: 480px;
  height: 100%;
}

.details-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.recipe-hero {
  position: relative;
  width: 100%;
  height: 180px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.recipe-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
  padding: 16px;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.recipe-detail-title {
  font-family: var(--font-headline);
  font-size: 17px;
  font-weight: 600;
  line-height: 24px;
  color: var(--text-primary);
  margin-top: 4px;
}

.section-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

/* Ingredient Chips Grid */
.ingredients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.ingredient-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-color);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.ingredient-bullet {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background-color: var(--secondary);
}

/* Instructions */
.instructions-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.instructions-text {
  font-size: 12px;
  line-height: 18px;
  color: var(--text-secondary);
  white-space: pre-line;
  background-color: #F9FAFB;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
}

/* Footer / Credits */
.app-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 24px;
}
