* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #e63946;
  --primary-dark: #d90429;
  --secondary-color: #1d3557;
  --light-color: #f1faee;
  --white: #ffffff;
  --light-gray: #f8f9fa;
  --gray: #6c757d;
  --accent: #00d4ff;
  --transition: all 0.3s ease;
}

body {
  font-family: 'Poppins', sans-serif;
  color: var(--secondary-color);
  background: linear-gradient(135deg, #f1faee 0%, #ffffff 100%);
  overflow-x: hidden;
}

.container {
  width: 90%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Header */
header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(230, 57, 70, 0.1);
  animation: slideDown 0.6s ease-out;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
}

.logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

nav ul {
  display: flex;
  gap: 25px;
  list-style: none;
}

@media (max-width: 768px) {
  nav ul {
    display: none;
  }
}

nav a {
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  color: var(--text-color);
  text-decoration: none;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}

nav a:hover::after { width: 100%; }

.btn-back {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: var(--white);
  padding: 10px 20px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-back:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 8px 20px rgba(230, 57, 70, 0.3); 
}

.mobile-menu { 
  display: none; 
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  color: var(--secondary-color);
  transition: var(--transition);
}
.mobile-menu:hover {
  color: var(--primary-color);
}

/* Page Header */
.page-header {
  background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
  color: var(--white);
  padding: 60px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-header h2 { 
  font-size: 2.5rem; 
  font-weight: 800; 
  margin-bottom: 10px; 
}

/* Main Content */
main { 
  padding: 60px 0; 
}

/* Goal Selection */
.goal-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.goal-card {
  background: var(--white);
  border-radius: 15px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  border: 3px solid transparent;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  animation: fadeInUp 0.8s ease-out backwards;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Poppins', sans-serif;
  position: relative;
  overflow: hidden;
}
.goal-card::before {
  content: '';
  position: absolute; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  opacity: 0; 
  transition: var(--transition); 
  z-index: 1;
}
.goal-card:focus { 
  outline: none; 
  border-color: var(--primary-color); 
  box-shadow: 0 0 0 3px rgba(230,57,70,.2); 
}
.goal-card>* { 
  position: relative; 
  z-index: 2; 
}
.goal-card:hover::before { 
  opacity: .05; 
}
.goal-card:nth-child(1){animation-delay:.1s} 
.goal-card:nth-child(2){animation-delay:.2s} 
.goal-card:nth-child(3){animation-delay:.3s}
.goal-card:hover { 
  transform: translateY(-10px); 
  box-shadow: 0 15px 40px rgba(230,57,70,.15); 
  border-color: var(--primary-color); 
}
.goal-icon { 
  font-size: 3rem; 
  margin-bottom: 15px; 
  animation: bounce 2s ease-in-out infinite; 
}
.goal-card h3 { 
  font-size: 1.4rem; 
  margin-bottom: 10px; 
  font-weight: 700; 
}
.goal-card p { 
  color: var(--gray); 
  font-size: .95rem; 
}

/* Modal */
.modal { 
  display:none; 
  position:fixed; 
  z-index:1000; 
  inset:0; 
  background-color:rgba(0,0,0,.6); 
  backdrop-filter:blur(5px); 
  align-items:center; 
  justify-content:center; 
  animation:fadeIn .3s ease-out; 
}
.modal.active { 
  display:flex; 
}
.modal-content { 
  background:var(--white); 
  padding:40px; 
  border-radius:20px; 
  width:90%; 
  max-width:500px; 
  box-shadow:0 20px 60px rgba(0,0,0,.3); 
  animation:slideUp .4s ease-out; 
  max-height:90vh; 
  overflow-y:auto; 
}
.modal-header { 
  display:flex; 
  justify-content:space-between; 
  align-items:center; 
  margin-bottom:25px; 
}
.modal-header h2 { 
  color:var(--secondary-color); 
  font-size:1.6rem; 
}
.close-btn { 
  background:none; 
  border:none; 
  font-size:1.8rem; 
  cursor:pointer; 
  color:var(--gray); 
}
.close-btn:hover { 
  color:var(--primary-color); 
}
.form-group { 
  margin-bottom:20px; 
}
.form-group label { 
  display:block; 
  margin-bottom:8px; 
  font-weight:600; 
  color:var(--secondary-color); 
}
.form-group input { 
  width:100%; 
  padding:12px 15px; 
  border:2px solid #e0e0e0; 
  border-radius:8px; 
  font-family:'Poppins', sans-serif; 
  font-size:1rem; 
  transition:var(--transition); 
}
.form-group input:focus { 
  outline:none; 
  border-color:var(--primary-color); 
  box-shadow:0 0 0 3px rgba(230,57,70,.1); 
}
.btn-submit { 
  width:100%; 
  padding:14px; 
  background:linear-gradient(135deg,var(--primary-color),var(--primary-dark)); 
  color:var(--white); 
  border:none; 
  border-radius:10px; 
  font-weight:700; 
  font-size:1rem; 
  cursor:pointer; 
  transition:var(--transition); 
}
.btn-submit:hover { 
  transform:translateY(-2px); 
  box-shadow:0 10px 30px rgba(230,57,70,.3); 
}

/* Nutrition Plan */
.nutrition-plan { 
  display:none; 
  animation:fadeInUp .8s ease-out; 
}
.plan-info { 
  background:linear-gradient(135deg,var(--primary-color),var(--primary-dark)); 
  color:var(--white); 
  padding:25px; 
  border-radius:15px; 
  margin-bottom:30px; 
}
.plan-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}
.plan-info h3 { 
  font-size:1.6rem; 
  margin: 0;
  flex: 1;
  min-width: 250px;
}
.plan-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-control {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 2px solid rgba(255,255,255,0.4);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
  white-space: nowrap;
}
.btn-control:hover {
  background: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.6);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.btn-control:active {
  transform: translateY(0);
}
.btn-control i {
  font-size: 0.95rem;
}
.plan-summary { 
  display:grid; 
  grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); 
  gap:15px; 
}
.summary-box { 
  background:rgba(255,255,255,.2); 
  padding:15px; 
  border-radius:10px; 
  backdrop-filter:blur(10px);
  text-align: center;
}
.summary-value { 
  font-size:1.4rem; 
  font-weight:800; 
}
.summary-label { 
  font-size:.8rem; 
  opacity:.9; 
  margin-top:5px; 
}

