/* =============================================================
   Farmer2Customer - Main Stylesheet
   Material Design Inspired | Indian Vibrant Theme
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

:root {
  --primary: #FF6B00;
  --primary-dark: #E65100;
  --primary-light: #FFE0CC;
  --secondary: #2E7D32;
  --secondary-dark: #1B5E20;
  --secondary-light: #C8E6C9;
  --accent: #F9A825;
  --accent-light: #FFF9C4;
  --danger: #D32F2F;
  --info: #0277BD;
  --white: #FFFFFF;
  --bg: #F5F5F5;
  --card: #FFFFFF;
  --text: #212121;
  --text-muted: #757575;
  --border: #E0E0E0;
  --shadow: 0 2px 10px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Poppins', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ===== NAVBAR ===== */
.navbar {
  background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, #388E3C 100%);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}
.navbar-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 64px; }
.navbar-brand { display: flex; align-items: center; gap: 10px; color: white; font-size: 1.4rem; font-weight: 700; }
.navbar-brand .logo-icon { font-size: 2rem; color: var(--accent); }
.navbar-brand span { color: var(--accent); }
.navbar-nav { display: flex; align-items: center; gap: 8px; list-style: none; }
.navbar-nav a { color: rgba(255,255,255,0.9); padding: 8px 16px; border-radius: 8px; font-size: 0.9rem; font-weight: 500; transition: var(--transition); }
.navbar-nav a:hover, .navbar-nav a.active { background: rgba(255,255,255,0.15); color: white; }
.nav-btn { background: var(--primary) !important; color: white !important; border-radius: 8px !important; font-weight: 600 !important; }
.nav-btn:hover { background: var(--primary-dark) !important; transform: translateY(-1px); }
.nav-badge { background: var(--danger); color: white; border-radius: 50%; padding: 2px 6px; font-size: 0.7rem; margin-left: 4px; }
.hamburger { display: none; background: none; border: none; color: white; font-size: 1.8rem; cursor: pointer; }

/* ===== FLASH MESSAGES ===== */
.flash-container { max-width: 1400px; margin: 16px auto; padding: 0 24px; }
.flash { padding: 14px 20px; border-radius: var(--radius); margin-bottom: 12px; display: flex; align-items: center; gap: 10px; font-weight: 500; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.flash-success { background: var(--secondary-light); color: var(--secondary-dark); border-left: 4px solid var(--secondary); }
.flash-error { background: #FFEBEE; color: var(--danger); border-left: 4px solid var(--danger); }

/* ===== DASHBOARD LAYOUT ===== */
.dash-layout { display: flex; min-height: calc(100vh - 64px); }
.sidebar {
  width: 260px; min-width: 260px;
  background: linear-gradient(180deg, #1B5E20 0%, #2E7D32 100%);
  padding: 24px 0; color: white;
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
}
.sidebar-header { padding: 0 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-user { display: flex; align-items: center; gap: 12px; }
.sidebar-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 700; color: #333; }
.sidebar-user-info .name { font-weight: 600; font-size: 0.95rem; }
.sidebar-user-info .role { font-size: 0.75rem; opacity: 0.7; text-transform: uppercase; letter-spacing: 1px; }
.sidebar-nav { padding: 16px 0; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: rgba(255,255,255,0.8); transition: var(--transition); font-size: 0.9rem; font-weight: 500; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,0.15); color: white; border-right: 3px solid var(--accent); }
.sidebar-nav a .material-icons { font-size: 1.2rem; }
.sidebar-section { padding: 8px 20px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px; opacity: 0.5; margin-top: 8px; }
.dash-content { flex: 1; padding: 28px; overflow-x: hidden; }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.8rem; font-weight: 700; color: var(--text); }
.page-header p { color: var(--text-muted); margin-top: 4px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--secondary); }

/* ===== STAT CARDS ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; transition: var(--transition); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.stat-card.green::before { background: var(--secondary); }
.stat-card.orange::before { background: var(--primary); }
.stat-card.yellow::before { background: var(--accent); }
.stat-card.blue::before { background: var(--info); }
.stat-card.red::before { background: var(--danger); }
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stat-icon { width: 56px; height: 56px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.stat-icon.green { background: var(--secondary-light); color: var(--secondary); }
.stat-icon.orange { background: var(--primary-light); color: var(--primary); }
.stat-icon.yellow { background: var(--accent-light); color: #F57F17; }
.stat-icon.blue { background: #E1F5FE; color: var(--info); }
.stat-icon.red { background: #FFEBEE; color: var(--danger); }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

/* ===== CARDS ===== */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: var(--transition); }
.card:hover { box-shadow: var(--shadow-lg); }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 24px; }

