/* ===========================================================
   Vidumina Agri — design tokens
   Grounded in the subject: terraced paddy fields, spice
   markets, clay and harvest gold. Not a generic SaaS palette.
   =========================================================== */
:root {
    --paddy-950:  #16281d;   /* near-black substitute, warm dark green */
    --paddy-800:  #1f3d2b;   /* primary dark */
    --paddy-600:  #2f5a3f;
    --husk-100:   #edeedf;   /* page background — greenish neutral, not cream */
    --husk-50:    #f6f6ee;
    --turmeric:   #c88719;   /* accent gold */
    --turmeric-dark: #9c6a12;
    --cinnamon:   #8b4c39;   /* sparing use — status/warm warnings */
    --ink:        #211f1a;
    --ink-soft:   #55503f;
    --line:       #d9d6c4;
    --white:      #ffffff;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Work Sans', system-ui, -apple-system, sans-serif;

    --radius-sm: 4px;
    --radius-md: 10px;
    --shadow-card: 0 1px 2px rgba(22, 40, 29, 0.06), 0 4px 14px rgba(22, 40, 29, 0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--husk-100);
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--paddy-950);
    line-height: 1.15;
    margin: 0 0 0.5em;
}

h1 { font-size: clamp(2.1rem, 4vw, 3.1rem); font-weight: 500; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; font-weight: 600; }

p { margin: 0 0 1rem; max-width: 62ch; color: var(--ink-soft); }

a { color: var(--paddy-800); }

/* ===========================================================
   Header
   =========================================================== */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 2rem;
    background: var(--paddy-950);
    color: var(--husk-50);
}

.site-header .brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--husk-50);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
}

.brand-mark {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    background: linear-gradient(135deg, var(--turmeric) 0%, var(--turmeric-dark) 100%);
    display: inline-block;
    flex-shrink: 0;
}

.site-header nav {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    font-size: 0.92rem;
}

.site-header nav a {
    color: var(--husk-100);
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}

.site-header nav a:hover { opacity: 1; }

.site-header .who { color: var(--husk-100); opacity: 0.7; font-size: 0.9rem; }

.nav-cta {
    background: var(--turmeric);
    color: var(--paddy-950) !important;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    opacity: 1 !important;
    font-weight: 500;
}
.nav-cta:hover { background: #d99420; }

/* ===========================================================
   Layout
   =========================================================== */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--ink-soft);
    font-size: 0.85rem;
    border-top: 1px solid var(--line);
}

/* ===========================================================
   Hero — the one deliberate animated moment on the site.
   The terrace lines draw themselves in on load, echoing the
   layered rice terraces this platform is actually about.
   =========================================================== */
.hero {
    position: relative;
    padding: 2rem 0 0;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--paddy-800);
    color: var(--husk-50);
    margin: -1rem 0 3rem;
}

.hero-text {
    position: relative;
    z-index: 2;
    padding: 3rem 2.5rem 2rem;
    max-width: 34rem;
}

.hero h1 { color: var(--husk-50); }

.hero-sub {
    color: #d3d8cb;
    font-size: 1.05rem;
    max-width: 40ch;
}

.terrace {
    display: block;
    width: 100%;
    height: 130px;
}

.terrace-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 900;
    stroke-dashoffset: 900;
    animation: draw-terrace 1.6s ease-out forwards;
}

