/* ============================================================
   FarmERP - Main Stylesheet
   ============================================================ */

:root {
  --sidebar-width: 220px;
  --green-dark: #155724;
  --green-mid: #28a745;
}

body { background: #f4f6f8; font-size: 14px; }
body.rtl { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

/* ---- Sidebar ---- */
#sidebar {
  width: var(--sidebar-width);
  min-height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  flex-shrink: 0;
  transition: width .2s;
}
.sidebar-inner { padding: 8px 0; }
.sidebar-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: #999; padding: 12px 16px 4px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: #444; text-decoration: none;
  font-size: 13.5px; border-radius: 6px; margin: 1px 8px;
  transition: background .15s, color .15s;
}
.sidebar-link:hover { background: #f0faf0; color: #28a745; }
.sidebar-link.active { background: #d4edda; color: #155724; font-weight: 500; }
.sidebar-link i { font-size: 16px; min-width: 18px; }

/* RTL sidebar */
body.rtl .sidebar-link { flex-direction: row-reverse; }
body.rtl #sidebar { border-right: none !important; border-left: 1px solid #dee2e6 !important; }

/* ---- Cards ---- */
.card { border: none; box-shadow: 0 1px 4px rgba(0,0,0,.08); border-radius: 10px; }
.card-header { background: #fff; border-bottom: 1px solid #e9ecef; font-weight: 500; }

/* ---- Metric cards ---- */
.metric-card {
  background: #fff; border-radius: 10px; padding: 16px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08); border-left: 4px solid transparent;
}
.metric-card.green  { border-color: #28a745; }
.metric-card.red    { border-color: #dc3545; }
.metric-card.blue   { border-color: #0d6efd; }
.metric-card.orange { border-color: #fd7e14; }
.metric-card.purple { border-color: #6f42c1; }
.metric-card .label { font-size: 12px; color: #6c757d; margin-bottom: 4px; }
.metric-card .value { font-size: 22px; font-weight: 600; margin-bottom: 2px; }
.metric-card .sub   { font-size: 12px; color: #6c757d; }

body.rtl .metric-card { border-left: none; border-right: 4px solid transparent; }
body.rtl .metric-card.green  { border-right-color: #28a745; }
body.rtl .metric-card.red    { border-right-color: #dc3545; }
body.rtl .metric-card.blue   { border-right-color: #0d6efd; }
body.rtl .metric-card.orange { border-right-color: #fd7e14; }
body.rtl .metric-card.purple { border-right-color: #6f42c1; }

/* ---- Table ---- */
.table-card { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.08); overflow: hidden; }
.table-responsive { overflow-x: auto; }
.table thead th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; background: #f8f9fa; color: #6c757d; border: none; padding: 10px 14px; white-space: nowrap; }
.table tbody td { padding: 10px 14px; vertical-align: middle; border-color: #f0f0f0; font-size: 13px; }
.table tbody tr:hover td { background: #f8fff8; }

/* ---- Forms ---- */
.form-label { font-weight: 500; font-size: 13px; }
.form-control, .form-select { font-size: 13px; }
.required::after { content: ' *'; color: #dc3545; }

/* ---- Badges ---- */
.badge { font-size: 11px; font-weight: 500; padding: 4px 10px; border-radius: 20px; }

/* ---- Alerts ---- */
.alert-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px;
  border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.alert-item i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ---- Progress ---- */
.progress { height: 6px; border-radius: 3px; background: #e9ecef; }

/* ---- Page header ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { font-size: 20px; font-weight: 600; margin: 0; }

/* ---- Filter bar ---- */
.filter-bar { background: #fff; border-radius: 10px; padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 16px; }
.filter-bar .row { row-gap: 8px; }

/* ---- Charts ---- */
.chart-container { position: relative; }

/* ---- Login page ---- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a6b2f, #28a745, #52b96a); }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { width: 60px; height: 60px; border-radius: 16px; background: #28a745;
  display: inline-flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 12px; }

/* ---- Misc ---- */
.clickable { cursor: pointer; }
.text-money { font-family: 'Courier New', monospace; font-weight: 600; }
.no-records { text-align: center; padding: 40px; color: #6c757d; }
.no-records i { font-size: 40px; display: block; margin-bottom: 10px; opacity: .4; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* ---- Responsive ---- */
@media (max-width: 767px) {
  #sidebar { position: fixed; left: -220px; top: 56px; z-index: 1000; transition: left .2s; }
  #sidebar.open { left: 0; }
  body.rtl #sidebar { left: auto; right: -220px; }
  body.rtl #sidebar.open { right: 0; }
  .metric-card .value { font-size: 18px; }
}
