/* ============================================================
   FARM2TABLE - Main Stylesheet
   Design: Fresh, Natural, Professional
   ============================================================ */

:root {
    --green-900: #14532d;
    --green-800: #166534;
    --green-700: #15803d;
    --green-600: #16a34a;
    --green-500: #22c55e;
    --green-400: #4ade80;
    --green-100: #dcfce7;
    --green-50:  #f0fdf4;

    --orange-500: #f97316;
    --orange-100: #ffedd5;
    --red-500:    #ef4444;
    --red-100:    #fee2e2;
    --yellow-500: #eab308;
    --yellow-100: #fef9c3;
    --blue-500:   #3b82f6;
    --blue-100:   #dbeafe;
    --purple-500: #a855f7;

    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50:  #f9fafb;
    --white:    #ffffff;

    --font-sans: 'Plus Jakarta Sans', sans-serif;
    --font-serif: 'Fraunces', serif;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.10);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
    --shadow-green: 0 4px 20px rgba(22,163,74,.25);

    --transition: all .2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── NAVBAR ── */
.navbar {
    position: sticky; top: 0; z-index: 1000;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}
.nav-container {
    max-width: 1280px; margin: 0 auto;
    padding: 0 24px; height: 68px;
    display: flex; align-items: center; gap: 32px;
}
.nav-brand {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; flex-shrink: 0;
}
.brand-icon { font-size: 1.6rem; }
.brand-text {
    font-family: var(--font-serif);
    font-size: 1.4rem; font-weight: 700;
    color: var(--green-800);
}
.brand-accent { color: var(--orange-500); }
.nav-links {
    display: flex; align-items: center; gap: 4px;
    flex: 1;
}
.nav-link {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: var(--radius-sm);
    text-decoration: none; color: var(--gray-600);
    font-size: .875rem; font-weight: 500;
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
    background: var(--green-50); color: var(--green-700);
}
.nav-link.active { font-weight: 600; }
.nav-auth { display: flex; gap: 10px; margin-left: auto; }
.nav-user { margin-left: auto; position: relative; }
.user-menu {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px; border-radius: var(--radius-md);
    cursor: pointer; transition: var(--transition);
}
.user-menu:hover { background: var(--gray-100); }
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--green-500), var(--green-700));
    color: white; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem;
}
.user-name { font-size: .875rem; font-weight: 600; color: var(--gray-700); }
.user-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 8px);
    background: white; border-radius: var(--radius-md);
    border: 1px solid var(--gray-200); box-shadow: var(--shadow-lg);
    min-width: 200px; overflow: hidden; z-index: 100;
}
.user-dropdown.open { display: block; }
.dropdown-header {
    padding: 14px 16px; background: var(--green-50);
    border-bottom: 1px solid var(--gray-200);
}
.dh-name { font-weight: 700; color: var(--gray-800); }
.dh-role { font-size: .75rem; color: var(--green-600); text-transform: capitalize; }
.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 16px; text-decoration: none;
    color: var(--gray-700); font-size: .875rem;
    transition: var(--transition);
}
.dropdown-item:hover { background: var(--gray-50); }
.dropdown-item i { width: 16px; color: var(--gray-500); }
.dropdown-danger { color: var(--red-500) !important; }
.dropdown-danger i { color: var(--red-500) !important; }

