/* =============================================================
   agro-main.css — FarmRyt Global Styles
   ============================================================= */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --agro-green:       #2e7d32;
    --agro-green-light: #4caf50;
    --agro-green-pale:  #e8f5e9;
    --agro-accent:      #ff8f00;
    --agro-accent-pale: #fff8e1;
    --agro-blue:        #1565c0;
    --agro-blue-pale:   #e3f2fd;
    --agro-red:         #c62828;
    --agro-red-pale:    #ffebee;

    --bg:               #f4f6f8;
    --surface:          #ffffff;
    --border:           #e0e0e0;
    --text-primary:     #212121;
    --text-secondary:   #616161;
    --text-muted:       #9e9e9e;

    --sidebar-w:        240px;
    --header-h:         60px;
    --radius:           10px;
    --shadow:           0 2px 8px rgba(0,0,0,.08);
    --shadow-md:        0 4px 16px rgba(0,0,0,.12);

    --font:             'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { font-size: 15px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--agro-green); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ---------- Layout Shell ---------- */
.agro-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Header ---------- */
.agro-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--agro-green);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 100;
    box-shadow: var(--shadow-md);
    gap: 1rem;
}

.agro-header__logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .5px;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.agro-header__logo svg { width: 28px; height: 28px; fill: #a5d6a7; }

.agro-header__spacer { flex: 1; }

.agro-header__user {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .875rem;
}

.agro-header__avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--agro-green-light);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .875rem;
}

.agro-header__logout {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    padding: .3rem .75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: .8rem;
    transition: background .2s;
    text-decoration: none;
}
.agro-header__logout:hover { background: rgba(255,255,255,.25); text-decoration: none; }

/* ---------- Sidebar ---------- */
.agro-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--header-h));
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 90;
    padding: 1rem 0;
}

.agro-sidebar__section {
    padding: .5rem 1rem .25rem;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.agro-nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem 1.25rem;
    color: var(--text-secondary);
    font-size: .875rem;
    border-left: 3px solid transparent;
    transition: all .15s;
    cursor: pointer;
    text-decoration: none;
}
.agro-nav-link:hover { background: var(--agro-green-pale); color: var(--agro-green); text-decoration: none; }
.agro-nav-link.active {
    background: var(--agro-green-pale);
    color: var(--agro-green);
    border-left-color: var(--agro-green);
    font-weight: 600;
}

.agro-nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Main Content ---------- */
.agro-main {
    margin-left: var(--sidebar-w);
    margin-top: var(--header-h);
    padding: 2rem;
    flex: 1;
    max-width: 1200px;
}

/* ---------- Page Title ---------- */
.agro-page-title {
    margin-bottom: 1.5rem;
}
.agro-page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}
.agro-page-title p {
    color: var(--text-secondary);
    font-size: .9rem;
    margin-top: .25rem;
}

/* ---------- Cards ---------- */
.agro-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.agro-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}

.agro-card__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: .5rem;
}

.agro-card__title svg { width: 18px; height: 18px; color: var(--agro-green); }

/* ---------- Grid ---------- */
.agro-grid { display: grid; gap: 1.25rem; }
.agro-grid-2 { grid-template-columns: repeat(2, 1fr); }
.agro-grid-3 { grid-template-columns: repeat(3, 1fr); }
.agro-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1100px) { .agro-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px)  {
    .agro-grid-2,
    .agro-grid-3,
    .agro-grid-4 { grid-template-columns: 1fr; }
    .agro-sidebar { transform: translateX(-100%); transition: transform .25s; }
    .agro-sidebar.open { transform: translateX(0); }
    .agro-main { margin-left: 0; padding: 1rem; }
}

/* ---------- Stat Cards ---------- */
.agro-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    border-left: 4px solid var(--agro-green);
}
.agro-stat--accent { border-left-color: var(--agro-accent); }
.agro-stat--blue   { border-left-color: var(--agro-blue); }
.agro-stat--red    { border-left-color: var(--agro-red); }

.agro-stat__icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    background: var(--agro-green-pale);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.agro-stat--accent .agro-stat__icon { background: var(--agro-accent-pale); }
.agro-stat--blue   .agro-stat__icon { background: var(--agro-blue-pale); }
.agro-stat--red    .agro-stat__icon { background: var(--agro-red-pale); }

.agro-stat__icon svg { width: 24px; height: 24px; }
.agro-stat--accent .agro-stat__icon svg { color: var(--agro-accent); }
.agro-stat--blue   .agro-stat__icon svg { color: var(--agro-blue); }
.agro-stat          .agro-stat__icon svg { color: var(--agro-green); }
.agro-stat--red    .agro-stat__icon svg { color: var(--agro-red); }

.agro-stat__label {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
}
.agro-stat__value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.agro-stat__sub {
    font-size: .75rem;
    color: var(--text-secondary);
    margin-top: .15rem;
}

/* ---------- Footer ---------- */
.agro-footer {
    margin-left: var(--sidebar-w);
    background: var(--agro-green);
    color: rgba(255,255,255,.85);
    padding: 1rem 2rem;
    margin-top: 2rem;
}

.agro-footer__inner {
    max-width: 1200px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
}

.agro-footer__brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .8rem;
    opacity: .85;
}

