/*
 * FarmTab Child — Dashboard Styles
 * All selectors prefixed with .ftdash- to avoid any conflicts with parent theme.
 * Loaded only on is_account_page().
 */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
    --ft-sidebar:   #0f1623;
    --ft-accent:    #4f6ef7;
    --ft-accent-h:  #3a5ce6;
    --ft-success:   #22c55e;
    --ft-danger:    #ef4444;
    --ft-bg:        #f4f5f9;
    --ft-card:      #fff;
    --ft-border:    #e8eaf0;
    --ft-text:      #1a1d2e;
    --ft-muted:     #6b7280;
    --ft-radius:    12px;
    --ft-radius-sm: 8px;
    --ft-shadow:    0 1px 3px rgba(0,0,0,.05),0 4px 12px rgba(0,0,0,.04);
    --ft-shadow-lg: 0 8px 32px rgba(0,0,0,.14);
    --ft-font:     'DM Sans',system-ui,sans-serif;
    --ft-sidebar-w: 250px;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.ftdash { display:flex; min-height:80vh; background:var(--ft-bg); font-family:var(--ft-font); }
.ftdash * { box-sizing:border-box; }

/* Sidebar */
.ftdash-sidebar { width:var(--ft-sidebar-w); background:var(--ft-sidebar); display:flex; flex-direction:column; flex-shrink:0; }
.ftdash-sidebar__profile { padding:20px; display:flex; gap:12px; align-items:center; border-bottom:1px solid rgba(255,255,255,.07); }
.ftdash-avatar { width:40px; height:40px; border-radius:50%; object-fit:cover; border:2px solid rgba(255,255,255,.15); flex-shrink:0; }
.ftdash-sidebar__profile strong { display:block; color:#fff; font-size:13px; font-weight:600; }
.ftdash-sidebar__profile span { color:rgba(255,255,255,.5); font-size:11px; display:block; }
.ftdash-sidebar__site-switch,.ftdash-sidebar__active-store { margin:12px 12px 0; padding:10px; background:rgba(255,255,255,.06); border-radius:var(--ft-radius-sm); }
.ftdash-mini-label { display:block; font-size:10px; font-weight:700; letter-spacing:.07em; text-transform:uppercase; color:rgba(255,255,255,.3); margin-bottom:4px; }
.ftdash-sidebar__active-store strong { color:#fff; font-size:13px; }
.ftdash-sidebar__nav { flex:1; padding:10px; }
.ftdash-nav-item { display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:var(--ft-radius-sm); color:rgba(255,255,255,.55); text-decoration:none; font-size:13px; font-weight:500; transition:background .15s,color .15s; cursor:pointer; margin-bottom:2px; position:relative; }
.ftdash-nav-item svg { width:15px; height:15px; flex-shrink:0; }
.ftdash-nav-item:hover { background:rgba(255,255,255,.07); color:#fff; }
.ftdash-nav-item.is-active { background:rgba(255,255,255,.09); color:#fff; }
.ftdash-nav-item.is-active::before { content:''; position:absolute; left:0; top:22%; height:56%; width:3px; background:var(--ft-accent); border-radius:0 3px 3px 0; }
.ftdash-nav-item--logout { color:rgba(239,68,68,.65); }
.ftdash-nav-item--logout:hover { background:rgba(239,68,68,.1); color:#ef4444; }
.ftdash-nav-divider { font-size:10px; font-weight:700; letter-spacing:.07em; text-transform:uppercase; color:rgba(255,255,255,.22); padding:14px 12px 4px; display:block; }
.ftdash-sidebar__footer { padding:10px; border-top:1px solid rgba(255,255,255,.06); }

/* Main */
.ftdash-main { flex:1; min-width:0; }
.ftdash-main__inner { max-width:1000px; padding:32px 36px; }

/* ── Components ─────────────────────────────────────────────────────────── */
.ftdash-page-header { display:flex; align-items:flex-end; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:24px; }
.ftdash-page-header h1 { font-size:24px; font-weight:700; color:var(--ft-text); letter-spacing:-.3px; margin:0 0 3px; font-family:var(--ft-font); }
.ftdash-page-header p { color:var(--ft-muted); font-size:14px; margin:0; }

.ftdash-card { background:var(--ft-card); border:1px solid var(--ft-border); border-radius:var(--ft-radius); padding:22px; margin-bottom:18px; box-shadow:var(--ft-shadow); }
.ftdash-card__head { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; padding-bottom:12px; border-bottom:1px solid var(--ft-border); }
.ftdash-card__head h2 { font-size:15px; font-weight:600; color:var(--ft-text); margin:0; font-family:var(--ft-font); }

.ftdash-stats-row { display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-bottom:20px; }
.ftdash-stat { background:var(--ft-card); border:1px solid var(--ft-border); border-radius:var(--ft-radius); padding:18px; box-shadow:var(--ft-shadow); }
.ftdash-stat--accent { background:linear-gradient(135deg,var(--ft-accent),#6366f1); border-color:transparent; }
.ftdash-stat--accent .ftdash-stat__value,.ftdash-stat--accent .ftdash-stat__label { color:#fff; }
.ftdash-stat__value { font-size:26px; font-weight:700; color:var(--ft-text); letter-spacing:-.4px; line-height:1; margin-bottom:5px; }
.ftdash-stat__label { font-size:11px; font-weight:600; color:var(--ft-muted); text-transform:uppercase; letter-spacing:.06em; }

.ftdash-btn { display:inline-flex; align-items:center; gap:6px; padding:9px 16px; border-radius:var(--ft-radius-sm); font-size:13px; font-weight:600; font-family:var(--ft-font); cursor:pointer; border:none; transition:background .15s,box-shadow .15s; text-decoration:none; white-space:nowrap; }
.ftdash-btn svg { width:13px; height:13px; }
.ftdash-btn--primary { background:var(--ft-accent); color:#fff; }
.ftdash-btn--primary:hover { background:var(--ft-accent-h); box-shadow:0 4px 12px rgba(79,110,247,.3); }
.ftdash-btn--ghost { background:transparent; color:var(--ft-text); border:1.5px solid var(--ft-border); }
.ftdash-btn--ghost:hover { background:var(--ft-bg); }
.ftdash-btn--danger { color:var(--ft-danger); border:1.5px solid rgba(239,68,68,.25); background:transparent; }
.ftdash-btn--danger:hover { background:rgba(239,68,68,.06); }
.ftdash-btn--farmer { background:var(--ft-success); color:#fff; padding:11px 20px; font-size:14px; border-radius:10px; }
.ftdash-btn--farmer:hover { background:#16a34a; box-shadow:0 4px 14px rgba(34,197,94,.35); }
.ftdash-btn--sm { padding:5px 11px; font-size:12px; }
.ftdash-btn--block { width:100%; justify-content:center; }
.ftdash-btn:disabled { opacity:.55; cursor:not-allowed; }

.ftdash-input,.ftdash-select,.ftdash-textarea { width:100%; padding:9px 12px; font-size:14px; font-family:var(--ft-font); color:var(--ft-text); background:#fff; border:1.5px solid var(--ft-border); border-radius:var(--ft-radius-sm); outline:none; transition:border-color .15s,box-shadow .15s; -webkit-appearance:none; }
.ftdash-textarea { resize:vertical; min-height:80px; }
.ftdash-input:focus,.ftdash-select:focus,.ftdash-textarea:focus { border-color:var(--ft-accent); box-shadow:0 0 0 3px rgba(79,110,247,.1); }
.ftdash-input-wrap { position:relative; }
.ftdash-input-wrap .ftdash-input { padding-right:40px; }
.ftdash-toggle-pass { position:absolute; right:11px; top:50%; transform:translateY(-50%); background:none; border:none; cursor:pointer; color:var(--ft-muted); padding:4px; }
.ftdash-toggle-pass svg { width:16px; height:16px; display:block; }
.ftdash-field { margin-bottom:14px; }
.ftdash-field label { display:block; font-size:12px; font-weight:600; color:var(--ft-text); margin-bottom:4px; }
.ftdash-label-link { float:right; font-size:11px; font-weight:500; color:var(--ft-accent); text-decoration:none; }
.ftdash-checkbox { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--ft-text); cursor:pointer; margin-bottom:14px; }
.ftdash-two-col { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.ftdash-hr { border:none; border-top:1px solid var(--ft-border); margin:20px 0; }
.ftdash-section-title { font-size:15px; font-weight:600; color:var(--ft-text); margin:0 0 14px; font-family:var(--ft-font); }

.ftdash-alert { padding:10px 13px; border-radius:var(--ft-radius-sm); font-size:13px; margin-bottom:14px; }
.ftdash-alert--error   { background:rgba(239,68,68,.07); color:#b91c1c; border:1px solid rgba(239,68,68,.2); }
.ftdash-alert--success { background:rgba(34,197,94,.08); color:#166534; border:1px solid rgba(34,197,94,.2); }
.ftdash-msg { padding:9px 12px; border-radius:var(--ft-radius-sm); font-size:13px; }
.ftdash-msg.ok  { background:rgba(34,197,94,.08); color:#166534; }
.ftdash-msg.err { background:rgba(239,68,68,.07); color:#b91c1c; }

.ftdash-badge { display:inline-block; padding:2px 7px; border-radius:100px; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; background:rgba(79,110,247,.1); color:var(--ft-accent); }
.ftdash-badge--admin { background:rgba(139,92,246,.12); color:#7c3aed; }
.ftdash-badge--super { background:rgba(245,158,11,.12); color:#b45309; }

.ftdash-status { display:inline-flex; align-items:center; gap:4px; padding:2px 8px; border-radius:100px; font-size:11px; font-weight:700; white-space:nowrap; }
.ftdash-status::before { content:''; width:5px; height:5px; border-radius:50%; background:currentColor; flex-shrink:0; }
.ftdash-status--processing { background:rgba(79,110,247,.1);  color:var(--ft-accent); }
.ftdash-status--completed  { background:rgba(34,197,94,.1);   color:#16a34a; }
.ftdash-status--pending    { background:rgba(245,158,11,.1);  color:#b45309; }
.ftdash-status--cancelled  { background:rgba(239,68,68,.1);   color:#dc2626; }
.ftdash-status--on-hold    { background:rgba(156,163,175,.15);color:#6b7280; }
.ftdash-status--refunded   { background:rgba(139,92,246,.1);  color:#7c3aed; }
.ftdash-status--publish    { background:rgba(34,197,94,.1);   color:#16a34a; }
.ftdash-status--draft      { background:rgba(156,163,175,.15);color:#6b7280; }

.ftdash-table { width:100%; border-collapse:collapse; font-size:13px; }
.ftdash-table th { text-align:left; padding:8px 10px; font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--ft-muted); border-bottom:1px solid var(--ft-border); }
.ftdash-table td { padding:11px 10px; vertical-align:middle; border-bottom:1px solid var(--ft-border); color:var(--ft-text); }
.ftdash-table tr:last-child td { border-bottom:none; }
.ftdash-table tbody tr:hover { background:#fafbff; }
.ftdash-table tr.clickable { cursor:pointer; }

.ftdash-filters { display:flex; gap:10px; margin-bottom:16px; flex-wrap:wrap; }
.ftdash-filters .ftdash-input { max-width:220px; }
.ftdash-filters .ftdash-select { max-width:160px; }

.ftdash-pagination { display:flex; gap:5px; margin-top:16px; flex-wrap:wrap; }
.ftdash-pagination button { padding:5px 11px; border-radius:var(--ft-radius-sm); border:1px solid var(--ft-border); background:var(--ft-card); font-size:13px; cursor:pointer; color:var(--ft-text); font-family:var(--ft-font); }
.ftdash-pagination button:hover { background:var(--ft-bg); }
.ftdash-pagination button.active { background:var(--ft-accent); color:#fff; border-color:var(--ft-accent); }
.ftdash-pagination button:disabled { opacity:.4; cursor:default; }

.ftdash-loading { display:flex; align-items:center; justify-content:center; padding:40px; color:var(--ft-muted); font-size:13px; font-family:var(--ft-font); }
.ftdash-loading::before { content:''; width:20px; height:20px; border:2px solid var(--ft-border); border-top-color:var(--ft-accent); border-radius:50%; animation:ftdash-spin .65s linear infinite; margin-right:10px; flex-shrink:0; }
@keyframes ftdash-spin { to { transform:rotate(360deg); } }

.ftdash-empty { padding:40px 20px; text-align:center; color:var(--ft-muted); font-size:14px; }
.ftdash-link { color:var(--ft-accent); font-size:13px; font-weight:600; text-decoration:none; }

.ftdash-payment-card { display:flex; align-items:center; gap:14px; padding:13px 15px; border:1.5px solid var(--ft-border); border-radius:var(--ft-radius); margin-bottom:10px; background:var(--ft-card); }
.ftdash-payment-card.is-default { border-color:var(--ft-accent); }
.ftdash-payment-card__info { flex:1; }

.ftdash-chart { height:160px; display:flex; align-items:flex-end; gap:4px; padding:8px 0 0; }
.ftdash-bar-group { flex:1; display:flex; flex-direction:column; align-items:center; gap:4px; height:100%; justify-content:flex-end; }
.ftdash-bar { width:100%; max-width:30px; background:var(--ft-accent); border-radius:4px 4px 0 0; min-height:3px; opacity:.8; }
.ftdash-bar:hover { opacity:1; }
.ftdash-bar-day,.ftdash-bar-val { font-size:9px; color:var(--ft-muted); }

.ftdash-form-actions { display:flex; gap:10px; justify-content:flex-end; padding-top:14px; border-top:1px solid var(--ft-border); margin-top:14px; }

/* Drawers */
.ftdash-drawer { position:fixed; inset:0; z-index:9999; pointer-events:none; }
.ftdash-drawer.is-open { pointer-events:all; }
.ftdash-drawer__backdrop { position:absolute; inset:0; background:rgba(15,22,35,.45); opacity:0; transition:opacity .22s; }
.ftdash-drawer.is-open .ftdash-drawer__backdrop { opacity:1; }
.ftdash-drawer__panel { position:absolute; right:0; top:0; bottom:0; width:440px; max-width:94vw; background:#fff; box-shadow:var(--ft-shadow-lg); display:flex; flex-direction:column; transform:translateX(100%); transition:transform .26s cubic-bezier(.25,.46,.45,.94); }
.ftdash-drawer.is-open .ftdash-drawer__panel { transform:translateX(0); }
.ftdash-drawer--wide .ftdash-drawer__panel { width:620px; }
.ftdash-drawer__head { padding:20px 20px 16px; border-bottom:1px solid var(--ft-border); display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
.ftdash-drawer__head h2 { margin:0; font-size:17px; font-weight:700; font-family:var(--ft-font); }
.ftdash-drawer__close { position:absolute; right:16px; top:16px; width:28px; height:28px; border-radius:var(--ft-radius-sm); border:1px solid var(--ft-border); background:transparent; cursor:pointer; font-size:14px; color:var(--ft-muted); display:flex; align-items:center; justify-content:center; }
.ftdash-drawer__close:hover { background:var(--ft-bg); }
.ftdash-drawer__body { flex:1; overflow-y:auto; padding:20px; }

/* Order detail inside drawer */
.ftdash-order-detail h2 { font-size:18px; font-weight:700; margin:0 0 4px; font-family:var(--ft-font); }
.ftdash-order-meta { color:var(--ft-muted); font-size:12px; margin-bottom:16px; }
.ftdash-order-item { display:flex; gap:10px; padding:9px 0; border-bottom:1px solid var(--ft-border); align-items:center; }
.ftdash-order-item:last-child { border-bottom:none; }
.ftdash-order-item img { width:42px; height:42px; border-radius:var(--ft-radius-sm); object-fit:cover; border:1px solid var(--ft-border); flex-shrink:0; }
.ftdash-order-item__name { font-weight:600; font-size:13px; }
.ftdash-order-item__total { font-weight:700; font-size:13px; margin-left:auto; }
.ftdash-order-totals { border-top:1px solid var(--ft-border); padding-top:12px; margin-top:10px; }
.ftdash-order-totals .row { display:flex; justify-content:space-between; padding:2px 0; font-size:13px; color:var(--ft-muted); }
.ftdash-order-totals .row.total { font-weight:700; color:var(--ft-text); font-size:14px; border-top:1px solid var(--ft-border); padding-top:8px; margin-top:5px; }
.ftdash-section-lbl { font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--ft-muted); margin:14px 0 6px; }
.ftdash-status-ctrl { display:flex; gap:8px; align-items:center; margin-bottom:12px; }
.ftdash-status-ctrl .ftdash-select { flex:1; }

/* Login page */
.ftdash-login { padding:40px 20px; background:linear-gradient(135deg,#0f1623,#1a2640); min-height:70vh; display:flex; align-items:center; justify-content:center; }
.ftdash-login__wrap { display:grid; grid-template-columns:400px 320px; background:#fff; border-radius:18px; overflow:hidden; box-shadow:0 20px 56px rgba(0,0,0,.28); max-width:740px; width:100%; }
.ftdash-login__card { padding:38px 36px; border-right:1px solid var(--ft-border); }
.ftdash-login__logo { text-align:center; margin-bottom:22px; }
.ftdash-login__logo img { max-height:42px; }
.ftdash-login__site-name { font-size:20px; font-weight:800; color:var(--ft-text); }
.ftdash-login__title { font-size:19px; font-weight:700; color:var(--ft-text); text-align:center; margin:0 0 20px; font-family:var(--ft-font); letter-spacing:-.2px; }
.ftdash-login__register { text-align:center; font-size:13px; color:var(--ft-muted); margin-top:16px; }
.ftdash-login__register a { color:var(--ft-accent); font-weight:600; text-decoration:none; }
.ftdash-login__farmer { background:linear-gradient(160deg,#0f1623 0%,#1a3a2a 100%); display:flex; align-items:center; justify-content:center; padding:36px 28px; }
.ftdash-login__farmer-inner { text-align:center; }
.ftdash-login__farmer-icon { font-size:44px; margin-bottom:14px; }
.ftdash-login__farmer h2 { font-size:18px; font-weight:700; color:#fff; margin:0 0 10px; font-family:var(--ft-font); }
.ftdash-login__farmer p  { font-size:13px; color:rgba(255,255,255,.6); line-height:1.6; margin:0 0 20px; }
.ftdash-login__farmer-note { font-size:11px; color:rgba(255,255,255,.38); margin:14px 0 0; }
.ftdash-login__farmer-note a { color:rgba(255,255,255,.55); text-decoration:none; }

/* Responsive */
@media (max-width:860px) {
    :root { --ft-sidebar-w: 200px; }
    .ftdash-main__inner { padding:22px 18px; }
    .ftdash-stats-row { grid-template-columns:1fr 1fr; }
}
@media (max-width:640px) {
    .ftdash { flex-direction:column; }
    .ftdash-sidebar { width:100%; position:sticky; bottom:0; flex-direction:row; height:auto; order:2; border-top:1px solid rgba(255,255,255,.07); }
    .ftdash-sidebar__profile,.ftdash-sidebar__footer,.ftdash-sidebar__site-switch,.ftdash-sidebar__active-store,.ftdash-nav-divider { display:none; }
    .ftdash-sidebar__nav { display:flex; flex-direction:row; padding:0; width:100%; overflow-x:auto; }
    .ftdash-nav-item { flex-direction:column; gap:2px; padding:8px 10px; border-radius:0; margin:0; flex:1; min-width:50px; font-size:9px; justify-content:center; }
    .ftdash-nav-item svg { width:18px; height:18px; }
    .ftdash-nav-item.is-active::before { display:none; }
    .ftdash-main { order:1; padding-bottom:60px; }
    .ftdash-main__inner { padding:16px 12px; }
    .ftdash-two-col,.ftdash-stats-row { grid-template-columns:1fr; }
    .ftdash-login__wrap { grid-template-columns:1fr; max-width:400px; }
    .ftdash-login__card { border-right:none; border-bottom:1px solid var(--ft-border); padding:28px 22px; }
    .ftdash-login__farmer { padding:26px 22px; }
    .ftdash-drawer__panel { width:100%; top:15%; border-radius:16px 16px 0 0; }
}