/* ── FLASH ── */
.flash {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px; font-size: .875rem; font-weight: 500;
    border-left: 4px solid transparent; position: relative;
}
.flash-success { background: var(--green-50); border-color: var(--green-500); color: var(--green-800); }
.flash-error   { background: var(--red-100);  border-color: var(--red-500);   color: #991b1b; }
.flash-warning { background: var(--yellow-100); border-color: var(--yellow-500); color: #854d0e; }
.flash button  {
    margin-left: auto; background: none; border: none;
    cursor: pointer; font-size: 1.2rem; color: inherit; opacity: .6;
}

/* ── LAYOUT ── */
.main-content { flex: 1; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.page-header {
    padding: 32px 0 24px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 32px;
}
.page-title {
    font-family: var(--font-serif);
    font-size: 2rem; font-weight: 700; color: var(--gray-900);
}
.page-subtitle { color: var(--gray-500); margin-top: 4px; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-family: var(--font-sans); font-size: .875rem; font-weight: 600;
    cursor: pointer; border: 2px solid transparent;
    text-decoration: none; transition: var(--transition);
    white-space: nowrap;
}
.btn-primary   { background: var(--green-600); color: white; border-color: var(--green-600); }
.btn-primary:hover { background: var(--green-700); border-color: var(--green-700); box-shadow: var(--shadow-green); transform: translateY(-1px); }
.btn-outline   { background: transparent; color: var(--green-600); border-color: var(--green-600); }
.btn-outline:hover { background: var(--green-50); }
.btn-danger    { background: var(--red-500); color: white; border-color: var(--red-500); }
.btn-danger:hover { background: #dc2626; }
.btn-gray      { background: var(--gray-200); color: var(--gray-700); border-color: var(--gray-200); }
.btn-gray:hover { background: var(--gray-300); }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ── CARDS ── */
.card {
    background: white; border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm);
    overflow: hidden; transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    padding: 20px 24px; border-bottom: 1px solid var(--gray-100);
    display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-weight: 700; font-size: 1rem; color: var(--gray-800); }
.card-body { padding: 24px; }

/* ── GRID ── */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── STATS ── */
.stat-card {
    background: white; border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200); padding: 20px 24px;
    display: flex; align-items: center; gap: 16px;
}
.stat-icon {
    width: 52px; height: 52px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.green  { background: var(--green-100); }
.stat-icon.orange { background: var(--orange-100); }
.stat-icon.blue   { background: var(--blue-100); }
.stat-icon.red    { background: var(--red-100); }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--gray-500); margin-top: 4px; }

/* ── PRODUCT CARD ── */
.product-card {
    background: white; border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200); overflow: hidden;
    transition: var(--transition); display: flex; flex-direction: column;
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-img {
    width: 100%; height: 180px; object-fit: cover;
    background: linear-gradient(135deg, var(--green-100), var(--green-50));
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem;
}
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.product-name { font-weight: 700; color: var(--gray-800); }
.product-farmer { font-size: .8rem; color: var(--gray-500); }
.product-price { font-size: 1.1rem; font-weight: 800; color: var(--green-600); }
.product-stock { font-size: .8rem; color: var(--gray-600); }
.product-footer { padding: 12px 16px; border-top: 1px solid var(--gray-100); display: flex; gap: 8px; }
.freshness-bar {
    height: 4px; border-radius: 99px;
    background: var(--gray-200); overflow: hidden; margin-top: 4px;
}
.freshness-fill { height: 100%; border-radius: 99px; transition: width .5s; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .875rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
    font-family: var(--font-sans); font-size: .9rem; color: var(--gray-800);
    background: white; transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-error { font-size: .8rem; color: var(--red-500); margin-top: 4px; }
.form-hint  { font-size: .8rem; color: var(--gray-500); margin-top: 4px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead { background: var(--gray-50); }
th { padding: 12px 16px; text-align: left; font-weight: 700; color: var(--gray-600); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
td { padding: 14px 16px; border-top: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
tr:hover td { background: var(--gray-50); }

/* ── BADGES ── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 99px;
    font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--green-100); color: var(--green-800); }
.badge-warning { background: var(--yellow-100); color: #854d0e; }
.badge-danger  { background: var(--red-100);    color: #991b1b; }
.badge-info    { background: var(--blue-100);   color: #1e40af; }
.badge-primary { background: #e0f2fe;           color: #075985; }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }
.badge-purple  { background: #f3e8ff;           color: #7c3aed; }

/* ── HERO (home page) ── */
.hero {
    background: url('/assets/img/gambardashboardpublic.jpg') center/cover no-repeat;
    color: white; padding: 80px 0; position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; inset: 0;
    background: rgba(0,0,0,0.1);
}
.hero-content { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25);
    border-radius: 99px; padding: 6px 16px; font-size: .8rem; font-weight: 600;
    margin-bottom: 24px;
}
.hero h1 {
    font-family: var(--font-serif); font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700; line-height: 1.1; margin-bottom: 20px;
}
.hero h1 em { color: var(--green-400); font-style: normal; }
.hero p { font-size: 1.1rem; opacity: .85; max-width: 520px; margin-bottom: 36px; }
.hero-btns { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-btns .btn-primary { background: white; color: var(--green-700); border-color: white; }
.hero-btns .btn-primary:hover { background: var(--green-50); }
.hero-btns .btn-outline { border-color: rgba(255,255,255,.5); color: white; }
.hero-btns .btn-outline:hover { background: rgba(255,255,255,.1); }
.hero-features {
    display: flex; gap: 32px; margin-top: 48px; flex-wrap: wrap;
}
.hero-feature { display: flex; align-items: center; gap: 10px; font-size: .9rem; opacity: .9; }
.hero-feature i { font-size: 1.1rem; color: var(--green-400); }

/* ── TRACKING MAP ── */
#map { height: 400px; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); }
.tracking-info {
    background: white; border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200); padding: 20px;
}
.tracking-step {
    display: flex; gap: 14px; padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}
.tracking-step:last-child { border: none; }
.step-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    margin-top: 6px; background: var(--gray-300);
}
.step-dot.active { background: var(--green-500); }
.step-dot.done   { background: var(--green-700); }

/* ── SUBSCRIPTION PACKAGES ── */
.pkg-card {
    border: 2px solid var(--gray-200); border-radius: var(--radius-xl);
    padding: 28px; transition: var(--transition); position: relative;
    background: white;
}
.pkg-card:hover, .pkg-card.selected { border-color: var(--green-500); }
.pkg-card.recommended { border-color: var(--green-500); }
.pkg-recommend-badge {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--green-600); color: white; font-size: .75rem; font-weight: 700;
    padding: 4px 16px; border-radius: 99px; white-space: nowrap;
}
.pkg-name { font-size: 1.1rem; font-weight: 800; margin-bottom: 4px; }
.pkg-price { font-size: 2rem; font-weight: 800; color: var(--green-600); line-height: 1.1; }
.pkg-price span { font-size: .9rem; font-weight: 400; color: var(--gray-500); }
.pkg-features { list-style: none; margin: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.pkg-features li { display: flex; align-items: center; gap: 8px; font-size: .875rem; }
.pkg-features i  { color: var(--green-500); width: 16px; }

/* ── INVENTORY ── */
.inv-progress { height: 8px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.inv-fill { height: 100%; border-radius: 99px; transition: width .5s; }
.inv-ok       { background: var(--green-500); }
.inv-warning  { background: var(--yellow-500); }
.inv-critical { background: var(--red-500); }

/* ── CHATBOT ── */
.chat-container { height: 520px; display: flex; flex-direction: column; }
.chat-messages {
    flex: 1; overflow-y: auto; padding: 20px;
    display: flex; flex-direction: column; gap: 14px;
}
.chat-bubble {
    max-width: 75%; padding: 12px 16px;
    border-radius: var(--radius-lg); font-size: .9rem; line-height: 1.5;
}
.chat-bubble.bot {
    background: var(--gray-100); color: var(--gray-800);
    border-bottom-left-radius: 4px; align-self: flex-start;
}
.chat-bubble.user {
    background: var(--green-600); color: white;
    border-bottom-right-radius: 4px; align-self: flex-end;
}
.chat-input-row {
    display: flex; gap: 10px; padding: 16px;
    border-top: 1px solid var(--gray-200);
}
.chat-input-row input { flex: 1; }
.typing-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gray-500); animation: bounce .8s infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,80%,100% { transform: translateY(0); } 40% { transform: translateY(-8px); } }

/* ── AUTH ── */
.auth-wrap {
    min-height: 80vh; display: flex; align-items: center;
    justify-content: center; padding: 40px 24px;
}
.auth-card { width: 100%; max-width: 440px; }
.auth-logo {
    text-align: center; margin-bottom: 28px;
    font-family: var(--font-serif); font-size: 1.8rem;
    font-weight: 700; color: var(--green-700);
}

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--gray-400);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }
.empty-state h3 { color: var(--gray-600); font-size: 1.1rem; margin-bottom: 8px; }

