/* =====================================================================
   SHAMBA - shared component styles (plain CSS, works with Tailwind CDN)
   ===================================================================== */
:root {
  --lime: #80B900;
  --lime-dark: #6B9D00;
  --earth: #6D2B0F;
  --earth-dark: #55210B;
  --border: #E2E8D5;
  --bg: #F8FAF4;
  --input-radius: 4px;   /* all text inputs, textareas & selects */
}

html { -webkit-tap-highlight-color: transparent; }
body { font-family: 'Segoe UI', Inter, system-ui, -apple-system, sans-serif; }
[x-cloak], .is-hidden { display: none !important; }

/* ---------- template gradients ---------- */
.hero-overlay-gradient { background: linear-gradient(180deg, rgba(16,24,8,.08) 0%, rgba(20,15,8,.72) 80%, rgba(15,10,5,.92) 100%); }
.hero-side-gradient    { background: linear-gradient(180deg, rgba(0,0,0,.05) 0%, rgba(0,0,0,.45) 75%, rgba(0,0,0,.8) 100%); }
.auth-gradient         { background: linear-gradient(140deg, #80B900 0%, #6B9D00 45%, #3f5d00 100%); }

.custom-scroll::-webkit-scrollbar { height: 6px; width: 6px; }
.custom-scroll::-webkit-scrollbar-thumb { background-color: var(--lime); border-radius: 9999px; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* ---------- form controls ---------- */
.sh-label { display: block; font-size: .8rem; font-weight: 700; color: #334155; margin-bottom: .35rem; }
.sh-label .req { color: #dc2626; margin-left: 2px; }
.sh-input, .sh-select, .sh-textarea {
  display: block; width: 100%; border: 1.5px solid #dfe5d3; background: #fff; color: #0f172a;
  border-radius: var(--input-radius); padding: .62rem .85rem; font-size: .9rem; line-height: 1.35;
  transition: border-color .15s, box-shadow .15s;
}
.sh-select { padding-right: 2.2rem; }
.sh-input::placeholder, .sh-textarea::placeholder { color: #94a3b8; }
.sh-input:focus, .sh-select:focus, .sh-textarea:focus {
  outline: none; border-color: var(--lime); box-shadow: 0 0 0 3px rgba(128,185,0,.18);
}
.sh-input:disabled, .sh-select:disabled, .sh-textarea:disabled { background: #f1f5f9; color: #64748b; }
.is-invalid, .is-invalid:focus { border-color: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239,68,68,.12) !important; }
.sh-error { color: #dc2626; font-size: .75rem; font-weight: 600; margin-top: .3rem; min-height: 0; }
.sh-error:empty { display: none; }
.sh-hint { color: #64748b; font-size: .72rem; margin-top: .3rem; }
/* input[type] prefix beats the Tailwind forms plugin (injected after this file) */
input[type=checkbox].sh-checkbox, input[type=radio].sh-checkbox { width: 1.05rem; height: 1.05rem; border-radius: .3rem; border-color: #cbd5e1; color: var(--lime-dark); }
input[type=checkbox].sh-checkbox:focus, input[type=radio].sh-checkbox:focus { box-shadow: 0 0 0 3px rgba(128,185,0,.2); --tw-ring-color: rgba(128,185,0,.35); }

.sh-input-group { display: flex; align-items: stretch; }
.sh-input-group > .addon {
  display: flex; align-items: center; padding: 0 .75rem; background: #f4f7ee; border: 1.5px solid #dfe5d3;
  border-right: 0; border-radius: var(--input-radius) 0 0 var(--input-radius); color: #64748b; font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.sh-input-group > .sh-input { border-radius: 0 var(--input-radius) var(--input-radius) 0; min-width: 0; }

.pw-toggle { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); color: #94a3b8; padding: .35rem; }
.pw-toggle:hover { color: var(--lime-dark); }

/* ---------- searchable select (Shamba.select) ---------- */
select.sh-enhanced { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; margin: 0 !important; padding: 0 !important; border: 0 !important; }
.ss-wrap { position: relative; display: block; min-width: 0; }
.ss-wrap.ss-inline { display: inline-block; }
.ss-trigger {
  display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left; cursor: pointer; background: #fff;
  border: 1.5px solid #dfe5d3; border-radius: var(--input-radius); padding: .62rem .85rem; font-size: .9rem; line-height: 1.35;
  color: #0f172a; transition: border-color .15s, box-shadow .15s; min-height: 2.6rem;
}
.ss-trigger:focus, .ss-trigger.is-open { outline: none; border-color: var(--lime); box-shadow: 0 0 0 3px rgba(128,185,0,.18); }
.ss-trigger:disabled { background: #f1f5f9; color: #64748b; cursor: not-allowed; }
.ss-trigger .ss-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-trigger .ss-value.is-placeholder { color: #94a3b8; }
.ss-trigger .ss-caret { color: #94a3b8; font-size: .7rem; transition: transform .15s; flex-shrink: 0; }
.ss-trigger.is-open .ss-caret { transform: rotate(180deg); color: var(--lime-dark); }
.ss-trigger.is-invalid { border-color: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239,68,68,.12) !important; }
.ss-trigger.ss-bare { border: 0; box-shadow: none !important; background: transparent; min-height: 0; }

.ss-panel {
  position: fixed; z-index: 9999; background: #fff; border: 1px solid #dfe5d3; border-radius: var(--input-radius);
  box-shadow: 0 18px 40px -12px rgba(15,23,42,.28), 0 4px 10px rgba(15,23,42,.06); overflow: hidden;
  opacity: 0; transform: translateY(-4px); transition: opacity .12s ease, transform .12s ease; display: flex; flex-direction: column;
}
.ss-panel.is-up { transform: translateY(4px); }
.ss-panel.is-open { opacity: 1; transform: translateY(0); }
.ss-search { position: relative; padding: .5rem; border-bottom: 1px solid #eef2e6; background: #fbfdf7; }
.ss-search i { position: absolute; left: 1.15rem; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: .8rem; }
.ss-search input {
  width: 100%; border: 1.5px solid #dfe5d3; border-radius: var(--input-radius); padding: .45rem .6rem .45rem 2rem; font-size: .85rem; background: #fff;
}
.ss-search input:focus { outline: none; border-color: var(--lime); box-shadow: 0 0 0 3px rgba(128,185,0,.15); }
.ss-list { overflow-y: auto; padding: .3rem; overscroll-behavior: contain; }
.ss-list::-webkit-scrollbar { width: 6px; }
.ss-list::-webkit-scrollbar-thumb { background: #cfe0a6; border-radius: 9999px; }
.ss-group { padding: .55rem .6rem .25rem; font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: #94a3b8; }
.ss-option {
  display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; border-radius: 3px; font-size: .86rem; color: #334155; cursor: pointer;
}
.ss-option .ss-check { margin-left: auto; color: var(--lime-dark); font-size: .75rem; visibility: hidden; }
.ss-option.is-selected { font-weight: 700; color: #0f172a; }
.ss-option.is-selected .ss-check { visibility: visible; }
.ss-option.is-active { background: #f1f8e2; color: #0f172a; }
.ss-option.is-disabled { opacity: .45; cursor: not-allowed; }
.ss-option.is-placeholder { color: #94a3b8; }
.ss-option mark { background: #ecfccb; color: inherit; border-radius: 2px; padding: 0 1px; }
.ss-empty { padding: 1rem .75rem; text-align: center; font-size: .82rem; color: #94a3b8; }

/* ---------- buttons ---------- */
.sh-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font-weight: 800; font-size: .875rem;
  border-radius: 9999px; padding: .62rem 1.25rem; transition: all .15s ease; white-space: nowrap; cursor: pointer;
  border: 1.5px solid transparent; line-height: 1.2;
}
.sh-btn:disabled, .sh-btn.is-loading { opacity: .65; cursor: not-allowed; }
.sh-btn-sm { padding: .4rem .85rem; font-size: .78rem; }
.sh-btn-lg { padding: .8rem 1.6rem; font-size: 1rem; }
.sh-btn-primary { background: var(--lime); color: #1a2e05; }
.sh-btn-primary:hover:not(:disabled) { background: var(--lime-dark); color: #fff; }
.sh-btn-earth { background: var(--earth); color: #fff; }
.sh-btn-earth:hover:not(:disabled) { background: var(--earth-dark); }
.sh-btn-green { background: #008F4C; color: #fff; }
.sh-btn-green:hover:not(:disabled) { background: #00753E; }
.sh-btn-outline { background: #fff; border-color: #dfe5d3; color: #334155; }
.sh-btn-outline:hover:not(:disabled) { border-color: var(--lime); color: var(--lime-dark); background: #f7fbef; }
.sh-btn-ghost { background: transparent; color: #475569; }
.sh-btn-ghost:hover:not(:disabled) { background: #f1f5f9; }
.sh-btn-danger { background: #dc2626; color: #fff; }
.sh-btn-danger:hover:not(:disabled) { background: #b91c1c; }
.sh-btn-dark { background: #0f172a; color: #fff; }
.sh-btn-dark:hover:not(:disabled) { background: #1e293b; }

.sh-icon-btn {
  width: 2.1rem; height: 2.1rem; display: inline-flex; align-items: center; justify-content: center; border-radius: .65rem;
  color: #475569; transition: all .15s; border: 1px solid transparent;
}
.sh-icon-btn:hover { background: #f1f5f9; color: #0f172a; border-color: #e2e8f0; }
.sh-icon-btn.danger:hover { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.sh-icon-btn.lime:hover { background: #f7fbef; color: var(--lime-dark); border-color: #d9f99d; }

.spinner { width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: sh-spin .7s linear infinite; }
@keyframes sh-spin { to { transform: rotate(360deg); } }

/* ---------- cards ---------- */
.sh-card { background: #fff; border: 1px solid var(--border); border-radius: 1rem; box-shadow: 0 2px 10px rgba(0,0,0,.05); }

/* ---------- modals & dialogs ---------- */
.sh-dialog, .sh-modal { opacity: 0; transition: opacity .18s ease; }
.sh-dialog.is-open, .sh-modal.is-open { opacity: 1; }
.sh-dialog .sh-dialog-panel, .sh-modal .sh-modal-panel { transform: translateY(18px) scale(.97); transition: transform .22s cubic-bezier(.2,.9,.3,1.2); }
.sh-dialog.is-open .sh-dialog-panel, .sh-modal.is-open .sh-modal-panel { transform: translateY(0) scale(1); }
.sh-dialog-icon { animation: sh-pop .35s ease .05s both; }
@keyframes sh-pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
@media (max-width: 639px) {
  .sh-modal .sh-modal-panel { transform: translateY(40px); }
}

/* ---------- skeleton loaders ---------- */
.skeleton { background: linear-gradient(90deg, #eef2e6 25%, #f7faf2 37%, #eef2e6 63%); background-size: 400% 100%; animation: sh-shimmer 1.3s ease infinite; border-radius: .5rem; }
@keyframes sh-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- data tables ---------- */
.sh-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .85rem; }
.sh-table thead th {
  text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #64748b; font-weight: 800;
  background: #f7faf2; padding: .7rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.sh-table tbody td { padding: .8rem 1rem; border-bottom: 1px solid #f1f5ea; vertical-align: middle; color: #334155; }
.sh-table tbody tr:hover td { background: #fbfdf7; }
.sh-table tbody tr:last-child td { border-bottom: 0; }

/* ---------- dashboard sidebar ---------- */
.sb-link { display: flex; align-items: center; gap: .75rem; padding: .62rem .85rem; border-radius: .75rem; font-size: .875rem; font-weight: 600; transition: all .15s; }
.sb-link i { width: 1.15rem; text-align: center; }
#sidebar { transition: transform .25s ease; }

/* ---------- product gallery ---------- */
.thumb.is-active { outline: 3px solid var(--lime); outline-offset: 1px; }

/* ---------- misc ---------- */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.prose-shamba p { margin-bottom: .75rem; }
.dropzone { border: 2px dashed #cfe0a6; background: #fbfdf6; border-radius: 1rem; transition: all .15s; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--lime); background: #f4fae6; }
.impersonation-bar { background: repeating-linear-gradient(45deg, #55210B, #55210B 14px, #5f2610 14px, #5f2610 28px); }

@media print {
  header, footer, nav, #sidebar, .no-print { display: none !important; }
}