/* ===== PRODUCT CARDS ===== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; }
.product-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: var(--transition); }
.product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.product-img-wrap { position: relative; aspect-ratio: 4/3; overflow: hidden; background: var(--bg); }
.product-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.product-card:hover .product-img-wrap img { transform: scale(1.05); }
.organic-badge { position: absolute; top: 10px; left: 10px; background: var(--secondary); color: white; padding: 3px 8px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; }
.product-body { padding: 16px; }
.product-category { font-size: 0.72rem; color: var(--secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.product-name { font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.product-farmer { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 4px; }
.product-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--border); }
.product-price { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.product-price span { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.btn-cart { background: var(--secondary); color: white; border: none; padding: 8px 14px; border-radius: 8px; font-size: 0.8rem; cursor: pointer; display: flex; align-items: center; gap: 4px; transition: var(--transition); font-family: 'Poppins', sans-serif; font-weight: 600; }
.btn-cart:hover { background: var(--secondary-dark); transform: scale(1.05); }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 8px; font-family: 'Poppins', sans-serif; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: var(--transition); border: none; text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 4px 15px rgba(255,107,0,0.4); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: var(--secondary-dark); transform: translateY(-2px); }
.btn-accent { background: var(--accent); color: #333; }
.btn-accent:hover { background: #F57F17; transform: translateY(-2px); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #B71C1C; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--bg); padding: 12px 16px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); text-align: left; }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.88rem; vertical-align: middle; }
tbody tr:hover { background: #FAFAFA; }
tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.badge-pending { background: #FFF3E0; color: #E65100; }
.badge-approved { background: var(--secondary-light); color: var(--secondary-dark); }
.badge-rejected { background: #FFEBEE; color: var(--danger); }
.badge-green { background: var(--secondary-light); color: var(--secondary-dark); }
.badge-orange { background: var(--primary-light); color: var(--primary-dark); }
.badge-yellow { background: var(--accent-light); color: #F57F17; }
.badge-red { background: #FFEBEE; color: var(--danger); }
.badge-blue { background: #E1F5FE; color: var(--info); }
.badge-farmer { background: var(--secondary-light); color: var(--secondary-dark); }
.badge-customer { background: var(--primary-light); color: var(--primary-dark); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }
label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 10px;
  font-family: 'Poppins', sans-serif; font-size: 0.9rem; color: var(--text);
  background: var(--white); transition: var(--transition); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,0,0.1); }
textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.checkbox-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.checkbox-wrap input[type="checkbox"] { width: auto; accent-color: var(--secondary); transform: scale(1.3); }

/* ===== AUTH PAGES ===== */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 40%, var(--primary) 100%); padding: 24px; }
.auth-card { background: white; border-radius: var(--radius-lg); padding: 40px; width: 100%; max-width: 480px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .material-icons { font-size: 3rem; color: var(--secondary); }
.auth-logo h2 { font-size: 1.6rem; font-weight: 700; margin-top: 8px; }
.auth-logo p { color: var(--text-muted); font-size: 0.9rem; }
.role-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.role-option { display: block; cursor: pointer; }
.role-option input { display: none; }
.role-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; border: 2px solid var(--border); border-radius: var(--radius); transition: var(--transition); }
.role-option input:checked + .role-box { border-color: var(--secondary); background: var(--secondary-light); }
.role-box .material-icons { font-size: 2rem; color: var(--text-muted); }
.role-option input:checked + .role-box .material-icons { color: var(--secondary); }
.divider { text-align: center; margin: 20px 0; color: var(--text-muted); font-size: 0.85rem; position: relative; }
.divider::before, .divider::after { content: ''; position: absolute; top: 50%; height: 1px; background: var(--border); width: 40%; }
.divider::before { left: 0; } .divider::after { right: 0; }
.auth-link { text-align: center; margin-top: 20px; font-size: 0.9rem; color: var(--text-muted); }
.auth-link a { color: var(--secondary); font-weight: 600; }

/* ===== HERO SECTION ===== */
.hero { background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, var(--primary-dark) 100%); color: white; padding: 80px 24px; text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }
.hero-content { max-width: 700px; margin: 0 auto; position: relative; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.2; margin-bottom: 20px; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 1.1rem; opacity: 0.9; margin-bottom: 32px; }
.hero-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ===== CATEGORIES SECTION ===== */
.section { padding: 60px 24px; max-width: 1400px; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 40px; }
.section-header h2 { font-size: 2rem; font-weight: 700; color: var(--text); }
.section-header p { color: var(--text-muted); margin-top: 8px; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; }
.category-card { background: var(--card); border-radius: var(--radius); padding: 24px 16px; text-align: center; box-shadow: var(--shadow); transition: var(--transition); cursor: pointer; }
.category-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-bottom: 3px solid var(--primary); }
.category-card .material-icons { font-size: 2.5rem; color: var(--secondary); margin-bottom: 10px; }
.category-card h4 { font-size: 0.85rem; font-weight: 600; color: var(--text); }