/* ── TABS ── */
.tabs { display: flex; gap: 2px; background: var(--gray-100); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 24px; }
.tab-btn {
    flex: 1; padding: 8px 16px; border: none; background: none;
    border-radius: 6px; font-family: var(--font-sans); font-size: .875rem;
    font-weight: 600; cursor: pointer; color: var(--gray-600); transition: var(--transition);
}
.tab-btn.active { background: white; color: var(--green-700); box-shadow: var(--shadow-sm); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── MISC ── */
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 24px 0; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-full { width: 100%; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-gray { color: var(--gray-500); }
.text-green { color: var(--green-600); }
.text-red   { color: var(--red-500); }
.font-bold  { font-weight: 700; }

/* ── FOOTER ── */
.footer {
    background: var(--gray-900); color: var(--gray-400);
    margin-top: 80px;
}
.footer-container {
    max-width: 1280px; margin: 0 auto; padding: 48px 24px;
    display: grid; grid-template-columns: 2fr 1fr 1fr 1.5fr; gap: 40px;
}
@media (max-width: 768px) { .footer-container { grid-template-columns: 1fr 1fr; } }
.footer-brand p { margin-top: 10px; font-size: .875rem; line-height: 1.6; }
.footer-brand strong { color: white; font-size: 1.1rem; margin-left: 8px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links strong { color: white; font-size: .9rem; }
.footer-links a { text-decoration: none; color: var(--gray-400); font-size: .875rem; transition: var(--transition); }
.footer-links a:hover { color: var(--green-400); }
.footer-contact p { font-size: .875rem; margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.footer-contact strong { color: white; }
.footer-bottom { border-top: 1px solid var(--gray-800); text-align: center; padding: 20px; font-size: .8rem; }
