/* --- CSS KODU (UYUMLU VERSİYON) --- */
:root {
    --primary-color: #00c853; 
    --secondary-color: #00bfa5;
    --accent-color: #ffc400; 
    --background-start: #e0f2f1; 
    --background-end: #dcedc8;   
    --text-color: #0d1b1e;
    --heading-color: #003e29; 
    --header-start: #004d40;
    --header-end: #00695c;
    --footer-start: #00251a;
    --footer-end: #003e29;
    --shadow-color: rgba(0, 0, 0, 0.15);
    
    --font-family-headings: 'Montserrat', sans-serif;
    --font-family-sans-serif: 'Roboto', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-family-sans-serif);
    color: var(--text-color);
    background: linear-gradient(175deg, var(--background-start) 0%, var(--background-end) 100%);
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
main { flex: 1 0 auto; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* K R İ T İ K : GİZLEME KURALI */
.hidden-step {
    display: none !important; 
}
/* ------------------------------- */

/* --- HEADER --- */
.header {
    background: linear-gradient(to right, var(--header-start), var(--header-end));
    box-shadow: 0 5px 20px var(--shadow-color);
    position: fixed; width: 100%; top: 0; z-index: 1000;
    border-bottom: 2px solid var(--accent-color);
}
.nav { display: flex; justify-content: space-between; align-items: center; height: 75px; }
.nav-logo { text-decoration: none; font-family: var(--font-family-headings); font-weight: 800; font-size: 1.5rem; color: #fff; display: flex; align-items: center; }
.nav-logo i { color: var(--accent-color); font-size: 1.8rem; margin-right: 10px; }

.nav-links { display: flex; gap: 25px; list-style: none; }
.nav-link {
    color: #fff; font-weight: 700; font-size: 1rem; position: relative; padding: 8px 16px;
    border-radius: 20px; transition: all 0.3s ease; letter-spacing: 0.5px; text-decoration: none;
    display: flex; align-items: center;
}
.nav-link i { margin-right: 5px; }
.nav-link:hover, .nav-link.active { background-color: var(--accent-color); color: var(--heading-color); transform: translateY(-3px); }

/* --- HERO & ABOUT STYLES (Modernize Edildi) --- */
.hero { position: relative; height: 100vh; color: #fff; display: flex; justify-content: center; align-items: center; text-align: center; overflow: hidden; padding-top: 75px; }
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://c4.wallpaperflare.com/wallpaper/522/739/723/sunset-sky-clouds-field-wallpaper-preview.jpg') no-repeat center center/cover;
    background-color: #333; /* Resim yüklenmezse diye */
    filter: brightness(0.5);
    z-index: -2;
    animation: heroZoom 20s infinite alternate;
}
.hero::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.7) 100%); z-index: -1; }
.hero-content {
    animation: fadeInDown 1.2s ease-out 0.5s both;
    max-width: 800px;
    background: rgba(0, 50, 35, 0.6); /* Yarı şeffaf panel */
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    backdrop-filter: blur(5px); /* Hafif bulanıklık efekti */
}
.hero-tag { background: var(--primary-color); color: white; padding: 5px 15px; border-radius: 20px; font-weight: 700; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; }
.hero-title { font: 800 3.5rem var(--font-family-headings); margin: 20px 0 1rem; line-height: 1.2; }
.hero-subtitle { font: 300 1.5rem var(--font-family-sans-serif); margin-bottom: 2.5rem; opacity: 0.9; }