/* ===== FARMER CARDS ===== */
.farmers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; }
.farmer-card { background: var(--card); border-radius: var(--radius); padding: 24px; text-align: center; box-shadow: var(--shadow); transition: var(--transition); }
.farmer-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.farmer-avatar { width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, var(--secondary), var(--primary)); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 700; color: white; margin: 0 auto 16px; }
.farmer-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.farmer-card p { font-size: 0.8rem; color: var(--text-muted); }
.farmer-tag { display: inline-block; background: var(--secondary-light); color: var(--secondary-dark); padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; margin-top: 10px; }

/* ===== CART ===== */
.cart-layout { display: grid; grid-template-columns: 1fr 360px; gap: 24px; max-width: 1100px; margin: 0 auto; }
.cart-item { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }
.cart-item-img { width: 80px; height: 80px; border-radius: var(--radius); object-fit: cover; background: var(--bg); }
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; margin-bottom: 4px; }
.cart-item-farmer { font-size: 0.8rem; color: var(--text-muted); }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border); background: white; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; transition: var(--transition); font-weight: bold; }
.qty-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.qty-input { width: 50px; text-align: center; border: 2px solid var(--border); border-radius: 8px; padding: 4px; }
.order-summary { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); position: sticky; top: 80px; }

/* ===== SHOP FILTERS ===== */
.shop-layout { display: flex; gap: 24px; max-width: 1400px; margin: 0 auto; padding: 24px; }
.filter-sidebar { width: 230px; min-width: 230px; max-width: 230px; flex-shrink: 0; }
.filter-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.filter-card h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.filter-option { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; cursor: pointer; font-size: 0.88rem; text-decoration: none; color: var(--text); }
.filter-option:hover { color: var(--secondary); }
.filter-option input[type="radio"], .filter-option input[type="checkbox"] { width: auto; accent-color: var(--secondary); flex-shrink: 0; margin-top: 4px; border: none; padding: 0; }
.filter-option span { line-height: 1.35; white-space: normal; display: block; flex: 1; }
.shop-main { flex: 1; min-width: 0; }

/* ===== STAR RATING ===== */
.star-rating { display: flex; flex-direction: row-reverse; gap: 2px; }
.star-rating input { display: none; }
.star-rating label { font-size: 1.5rem; cursor: pointer; color: #ddd; transition: color 0.15s; }
.star-rating label:hover, .star-rating label:hover ~ label,
.star-rating input:checked ~ label { color: #F9A825; }
.stars-display { color: #F9A825; font-size: 1rem; letter-spacing: 1px; }
.stars-display.muted { color: #ddd; }
.search-bar { display: flex; gap: 12px; margin-bottom: 24px; }
.search-bar input { flex: 1; }
.sort-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.sort-bar small { color: var(--text-muted); }

/* ===== ORDER STATUS ===== */
.order-status { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; font-weight: 600; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .material-icons { font-size: 5rem; color: var(--border); margin-bottom: 16px; }
.empty-state h3 { font-size: 1.3rem; color: var(--text-muted); margin-bottom: 8px; }

/* ===== FOOTER ===== */
footer { background: linear-gradient(135deg, #1B5E20, #2E7D32); color: white; text-align: center; padding: 32px 24px; margin-top: 40px; }
footer p { opacity: 0.8; font-size: 0.88rem; }
footer .footer-brand { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; color: var(--accent); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .dash-layout { flex-direction: column; }
  .sidebar { width: 100%; min-width: auto; height: auto; position: static; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 12px; }
  .sidebar-nav a { padding: 8px 12px; font-size: 0.8rem; }
  .sidebar-section { display: none; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .cart-layout { grid-template-columns: 1fr; }
  .shop-layout { flex-direction: column; }
  .filter-sidebar { width: 100%; min-width: auto; }
}
@media (max-width: 768px) {
  .navbar-nav { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--secondary-dark); padding: 16px; box-shadow: var(--shadow-lg); gap: 4px; }
  .navbar-nav.open { display: flex; }
  .hamburger { display: block; }
  .hero h1 { font-size: 1.8rem; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-content { padding: 16px; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 28px 20px; }
}