.terrace-line--back  { stroke: #3a5c46; animation-delay: 0.1s; }
.terrace-line--mid   { stroke: #4f7a5c; animation-delay: 0.35s; }
.terrace-line--front { stroke: var(--turmeric); animation-delay: 0.6s; }

@keyframes draw-terrace {
    to { stroke-dashoffset: 0; }
}

.portal-links {
    display: flex;
    gap: 0.9rem;
    margin-top: 1.6rem;
    flex-wrap: wrap;
}

/* ===========================================================
   Buttons — one press-feedback interaction, not decoration
   =========================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.7rem 1.3rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--turmeric);
    color: var(--paddy-950);
}
.btn-primary:hover { background: #d99420; }

.btn-ghost {
    background: transparent;
    color: var(--husk-50);
    border-color: rgba(246, 246, 238, 0.4);
}
.btn-ghost:hover { border-color: rgba(246, 246, 238, 0.8); }

button[type="submit"], button {
    font-family: var(--font-body);
    background: var(--paddy-800);
    color: var(--husk-50);
    border: none;
    padding: 0.65rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.08s ease, background 0.15s ease;
}
button:hover { background: var(--paddy-600); }
button:active { transform: translateY(1px); }

/* ===========================================================
   How-it-works — a real sequence, so numbering is earned here
   =========================================================== */
.how {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    padding-top: 0.5rem;
}

.how-step { position: relative; padding-left: 0.1rem; }

.how-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--husk-50);
    border: 1.5px solid var(--turmeric);
    color: var(--paddy-800);
    font-family: var(--font-display);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.how-step h3 { margin-bottom: 0.3rem; }
.how-step p { font-size: 0.93rem; }

/* ===========================================================
   Forms
   =========================================================== */
form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    max-width: 26rem;
}

label {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    gap: 0.4rem;
    color: var(--ink);
    font-weight: 500;
}

input, textarea {
    font-family: var(--font-body);
    padding: 0.65rem 0.75rem;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-size: 0.95rem;
    color: var(--ink);
    transition: border-color 0.15s ease;
}

input:focus, textarea:focus, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--turmeric);
    outline-offset: 2px;
    border-color: var(--turmeric);
}

.error {
    color: #7a2b1c;
    background: #fbeae4;
    border-left: 3px solid var(--cinnamon);
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.checkbox-label {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.6rem;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--ink-soft);
}
.checkbox-label input[type="checkbox"] {
    margin-top: 0.2rem;
    width: auto;
    flex-shrink: 0;
}

/* ===========================================================
   Tables (dashboards / admin)
   =========================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.2rem;
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

th, td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.92rem;
}

th {
    font-weight: 600;
    color: var(--paddy-800);
    background: var(--husk-50);
}

tr:last-child td { border-bottom: none; }

/* ===========================================================
   Listing / package cards — flat with a colored top edge
   instead of the generic uniform-shadow card kit
   =========================================================== */
.listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.3rem;
}

.listing-card, .package-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-top: 3px solid var(--turmeric);
    border-radius: var(--radius-sm);
    padding: 1.1rem;
}

/* .listing-card doubles as a plain <div> (dashboard, admin) and a clickable
   <a> (homepage, browse) — these rules only matter for the link form. */
a.listing-card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, transform 0.1s ease;
}
a.listing-card:hover {
    border-color: var(--turmeric);
    transform: translateY(-2px);
}

.listing-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 0.8rem;
}

.listing-card h3, .package-card h3 { font-size: 1.05rem; margin-bottom: 0.3rem; }
.listing-card a { text-decoration: none; }
.listing-card p { margin: 0; font-size: 0.9rem; }

.featured-section {
    margin: 3rem 0;
}
.featured-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.2rem;
}
.featured-header h2 { margin: 0; }
.featured-header a { font-size: 0.9rem; text-decoration: none; }
.featured-header a:hover { text-decoration: underline; }

.photo-gallery {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}
.photo-gallery img {
    border-radius: var(--radius-sm);
    object-fit: cover;
    height: 110px;
}

/* ===========================================================
   Thumbnail placeholder — for listings with no photo yet
   =========================================================== */
.thumb-placeholder {
    width: 100%;
    height: 140px;
    border-radius: var(--radius-sm);
    margin-bottom: 0.8rem;
    background:
        linear-gradient(135deg, transparent 40%, rgba(200,135,25,0.15) 40%, rgba(200,135,25,0.15) 60%, transparent 60%),
        linear-gradient(160deg, var(--husk-100), var(--husk-50));
    background-size: 200% 200%, 100% 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    font-size: 0.8rem;
    border: 1px dashed var(--line);
}
.thumb-placeholder::after {
    content: "No photo yet";
}