.btn { padding: 16px 40px; border-radius: 50px; font-weight: 700; cursor: pointer; transition: all 0.3s ease; display: inline-flex; align-items: center; gap: 10px; border: none; font-size: 1.1rem; text-decoration: none; }
.btn-primary { background: var(--accent-color); color: var(--heading-color); box-shadow: 0 5px 25px rgba(255, 196, 0, 0.5); }
.btn-primary:hover { background-color: #ffdd44; transform: translateY(-5px) scale(1.05); box-shadow: 0 10px 30px rgba(255, 196, 0, 0.6); }
.btn-outline { background: transparent; border: 2px solid white; color: white; }
.btn-outline:hover { background: white; color: var(--heading-color); }


/* About Grid ve Stats */
.section-padding { padding: 80px 0; }
.about-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 50px; align-items: center; }
.section-title { font-family: var(--font-family-headings); font-size: 2.5rem; margin-bottom: 20px; color: var(--heading-color); }
.highlight { color: var(--primary-color); }
.about-image img { width: 100%; border-radius: 15px; box-shadow: 0 15px 40px var(--shadow-color); }
.stats-row { display: flex; justify-content: space-between; gap: 20px; margin-top: 30px; }
.stat-item { text-align: center; background: #fff; padding: 20px; border-radius: 10px; box-shadow: 0 8px 15px var(--shadow-color); border-bottom: 4px solid var(--primary-color); }
.stat-num { display: block; font-size: 2rem; font-weight: 700; color: var(--primary-color); }
.stat-label { font-size: 0.9rem; color: #6b7280; }

/* --- SUB-PAGES --- */
.page {
    display: none; /* Sayfadan tamamen kaldır (yer kaplamaz) */
    padding: 120px 0 80px; 
    animation: none;
}

.page.active {
    display: block; /* Sayfaya geri ekle */
    animation: fadeIn 0.5s ease-in-out; /* Yumuşak giriş efekti */
}

.page-header { text-align: center; margin-bottom: 60px; }
.page-header h2 { font-size: 3rem; font-family: var(--font-family-headings); color: var(--heading-color); text-shadow: 1px 1px 3px var(--shadow-color); margin-bottom: 0.5rem; }
.page-header p { font-size: 1.2rem; color: #444; max-width: 700px; margin: 0 auto; }


.disease-detection-section {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap; /* Küçük ekranlarda alt alta gelmesini sağlar */
}

.detection-form-container, .detection-results-container {
  flex: 1;
  min-width: 300px; /* Küçük ekranlarda daralmayı önler */
}

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--primary-color);
}

select, input[type="file"] {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box; /* Padding'in genişliği etkilememesi için */
}

input[type="file"] {
  padding: 0.5rem;
}

.file-upload-wrapper {
  position: relative;
  overflow: hidden;
  display: inline-block;
  width: 100%;
}

.file-upload-button {
  border: 2px solid var(--primary-color);
  background-color: var(--primary-color);
  color: white;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  text-align: center;
  transition: background-color 0.3s ease, color 0.3s ease;
  font-weight: 500;
}

.file-upload-button:hover {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
}

.file-upload-wrapper input[type="file"] {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  cursor: pointer;
}


.predict-button {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem 2rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 500;
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  transition: background-color 0.3s ease;
}

.predict-button:hover {
  background-color: var(--secondary-color);
}

#imagePreview {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin-top: 1rem;
  display: none; /* Varsayılan olarak gizli */
}

#predictionResults {
  margin-top: 1.5rem;
  font-size: 1.1rem;
}

#predictionResults p {
  margin-bottom: 0.5rem;
}

#predictionResults strong {
  color: var(--primary-color);
}

/* --- Yeni Mahsul Seçim Izgarası --- */
.category-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.category-tab {
    padding: 10px 20px;
    border: none;
    background-color: #f1f5f9;
    color: #666;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
}

.category-tab:hover {
    background-color: #e0f2f1;
    color: var(--heading-color);
}

.category-tab.active {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.3);
    transform: translateY(-2px);
}

.crop-grid-container {
    position: relative;
    min-height: 200px; /* İçerik yüklenirken zıplamayı önler */
}

.crop-grid { 
    display: none; /* Varsayılan olarak tüm ızgaraları gizle */
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); 
    gap: 15px; 
    animation: fadeIn 0.4s;
}

.crop-grid.active {
    display: grid; /* Sadece aktif olanı göster */
}

