/* ============================================================
   AgriTrack – Custom CSS (Minimal Academic Style)
   ============================================================ */

/* ---------- Base ---------- */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ---------- Sidebar ---------- */
#sidebar .sidebar-link {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

#sidebar .sidebar-link:hover,
#sidebar .sidebar-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: #28a745;
}

/* ---------- Cards ---------- */
.card {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    border: 1px solid #dee2e6;
}

.card-header {
    font-weight: 600;
}

/* ---------- Status Badges ---------- */
.status-badge {
    display: inline-block;
    padding: 0.25em 0.65em;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-planted {
    background-color: #cfe2ff;
    color: #084298;
}

.status-growing {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-harvested {
    background-color: #e2e3e5;
    color: #41464b;
}

.status-failed {
    background-color: #f8d7da;
    color: #842029;
}

/* ---------- Crop Image Thumbnail ---------- */
.crop-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

/* ---------- Avatar ---------- */
.avatar-circle {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #28a745;
}

.avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #28a745;
    color: #fff;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ---------- Flash Alerts (fixed top-right) ---------- */
.flash-fixed-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1100;
    width: 320px;
}

/* ---------- Auth Pages ---------- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

/* ---------- App layout ---------- */
.app-navbar { height: 56px; position: sticky; top: 0; z-index: 1030; flex-wrap: nowrap; }
.app-body   { min-height: calc(100vh - 56px); }
#sidebar    { width: 240px; }
#sidebar .sidebar-link.active { font-weight: 600; }

/* Below the lg breakpoint (where the toggle button shows) the sidebar is an overlay */
@media (max-width: 991.98px) {
    #sidebar {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        height: calc(100vh - 56px);
        z-index: 1040;
        overflow-y: auto;
        box-shadow: 4px 0 16px rgba(0,0,0,.25);
    }
    #sidebar.show { display: block; }
}

/* ---------- Dashboard Hero Banner ---------- */
.dash-hero {
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    background: url('assets/farm_hero_bg.jpg') center / cover no-repeat;
}
.dash-hero::before {
    content: "";
    position: absolute;
    inset: 0;
}
.dash-hero-farmer::before { background: linear-gradient(135deg, rgba(10,50,20,0.85) 40%, rgba(20,80,40,0.55)); }
.dash-hero-buyer::before  { background: linear-gradient(135deg, rgba(10,30,60,0.85) 40%, rgba(20,60,100,0.55)); background-position: center 60%; }
.dash-hero-title {
    color: #fff;
    font-weight: 700;
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    margin-bottom: .25rem;
    text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.dash-hero-sub { color: rgba(255,255,255,.85); margin: 0; }
.dash-hero-btn {
    background: #fff;
    font-weight: 700;
    border-radius: 50px;
    padding: 10px 28px;
    box-shadow: 0 4px 15px rgba(0,0,0,.25);
}
.dash-hero-btn:hover { background: #f1f1f1; }

/* ---------- Premium Stat Cards ---------- */
.stat-card {
    border: none !important;
    border-radius: 14px !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.13) !important;
}

/* ---------- Role Selector Cards ---------- */
.role-card { transition: all 0.2s ease; }
.role-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}


/* ---------- Public product page ---------- */
.crop-header { background: linear-gradient(135deg, #198754, #20c997); color: #fff; }
.crop-image { width: 100%; max-height: 350px; object-fit: cover; border-radius: .5rem; }
.detail-row {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    padding: .75rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-weight: 600; color: #495057; min-width: 160px; }
.powered-footer {
    text-align: center;
    color: #6c757d;
    font-size: .82rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

/* ---------- Inquiry conversation ---------- */
.chat-body { max-height: 60vh; overflow-y: auto; background: #f6f8f7; }
.chat-bubble {
    max-width: 80%;
    padding: .6rem .85rem;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
    overflow-wrap: anywhere;
}
.chat-mine   { background: #d1e7dd; border-bottom-right-radius: 4px; }
.chat-theirs { background: #fff;    border-bottom-left-radius: 4px; }
.chat-time   { font-size: .72rem; color: #6c757d; margin-top: .25rem; text-align: right; }
.min-w-0 { min-width: 0; }

/* ---------- Star rating input (CSS only, keyboard accessible) ---------- */
.star-input { display: inline-flex; flex-direction: row-reverse; gap: .15rem; border: 0; padding: 0; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: 1.8rem; color: #ced4da; cursor: pointer; line-height: 1; }
.star-input input:checked ~ label,
.star-input label:hover,
.star-input label:hover ~ label { color: #ffc107; }
.star-input input:focus-visible + label { outline: 2px solid #198754; border-radius: 4px; }

/* Role picker on the registration form (radio + card label) */
.role-card { cursor: pointer; border-width: 2px; }
.btn-check:checked + .role-card { border-color: #198754; background-color: rgba(25,135,84,.1); }
.btn-check:focus-visible + .role-card { outline: 3px solid rgba(25,135,84,.5); outline-offset: 2px; }

/* ---------- Print: only the page content (e.g. QR labels) ---------- */
@media print {
    .app-navbar, #sidebar, .no-print, .flash-alert { display: none !important; }
    main { padding: 0 !important; }
    .card { box-shadow: none !important; border: 0 !important; }
    .qr-label { box-shadow: none !important; }
}

/* ---------- Landing page ---------- */
.landing-hero {
    background:
        linear-gradient(135deg, rgba(10,50,20,.88) 35%, rgba(20,80,40,.55)),
        url('assets/farm_hero_bg.jpg') center / cover no-repeat;
}

/* WhatsApp brand button */
.btn-whatsapp { background: #25d366; color: #fff; border: 0; }
.btn-whatsapp:hover, .btn-whatsapp:focus { background: #1ebe57; color: #fff; }