/* ===========================================================
   Status pills
   =========================================================== */
.status-pill {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: lowercase;
}
.status-active, .status-confirmed, .status-completed, .status-approved { background: #e4efe0; color: var(--paddy-800); }
.status-pending, .status-draft, .status-held, .status-pending_verification, .status-requested { background: #fbeecb; color: var(--turmeric-dark); }
.status-inactive, .status-cancelled, .status-suspended, .status-rejected { background: #f1e4de; color: var(--cinnamon); }
.status-released { background: #e4efe0; color: var(--paddy-800); }
.status-refunded { background: #f1e4de; color: var(--cinnamon); }

/* ===========================================================
   Meta row (dashboard listing cards)
   =========================================================== */
.meta-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
}

.btn-ghost-dark {
    background: transparent;
    color: var(--paddy-800);
    border-color: var(--paddy-800);
}
.btn-ghost-dark:hover { background: var(--paddy-800); color: var(--husk-50); }

/* ===========================================================
   Admin / farmer management sections
   =========================================================== */
.edit-section {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.edit-section form { max-width: none; }
.edit-section .package-form,
.edit-section .upload-form { max-width: 26rem; }

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--ink-soft);
}
.back-link:hover { color: var(--paddy-800); }

.notice {
    background: #e4efe0;
    color: var(--paddy-800);
    border-left: 3px solid var(--paddy-600);
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.hint {
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.status-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.link-btn {
    background: none;
    border: none;
    color: var(--paddy-800);
    text-decoration: underline;
    padding: 0;
    font-size: 0.85rem;
    cursor: pointer;
}
.link-btn:hover { background: none; color: var(--turmeric-dark); }
.link-btn-danger { color: var(--cinnamon); }
.link-btn-danger:hover { color: #6b3527; }

/* ===========================================================
   Photo management grid (farmer listing edit)
   =========================================================== */
.photo-manage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}
.photo-manage-card {
    position: relative;
    text-align: center;
}
.photo-manage-card img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    margin-bottom: 0.4rem;
}
.cover-badge {
    display: inline-block;
    background: var(--turmeric);
    color: var(--paddy-950);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    margin-bottom: 0.3rem;
}
.photo-manage-card form { display: block; max-width: none; }

/* ===========================================================
   Stat cards (admin analytics)
   =========================================================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--paddy-800);
    color: var(--husk-50);
    border-radius: var(--radius-md);
    padding: 1.2rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.stat-num {
    font-family: var(--font-display);
    font-size: 1.7rem;
    color: var(--turmeric);
}
.stat-label {
    font-size: 0.82rem;
    color: #d3d8cb;
}

/* ===========================================================
   Simple CSS bar chart (admin analytics — no JS chart lib needed)
   =========================================================== */
.status-bar-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.status-bar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    height: 160px;
    padding-top: 1rem;
}
.bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    flex: 1;
    min-width: 40px;
}
.bar {
    width: 100%;
    max-width: 42px;
    background: var(--turmeric);
    border-radius: 3px 3px 0 0;
    min-height: 3px;
    transition: height 0.4s ease;
}
.bar-label {
    font-size: 0.72rem;
    color: var(--ink-soft);
    margin-top: 0.5rem;
}
.bar-value {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--paddy-800);
}

/* ===========================================================
   Responsive
   =========================================================== */
@media (max-width: 720px) {
    .how { grid-template-columns: 1fr; gap: 1.6rem; }
    .hero-text { padding: 2.2rem 1.5rem 1.6rem; }
    .site-header { padding: 1rem 1.2rem; flex-direction: column; gap: 0.8rem; align-items: flex-start; }
}

/* ===========================================================
   Respect reduced-motion preference
   =========================================================== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .terrace-line {
        animation: none;
        stroke-dashoffset: 0;
    }
    .btn, button { transition: none; }
}