/* Table */
.table-container { 
  overflow-x:auto; 
  margin-bottom:30px; 
  position: relative;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) #f0f0f0;
}
.table-container::-webkit-scrollbar {
  height: 8px;
}
.table-container::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}
.table-container::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}
.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

.nutrition-table { 
  width:100%; 
  border-collapse:collapse; 
  table-layout:fixed; 
  background:var(--white); 
  border-radius:15px; 
  overflow:hidden; 
  box-shadow:0 4px 15px rgba(0,0,0,.08); 
}
.nutrition-table thead th { 
  background:linear-gradient(135deg,#e95a66,var(--primary-color)); 
  color:var(--white); 
  padding:16px 12px; 
  text-align:center; 
  font-weight:700; 
  letter-spacing:.3px;
  font-size: 0.95rem;
  border-right: 1px solid rgba(255,255,255,0.2);
}
.nutrition-table thead th:last-child {
  border-right: none;
}
.nutrition-table tbody th {
  background: linear-gradient(135deg, #fff3f4, #ffe5e8);
  color: var(--primary-color);
  font-weight: 700;
  font-size: 1rem;
  padding: 16px 12px;
  text-align: center;
  border-bottom: 2px solid var(--primary-color);
  border-right: 2px solid var(--primary-color);
}
.nutrition-table td { 
  padding:15px 12px; 
  border-bottom:1px solid #e0e0e0;
  border-right: 1px solid #f0f0f0; 
  background: #fff;
}
.nutrition-table tbody tr:nth-child(odd) td{ 
  background:#fafafa; 
}
.nutrition-table tbody tr:hover td{ 
  background:rgba(230,57,70,.03); 
}
.nutrition-table tr:last-child td{ 
  border-bottom:none; 
}
.nutrition-table tfoot th {
  background: linear-gradient(135deg, #2d4356, #1d3557);
  color: white;
  padding: 16px 12px;
  font-weight: 700;
  border-top: 3px solid var(--primary-color);
  text-align: center;
}
.day-name{ 
  font-weight:700; 
  color:var(--secondary-color); 
}
.meal-name{ 
  color:var(--primary-color); 
  font-weight:700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Sticky first column */
.nutrition-table thead th:first-child,
.nutrition-table tbody th:first-child,
.nutrition-table tfoot th:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  box-shadow: 3px 0 8px rgba(0,0,0,0.12);
}
.nutrition-table thead th:first-child { 
  z-index: 5; 
  background: linear-gradient(135deg,#e95a66,var(--primary-color)); 
  color: var(--white);
  font-weight: 800;
}
.nutrition-table tbody th {
  position: sticky;
  left: 0;
  z-index: 3;
  background: linear-gradient(135deg, #fff3f4, #ffe5e8) !important;
  box-shadow: 3px 0 8px rgba(0,0,0,0.12);
}
.nutrition-table tfoot th:first-child { 
  background: linear-gradient(135deg, #2d4356, #1d3557) !important;
  z-index: 4; 
  font-weight: 800;
  color: white;
}

/* Editable grid specifics */
.nutrition-grid .cell-items { 
  list-style:none; 
  margin:0; 
  padding:0; 
}
.nutrition-grid .cell-items li {
  margin-bottom: 10px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 6px;
  border-left: 3px solid var(--primary-color);
}
.nutrition-grid .cell-items li:last-child {
  margin-bottom: 0;
}
.nutrition-grid .food-line { 
  display:block;
  margin-bottom: 6px;
}
.nutrition-grid .food-line strong {
  display: block;
  color: var(--secondary-color);
  font-size: 0.95rem;
  margin-bottom: 4px;
  font-weight: 700;
}
.nutrition-grid td,
.nutrition-grid th,
.nutrition-grid .food-line strong,
.nutrition-grid .food-note { 
  word-break:break-word; 
  overflow-wrap:break-word; 
}
.nutrition-grid .food-macros{ 
  display: block;
  color: #555; 
  font-size: 0.85rem;
  background: white;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 4px;
}
.nutrition-grid .food-note{ 
  color: #666; 
  font-size: 0.8rem; 
  margin-top: 6px; 
  line-height: 1.4;
  font-style: italic;
  padding: 4px 8px;
  background: #fff;
  border-radius: 4px;
}
.nutrition-grid .food-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: flex-end;
}
.nutrition-grid .cell-total{ 
  margin-top: 15px; 
  padding: 10px;
  background: linear-gradient(135deg, #e8f5e9, #fff);
  border-left: 4px solid #4caf50;
  border-radius: 6px;
  font-weight: 700; 
  color: var(--secondary-color);
  font-size: 0.9rem;
}
.nutrition-grid .cell-actions{ 
  margin-top: 12px;
  text-align: center;
}
.nutrition-grid .empty{ 
  color: var(--gray); 
  font-style: italic; 
  text-align: center;
  padding: 30px 10px;
  background: #f9f9f9;
  border-radius: 8px;
}
.nutrition-grid th, 
.nutrition-grid td{ 
  vertical-align: top; 
}
.nutrition-grid th:not(:first-child), 
.nutrition-grid td{ 
  min-width: 280px; 
  max-width: 350px;
}
.nutrition-grid .day-total {
  font-size: 0.9rem;
  line-height: 1.6;
}
.nutrition-grid .day-total span {
  display: block;
  font-size: 0.85rem;
  margin-top: 4px;
  opacity: 0.9;
}
.meal-actions { 
  display:flex; 
  gap:8px; 
}
.btn-small { 
  padding:6px 12px; 
  background:transparent; 
  border:1px solid #e0e0e0; 
  border-radius:6px; 
  cursor:pointer; 
  font-size:.8rem; 
  transition:var(--transition); 
  color:var(--gray);
  font-family: 'Poppins', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.btn-small:hover { 
  background:var(--primary-color); 
  color:var(--white); 
  border-color:var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.2);
}
.btn-small:active {
  transform: translateY(0);
}

/* Export Buttons - İndirme Butonları */
.export-buttons { 
  display: flex !important; 
  gap: 20px; 
  margin: 40px auto !important;
  padding: 30px !important;
  justify-content: center !important; 
  align-items: center;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #ffffff, #f8f9fa) !important;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.08) !important;
  max-width: 600px !important;
  width: 100%;
}
.btn-export { 
  padding: 18px 40px !important; 
  border-radius: 14px; 
  border: none; 
  font-weight: 700 !important; 
  font-size: 1.05rem !important; 
  cursor: pointer; 
  transition: all 0.3s ease; 
  display: inline-flex !important; 
  align-items: center; 
  justify-content: center;
  gap: 12px;
  font-family: 'Poppins', sans-serif;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,.15) !important;
  min-width: 180px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px;
}
.btn-export i {
  font-size: 1.3rem !important;
}
.btn-pdf { 
  background: linear-gradient(135deg, #e63946, #c82333) !important; 
  color: #ffffff !important; 
}
.btn-pdf:hover { 
  transform: translateY(-4px) scale(1.05); 
  box-shadow: 0 12px 35px rgba(230,57,70,.5) !important; 
  background: linear-gradient(135deg, #ff4757, #e63946) !important;
}
.btn-png { 
  background: linear-gradient(135deg, #00b4d8, #0096c7) !important; 
  color: #ffffff !important; 
}
.btn-png:hover { 
  transform: translateY(-4px) scale(1.05); 
  box-shadow: 0 12px 35px rgba(0,180,216,.5) !important;
  background: linear-gradient(135deg, #00d4ff, #00b4d8) !important;
}
.btn-export:active {
  transform: translateY(0) scale(1) !important;
  box-shadow: 0 4px 15px rgba(0,0,0,.2) !important;
}

/* Animations */
@keyframes fadeInUp { 
  from { 
    opacity:0; 
    transform: translateY(30px);
  } 
  to{ 
    opacity:1; 
    transform: translateY(0);
  } 
}
@keyframes slideUp { 
  from { 
    opacity:0; 
    transform: translateY(30px) scale(.95);
  } 
  to{ 
    opacity:1; 
    transform: translateY(0) scale(1);
  } 
}
@keyframes slideDown { 
  from { 
    opacity:0; 
    transform: translateY(-10px);
  } 
  to { 
    opacity:1; 
    transform: translateY(0);
  } 
}
@keyframes fadeIn { 
  from { 
    opacity:0;
  } 
  to { 
    opacity:1;
  } 
}
@keyframes bounce { 
  0%,100%{ 
    transform: translateY(0);
  } 
  50%{ 
    transform: translateY(-10px);
  } 
}

/* Responsive */
@media (max-width: 768px) {
  header .container { 
    position: relative; 
    flex-wrap: wrap;
  }
  .mobile-menu {
    display: block;
  }
  nav { 
    order: 3;
    width: 100%;
    position: relative;
  }
  nav ul { 
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 10px 0;
    z-index: 1000;
  }
  nav ul.active { 
    display: flex !important; 
  }
  nav ul li { 
    margin: 0; 
    width: 100%;
  }
  nav ul li a {
    display: block;
    padding: 12px 16px;
    border-radius: 8px;
    transition: var(--transition);
  }
  nav ul li a:hover {
    background: rgba(230, 57, 70, 0.1);
  }
  .page-header h2 { 
    font-size:1.8rem; 
  }
  .container { 
    padding: 0 1.5rem; 
  }
  .modal-content { 
    width:95%; 
    padding:30px 20px;
    max-height: 85vh;
  }
  .nutrition-table th, .nutrition-table td { 
    padding:10px 8px; 
    font-size:.85rem; 
  }
  .nutrition-grid th:not(:first-child), 
  .nutrition-grid td { 
    min-width: 220px;
    max-width: 280px;
  }
  .goal-cards {
    grid-template-columns: 1fr;
  }
  .plan-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .page-header { 
    padding:24px 0; 
  }
  .page-header h2 { 
    font-size:1.4rem; 
  }
  .page-header p {
    font-size: 0.9rem;
  }
  .container { 
    padding: 0 1rem; 
  }
  .goal-card { 
    padding:20px; 
  }
  .goal-icon { 
    font-size:2.5rem; 
  }
  .modal-content { 
    border-radius:15px;
    padding: 20px 15px;
  }
  .modal-header h2 {
    font-size: 1.3rem;
  }
  .nutrition-table th, .nutrition-table td { 
    padding:8px 6px; 
    font-size:.8rem; 
  }
  .nutrition-grid th:not(:first-child), 
  .nutrition-grid td { 
    min-width: 200px;
    max-width: 250px;
  }
  .btn-small { 
    padding:6px 10px; 
    font-size:.75rem; 
  }
  .macro-badge { 
    display:inline-block; 
    margin-bottom:3px;
    font-size: 0.75rem;
  }
  .plan-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .summary-value {
    font-size: 1.2rem;
  }
  .summary-label {
    font-size: 0.75rem;
  }
  .food-macros {
    font-size: 0.78rem;
  }
  .food-note {
    font-size: 0.75rem;
  }
  .plan-info h3 {
    font-size: 1.2rem;
  }
  .btn-control {
    font-size: 0.85rem;
    padding: 8px 16px;
  }
  .btn-export {
    padding: 16px 28px !important;
    font-size: 0.95rem !important;
    min-width: auto !important;
  }
  .export-buttons {
    padding: 20px 15px !important;
    gap: 15px;
    margin: 30px 10px !important;
    max-width: 100% !important;
  }
}

/* Kompakt boşluk ayarları */
.page-header { 
  padding: 32px 0; 
}
main { 
  padding: 24px 0 32px; 
}
.goal-cards { 
  gap: 16px; 
  margin-bottom: 24px; 
}
.goal-card { 
  padding: 24px; 
}
.ad { 
  margin: 16px 0; 
}
.ad.ad-inarticle ins.adsbygoogle { 
  min-height: 180px; 
  display: block; 
}

@media (max-width: 768px) {
  .page-header { 
    padding: 32px 0; 
  }
  main { 
    padding: 16px 0 24px; 
  }
  .goal-card { 
    padding: 20px; 
  }
  .ad { 
    margin: 12px 0; 
  }
  .nutrition-grid th:not(:first-child), 
  .nutrition-grid td { 
    min-width: 200px; 
  }
  .nutrition-table { 
    table-layout: auto; 
  }
}
