:root {
  --bg-dark: #070a10;
  --bg-pattern: radial-gradient(circle, rgba(0, 229, 255, 0.12) 1px, transparent 1px);
  --card-bg-white: #ffffff;
  --card-bg-dark: #0f172a;
  
  --neo-black: #000000;
  --neo-border: 2.5px solid #000000;
  --neo-shadow: 4px 4px 0px #000000;
  --neo-shadow-sm: 2.5px 2.5px 0px #000000;
  --neo-shadow-turquoise: 4px 4px 0px #00e5ff;
  --neo-shadow-amber: 4px 4px 0px #f59e0b;
  --neo-shadow-hover: 1px 1px 0px #000000;

  --turquoise: #00e5ff;
  --turquoise-hover: #00c4dc;
  --lime: #10b981;
  --amber: #fbbf24;
  --rose: #f43f5e;
  
  --text-dark: #000000;
  --text-light: #f8fafc;
  --text-muted: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  background-image: var(--bg-pattern);
  background-size: 18px 18px;
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-bottom: 90px;
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 10, 16, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: var(--neo-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: #fff;
  border: 2px solid #000;
  border-radius: var(--radius-sm);
  padding: 2px;
  box-shadow: 2px 2px 0px #00e5ff;
}

.brand-info h1 {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #fff;
  text-shadow: 2px 2px 0px #000;
}

.brand-info p {
  font-size: 0.7rem;
  color: var(--turquoise);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.date-selector-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: var(--neo-border);
  box-shadow: var(--neo-shadow-sm);
}

.date-btn {
  background: none;
  border: none;
  color: #000;
  font-weight: 900;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 0.9rem;
}

.date-btn:active {
  transform: scale(0.9);
}

.current-date-input {
  background: transparent;
  border: none;
  color: #000;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  outline: none;
}

/* Container */
.container {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view-panel {
  display: none;
  animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-panel.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Neo-Brutalist White Cards */
.card-neo-white {
  background: var(--card-bg-white);
  color: var(--text-dark);
  border: var(--neo-border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--neo-shadow);
  position: relative;
}

.card-neo-dark {
  background: #0d1424;
  color: var(--text-light);
  border: var(--neo-border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--neo-shadow-turquoise);
  position: relative;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Neo Badges */
.badge-neo {
  background: var(--turquoise);
  color: #000;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  text-transform: uppercase;
}

/* Progress Hero Banner (-9.6 kg Emek Rozeti) */
.hero-progress-banner {
  background: linear-gradient(135deg, #00e5ff 0%, #00b4d8 100%);
  color: #000;
  border: var(--neo-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--neo-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-progress-text h2 {
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1.2;
}

.hero-progress-text p {
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 3px;
  opacity: 0.9;
}

.hero-lost-pill {
  background: #fff;
  border: var(--neo-border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  text-align: center;
  box-shadow: var(--neo-shadow-sm);
  white-space: nowrap;
}

.hero-lost-pill .val {
  font-size: 1.6rem;
  font-weight: 900;
  color: #000;
  line-height: 1;
}

.hero-lost-pill .lbl {
  font-size: 0.65rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Graph Controls Tabs */
.graph-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.graph-tab-btn {
  flex: 1;
  background: #fff;
  color: #000;
  border: var(--neo-border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--neo-shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.graph-tab-btn.active {
  background: var(--turquoise);
  box-shadow: 3px 3px 0px #000;
  transform: translate(-1px, -1px);
}

.graph-tab-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #000;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 230px;
}

/* 3-Col Metrics Grid inside White Card */
.neo-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.neo-metric-box {
  background: #f1f5f9;
  border: 2px solid #000;
  border-radius: var(--radius-md);
  padding: 10px 6px;
  text-align: center;
  box-shadow: 2px 2px 0px #000;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.neo-metric-box.dark {
  background: #1e293b;
  border-color: #00e5ff;
  color: #fff;
  box-shadow: 2px 2px 0px #00e5ff;
}

.neo-metric-box .lbl {
  font-size: 0.68rem;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
}

.neo-metric-box.dark .lbl {
  color: #94a3b8;
}

.neo-metric-box .val {
  font-size: 1.15rem;
  font-weight: 900;
  color: #000;
}

.neo-metric-box.dark .val {
  color: #00e5ff;
}

.neo-metric-box .sub {
  font-size: 0.62rem;
  font-weight: 700;
  color: #94a3b8;
}

/* Deficit Hero inside Card */
.deficit-hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: var(--neo-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--neo-shadow-sm);
  margin-top: 10px;
}

.deficit-badge-big {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  color: #059669;
}

/* Action Banner (Sync Button) */
.sync-action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #000;
  border: 2.5px solid #00e5ff;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: 4px 4px 0px #00e5ff;
}

.sync-action-card h3 {
  font-size: 0.95rem;
  font-weight: 900;
  color: #fff;
}

.sync-action-card p {
  font-size: 0.72rem;
  color: var(--turquoise);
  font-weight: 700;
  margin-top: 2px;
}

/* Neo-Brutalist Buttons */
.btn-neo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 900;
  cursor: pointer;
  border: var(--neo-border);
  box-shadow: var(--neo-shadow);
  transition: all 0.12s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-neo:hover {
  transform: translate(-1.5px, -1.5px);
  box-shadow: 5px 5px 0px #000;
}

.btn-neo:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px #000;
}

.btn-neo-turquoise {
  background: var(--turquoise);
  color: #000;
}

.btn-neo-white {
  background: #fff;
  color: #000;
}

.btn-neo-amber {
  background: #fbbf24;
  color: #000;
}

.btn-neo-block {
  width: 100%;
}

/* Search Bar (Notlarda Ara...) */
.neo-search-bar {
  width: 100%;
  background: #fff;
  border: var(--neo-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  color: #000;
  outline: none;
  box-shadow: var(--neo-shadow-sm);
  margin-bottom: 12px;
}

.neo-search-bar::placeholder {
  color: #94a3b8;
  font-weight: 600;
}

.neo-search-bar:focus {
  border-color: #000;
  box-shadow: 3px 3px 0px var(--turquoise);
}

/* Database Table */
.db-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: var(--neo-border);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--neo-shadow-sm);
}

.db-table-container::-webkit-scrollbar {
  height: 8px;
}

.db-table-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.db-table-container::-webkit-scrollbar-thumb {
  background: var(--turquoise);
  border: 1.5px solid #000;
  border-radius: 4px;
}

.neo-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.neo-table th {
  background: #0f172a;
  color: #fff;
  font-weight: 900;
  text-transform: uppercase;
  padding: 10px 8px;
  border-bottom: 2px solid #000;
  white-space: nowrap;
}

.neo-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 700;
  color: #000;
  height: 52px;
  white-space: nowrap;
  vertical-align: middle;
  box-sizing: border-box;
}

.table-cell-notes {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.74rem;
  line-height: 1.35;
  color: #334155;
  padding-right: 28px;
}

.neo-table tr:last-child td {
  border-bottom: none;
}

.neo-table tr:nth-child(even) {
  background: #f8fafc;
}

.neo-table tr.highlighted {
  background: #e0f2fe;
}

.badge-calorie {
  background: #fef3c7;
  color: #b45309;
  border: 1.5px solid #000;
  border-radius: 6px;
  padding: 2px 6px;
  font-weight: 900;
  font-size: 0.7rem;
}

/* Bottom Tab Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(7, 10, 16, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: var(--neo-border);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: space-around;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: #94a3b8;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-item .nav-icon {
  font-size: 1.3rem;
}

.nav-item.active {
  color: var(--turquoise);
  background: rgba(0, 229, 255, 0.1);
  border-radius: var(--radius-md);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
  filter: drop-shadow(0 0 6px var(--turquoise));
}

/* Modal Action Sheet */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.action-sheet {
  width: 100%;
  max-width: 500px;
  background: #fff;
  border: var(--neo-border);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: 22px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.5);
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.action-sheet-title {
  font-size: 1.1rem;
  font-weight: 900;
  text-align: center;
  color: #000;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* Chat Assistant Panel */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 420px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 4px 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.chat-bubble {
  max-width: 90%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.5;
  border: var(--neo-border);
  box-shadow: var(--neo-shadow-sm);
  word-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
  height: auto;
  max-height: none;
  overflow: visible;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: #ffffff;
  color: #000000;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--turquoise);
  color: #000000;
}

.quick-prompts {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0 10px 0;
  scrollbar-width: none;
}

.quick-prompts::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  white-space: nowrap;
  background: #fff;
  border: var(--neo-border);
  color: #000;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--neo-shadow-sm);
}

.chip-btn:hover {
  background: var(--turquoise);
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  background: #fff;
  border: var(--neo-border);
  border-radius: var(--radius-pill);
  padding: 4px 6px 4px 10px;
  box-shadow: var(--neo-shadow-sm);
  align-items: center;
}

.chat-photo-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 1.5px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: transform 0.1s ease, background-color 0.1s ease;
  flex-shrink: 0;
  padding: 0;
}

.chat-photo-btn:hover {
  background: var(--turquoise);
}

.chat-photo-btn:active {
  transform: scale(0.92);
}

.chat-image-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: var(--neo-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-bottom: 8px;
}

.chat-attached-img {
  max-width: 100%;
  max-height: 220px;
  border-radius: 6px;
  border: 1.5px solid #000;
  margin-bottom: 8px;
  display: block;
  object-fit: cover;
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #000;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--turquoise);
  border: var(--neo-border);
  color: #000;
  cursor: pointer;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 1.5px 1.5px 0px #000;
}

/* Toast */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #000;
  border: 2px solid var(--turquoise);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Form inputs in Meal/Settings */
.neo-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  width: 100%;
  box-sizing: border-box;
}

.neo-form-label {
  font-size: 0.78rem;
  font-weight: 900;
  color: #000;
  text-transform: uppercase;
}

.neo-form-input, .neo-form-select, .neo-form-textarea {
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
  background: #f8fafc;
  border: var(--neo-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  color: #000;
  outline: none;
}

.neo-form-input:focus, .neo-form-select:focus, .neo-form-textarea:focus {
  background: #fff;
  border-color: var(--turquoise);
  box-shadow: 2px 2px 0px #000;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2.5px solid #000;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* Multi-Photo Meal Thumbnails Grid */
.meal-thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 6px;
}

.meal-thumb-card {
  position: relative;
  border: var(--neo-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #0f172a;
  box-shadow: var(--neo-shadow-sm);
}

.meal-thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.meal-thumb-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: #ef4444;
  color: #fff;
  border: 1.5px solid #000;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 1px 1px 0 #000;
  line-height: 1;
  padding: 0;
  z-index: 2;
}

.meal-thumb-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.82);
  color: #00e5ff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #000;
  z-index: 2;
}