.crop-card { background: #f8fafc; border: 2px solid #e2e8f0; border-radius: 12px; padding: 15px 10px; text-align: center; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.crop-card:hover { transform: translateY(-5px); box-shadow: 0 8px 15px rgba(0,0,0,0.1); border-color: var(--secondary-color); }
.crop-card.selected { border-color: var(--primary-color); background-color: #e0f2f1; box-shadow: 0 5px 20px rgba(0, 200, 83, 0.3); transform: translateY(-5px) scale(1.05); }
.crop-card img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; background-color: #e2e8f0; border: 2px solid white; }
.crop-card span { font-weight: 700; color: var(--heading-color); font-size: 0.9rem; display: block; }

/* Mahsul Önizleme Kartı */
.crop-preview-card { display: flex; align-items: center; gap: 15px; background: #f1f5f9; padding: 15px; border-radius: 12px; border-left: 4px solid var(--accent-color); animation: fadeInDown 0.4s; margin-top: 20px; }
.crop-preview-card img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.crop-preview-info h4 { margin: 0; font-size: 1rem; }
.uploaded-preview { width: 100%; max-height: 250px; object-fit: cover; border-radius: 10px; margin-top: 15px; border: 2px solid var(--primary-color); }

/* Dosya Yükleme Alanı */
.upload-area { border: 3px dashed #a5d6a7; border-radius: 15px; padding: 40px 20px; background-color: #f1f8e9; transition: all 0.3s ease; text-align: center; }
.upload-area:hover { background-color: #e8f5e9; border-color: var(--primary-color); }
.upload-label-content { display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.upload-label-content .icon-box { width: 70px; height: 70px; background-color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 20px; box-shadow: 0 5px 15px rgba(0,0,0,0.08); transition: all 0.3s ease; border: 2px solid #fff; }
.upload-area:hover .icon-box { transform: scale(1.1); border-color: var(--primary-color); }
.upload-label-content p { font-size: 1.1rem; font-weight: 700; color: var(--heading-color); margin: 0; margin-bottom: 5px; }
.file-name { margin-top: 15px; font-style: italic; color: #555; font-weight: 500; word-break: break-all; }

.btn-full { width: 100%; padding: 18px; }

/* Sonuç Alanı */
.detect-result { background: #fff; padding: 30px; border-radius: 15px; box-shadow: 0 10px 30px var(--shadow-color); }
.result-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; padding-bottom: 15px; margin-bottom: 20px; }
.result-header h3 { margin: 0; font-family: var(--font-family-headings); }
.result-header .close-result { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #999; }
.loading-spinner { text-align: center; }
.loading-spinner .circle { border: 5px solid rgba(0,0,0,0.1); border-top: 5px solid var(--primary-color); border-radius: 50%; width: 60px; height: 60px; animation: spin 1s linear infinite; margin: 20px auto; }
.diagnosis-box { background: #f0f9ff; padding: 20px; border-radius: 10px; text-align: center; margin-bottom: 20px; }
.diagnosis-box .label { font-weight: 700; font-size: 1rem; color: #555; }
.diagnosis-title { font-size: 2rem; color: var(--heading-color); margin: 5px 0 15px; }
.confidence-bar { background: #dcfce7; border-radius: 10px; height: 20px; overflow: hidden; margin-bottom: 5px; }
.confidence-bar .fill { background: var(--primary-color); height: 100%; width: 0%; transition: width 1s ease-out; }
.ai-advice-box { background: #f1f5f9; padding: 20px; border-radius: 10px; }
.ai-header { font-weight: 700; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 1.1rem; }

/* --- Takvim & Kütüphane --- */
.calendar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 30px; }
.calendar-card { background: #fff; border-radius: 15px; box-shadow: 0 10px 25px var(--shadow-color); overflow: hidden; display: flex; flex-direction: column; transition: all 0.3s ease; }
.calendar-card:hover { transform: translateY(-10px); box-shadow: 0 15px 35px rgba(0,0,0,0.15); }
.calendar-card-header { padding: 20px; background: var(--header-start); color: #fff; text-align: center; }
.calendar-card-header h3 { font-family: var(--font-family-headings); font-size: 1.5rem; margin: 0; }
.calendar-card-body { padding: 25px; flex-grow: 1; }
.timeline { position: relative; list-style: none; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; top: 5px; left: 0; width: 3px; height: calc(100% - 10px); background: #e0f2f1; }
.timeline-item { margin-bottom: 25px; position: relative; padding-left: 30px; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-icon { position: absolute; left: -11px; top: 0; width: 25px; height: 25px; border-radius: 50%; background: #fff; border: 3px solid var(--primary-color); display: flex; align-items: center; justify-content: center; font-size: 1rem; color: var(--primary-color); }
.timeline-item.pesticide .timeline-icon { border-color: var(--accent-color); color: var(--accent-color); }
.timeline-item.harvesting .timeline-icon { border-color: var(--secondary-color); color: var(--secondary-color); }
.timeline-content h4 { font-size: 1.1rem; font-weight: 700; color: var(--heading-color); margin-bottom: 2px; }
.timeline-content span { font-size: 0.9rem; color: #555; font-weight: 500; }
.disease-card-title { display: flex; align-items: center; gap: 15px; margin-bottom: 10px; }
.disease-card-title h3 { margin-bottom: 0; }
.crop-icon { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

/* --- Pazar Fiyatları --- */
.price-table-container { background: #fff; border-radius: 15px; box-shadow: 0 10px 30px var(--shadow-color); padding: 20px; overflow-x: auto; }
.price-table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
.price-table th, .price-table td { padding: 15px 20px; border-bottom: 1px solid #eaf2f1; vertical-align: middle; }
.price-table thead { background: var(--header-start); color: #fff; font-family: var(--font-family-headings); font-size: 1.05rem; letter-spacing: 0.5px; }
.price-table th .fas { margin-right: 10px; color: var(--accent-color); width: 20px; text-align: center; }
.price-table tbody tr:nth-child(even) { background-color: #f8fcfb; }
.price-table tbody tr:hover { background-color: #e0f2f1; }
.price-table td { color: #333; font-weight: 500; }
.price-table .product-name { font-weight: 700; color: var(--heading-color); }

/* --- FOOTER --- */
.footer { background: linear-gradient(to right, var(--footer-start), var(--footer-end)); color: #e9ecef; padding: 40px 0; text-align: center; font-size: 1rem; margin-top: 80px; border-top: 2px solid var(--accent-color); }

/* --- RESPONSIVE & ANIMATIONS --- */
@keyframes heroZoom { from { transform: scale(1); } to { transform: scale(1.15); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@media (max-width: 992px) {
    .about-grid { grid-template-columns: 1fr; }
    .about-image { order: -1; margin-bottom: 30px; }
    .detect-wrapper { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .hero-title { font-size: 2.8rem; }
    .hero-subtitle { font-size: 1.2rem; }
    .page-header h2 { font-size: 2.2rem; }
    .crop-grid { grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); gap: 10px; }
    .calendar-grid, .disease-grid { grid-template-columns: 1fr; }
    .price-table-container { padding: 0; }
    .price-table th, .price-table td { padding: 12px 15px; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 2.2rem; }
    .hero-subtitle { font-size: 1.1rem; }
    .btn { padding: 12px 25px; font-size: 1rem;}
    .crop-grid { grid-template-columns: repeat(3, 1fr); }
}

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