.agro-footer__links {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.agro-footer__links a {
    color: rgba(255,255,255,.75);
    font-size: .8rem;
    text-decoration: none;
    transition: color .15s;
}
.agro-footer__links a:hover { color: #fff; }

.agro-footer__copy {
    font-size: .75rem;
    opacity: .6;
}

@media (max-width: 768px) {
    .agro-footer { margin-left: 0; padding: 1rem; }
    .agro-footer__inner { flex-direction: column; align-items: flex-start; }
}

/* ---------- Forms ---------- */
.agro-form-group { margin-bottom: 1.1rem; }

.agro-label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: .35rem;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.agro-input,
.agro-select,
.agro-textarea {
    width: 100%;
    padding: .6rem .85rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: .9rem;
    font-family: var(--font);
    background: #fff;
    color: var(--text-primary);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.agro-input:focus,
.agro-select:focus,
.agro-textarea:focus {
    border-color: var(--agro-green-light);
    box-shadow: 0 0 0 3px rgba(76,175,80,.15);
}

.agro-textarea { resize: vertical; min-height: 90px; }

/* ---------- Buttons ---------- */
.agro-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.2rem;
    border-radius: 7px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .15s;
    font-family: var(--font);
    text-decoration: none;
    white-space: nowrap;
}

.agro-btn-primary {
    background: var(--agro-green);
    color: #fff;
}
.agro-btn-primary:hover { background: #1b5e20; color: #fff; text-decoration: none; }

.agro-btn-accent {
    background: var(--agro-accent);
    color: #fff;
}
.agro-btn-accent:hover { background: #e65100; color: #fff; }

.agro-btn-outline {
    background: transparent;
    color: var(--agro-green);
    border: 1.5px solid var(--agro-green);
}
.agro-btn-outline:hover { background: var(--agro-green-pale); text-decoration: none; }

.agro-btn-sm { padding: .35rem .8rem; font-size: .8rem; }
.agro-btn-block { width: 100%; justify-content: center; }
.agro-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Table ---------- */
.agro-table-wrap { overflow-x: auto; }
.agro-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.agro-table th {
    background: var(--agro-green-pale);
    color: var(--agro-green);
    font-weight: 700;
    text-align: left;
    padding: .65rem 1rem;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-bottom: 2px solid var(--border);
}
.agro-table td {
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}
.agro-table tr:last-child td { border-bottom: none; }
.agro-table tbody tr:hover { background: var(--agro-green-pale); }

/* ---------- Badges ---------- */
.agro-badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.agro-badge-green  { background: var(--agro-green-pale); color: var(--agro-green); }
.agro-badge-orange { background: var(--agro-accent-pale); color: var(--agro-accent); }
.agro-badge-blue   { background: var(--agro-blue-pale); color: var(--agro-blue); }
.agro-badge-red    { background: var(--agro-red-pale); color: var(--agro-red); }

/* ---------- Alert / Notice ---------- */
.agro-alert {
    padding: .75rem 1rem;
    border-radius: 7px;
    font-size: .875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    border-left: 4px solid;
}
.agro-alert-success { background: var(--agro-green-pale); border-color: var(--agro-green); color: #1b5e20; }
.agro-alert-error   { background: var(--agro-red-pale);   border-color: var(--agro-red);   color: var(--agro-red); }
.agro-alert-info    { background: var(--agro-blue-pale);  border-color: var(--agro-blue);  color: var(--agro-blue); }
.agro-alert-warn    { background: var(--agro-accent-pale);border-color: var(--agro-accent);color: #e65100; }

/* ---------- Loader ---------- */
.agro-loader {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    gap: .5rem;
    color: var(--text-muted);
    font-size: .875rem;
}
.agro-loader.show { display: flex; }
.agro-spinner {
    width: 20px; height: 20px;
    border: 2.5px solid var(--border);
    border-top-color: var(--agro-green);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Auth Pages ---------- */
.agro-auth-wrap {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--agro-green) 0%, #1b5e20 50%, #33691e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.agro-auth-box {
    background: var(--surface);
    border-radius: 14px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-md);
}

.agro-auth-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}
.agro-auth-logo h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--agro-green);
}
.agro-auth-logo p {
    color: var(--text-muted);
    font-size: .85rem;
    margin-top: .25rem;
}

.agro-auth-divider {
    text-align: center;
    margin: 1rem 0;
    color: var(--text-muted);
    font-size: .85rem;
    position: relative;
}
.agro-auth-divider::before,
.agro-auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border);
}
.agro-auth-divider::before { left: 0; }
.agro-auth-divider::after  { right: 0; }

/* ---------- Result Box ---------- */
.agro-result {
    background: var(--agro-green-pale);
    border: 1px solid #a5d6a7;
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1rem;
}

.agro-result__title {
    font-weight: 700;
    color: var(--agro-green);
    margin-bottom: .75rem;
    font-size: .95rem;
}

.agro-result__item {
    display: flex;
    justify-content: space-between;
    padding: .35rem 0;
    border-bottom: 1px dashed #c8e6c9;
    font-size: .875rem;
}
.agro-result__item:last-child { border-bottom: none; }
.agro-result__key   { color: var(--text-secondary); }
.agro-result__val   { font-weight: 600; color: var(--text-primary); }

/* ---------- Section Heading ---------- */
.agro-section-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--agro-green-pale);
}

/* ---------- Chip Tags ---------- */
.agro-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.agro-chip {
    padding: .3rem .75rem;
    background: var(--agro-green-pale);
    color: var(--agro-green);
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
}

/* ---------- Empty State ---------- */
.agro-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.agro-empty svg { width: 56px; height: 56px; margin: 0 auto .75rem; opacity: .4; }
.agro-empty p   { font-size: .9rem; }

/* ---------- Utility ---------- */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); font-size: .85rem; }
.text-green  { color: var(--agro-green); }
.text-accent { color: var(--agro-accent); }
.fw-bold { font-weight: 700; }
