/* SBY Upload Form + Fleet Management — clean frontend admin */
#sby-upload-root {
    font-family: 'Heebo', system-ui, sans-serif;
    background: #0e0f12;
    color: #f5f6f8;
    min-height: 100vh;
    padding: 40px 20px;
    direction: rtl;
}
.sby-form-wrap {
    max-width: 900px;
    margin: 0 auto;
}
.sby-form-wrap h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 32px;
    text-align: center;
}

/* ── Tabs ── */
.sby-tabs {
    display: flex;
    gap: 4px;
    background: #141519;
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 32px;
}
.sby-tab {
    flex: 1;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #6a6f77;
    background: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}
.sby-tab:hover { color: #a6abb4; }
.sby-tab.active {
    background: #1a1c21;
    color: #f5f6f8;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
/* Tab content: hidden by default. JS switchTab() controls visibility via
   inline style.display, which always overrides this class rule. The .active
   class serves as a no-JS fallback so the first tab is visible before JS loads. */
.sby-tab-content { display: none; }
.sby-tab-content.active { display: block; }

/* ── Form sections ── */
.sby-form-section {
    background: #141519;
    border-radius: 18px;
    padding: 28px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,.07);
}
.sby-form-section h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #f5f6f8;
}
.sby-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.sby-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #a6abb4;
    margin-bottom: 6px;
}
.sby-field.auto label::after {
    content: ' (אוטומטי)';
    font-size: 11px;
    color: #6a6f77;
}
.req-mark { color: #e2231a; font-weight: 700; }

.sby-field input,
.sby-field select,
#sby-upload-root textarea {
    width: 100%;
    padding: 12px 14px;
    background: #1a1c21;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 12px;
    color: #f5f6f8;
    font-family: inherit;
    font-size: 15px;
    transition: border .2s;
}
.sby-field input:focus,
.sby-field select:focus,
#sby-upload-root textarea:focus {
    outline: none;
    border-color: #e2231a;
}
#sby-upload-root textarea {
    resize: vertical;
    min-height: 100px;
    margin-bottom: 12px;
}

/* Plate row */
.sby-plate-row {
    display: flex;
    gap: 12px;
}
.sby-plate-row input {
    flex: 1;
    padding: 14px 18px;
    background: #1a1c21;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 12px;
    color: #f5f6f8;
    font-size: 18px;
    font-family: inherit;
    letter-spacing: 2px;
    text-align: center;
}
.sby-plate-row input:focus {
    outline: none;
    border-color: #e2231a;
}

/* ── Buttons ── */
.sby-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: #e2231a;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background .2s, transform .15s;
    font-family: inherit;
}
.sby-btn-primary:hover { background: #c91d15; }
.sby-btn-primary:active { transform: scale(.97); }
.sby-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.sby-btn-lg {
    justify-content: center;
    padding: 18px;
    font-size: 18px;
    border-radius: 14px;
}
.sby-form-actions .sby-btn-lg { width: 100%; }
.sby-form-actions { margin-top: 24px; display: flex; gap: 12px; }

.sby-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(226,35,26,.13);
    color: #e2231a;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid rgba(226,35,26,.25);
    border-radius: 10px;
    cursor: pointer;
    transition: background .2s;
    font-family: inherit;
}
.sby-btn-secondary:hover { background: rgba(226,35,26,.22); }
.sby-btn-secondary:disabled { opacity: .5; cursor: not-allowed; }

.sby-btn-sm {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}

/* ── Category chips (multi-select) ── */
.sby-cat-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.sby-cat-chip {
    cursor: pointer;
}
.sby-cat-chip input { display: none; }
.sby-cat-chip span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: #1a1c21;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    color: #a6abb4;
    transition: all .2s;
}
.sby-cat-chip:hover span { border-color: rgba(255,255,255,.2); color: #f5f6f8; }
.sby-cat-chip input:checked + span {
    background: #e2231a;
    border-color: #e2231a;
    color: #fff;
}

/* ── Images grid ── */
.sby-images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.sby-img-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.07);
}
.sby-img-item img { width: 100%; height: 100%; object-fit: cover; }
.sby-img-remove {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    background: rgba(226,35,26,.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Messages ── */
.sby-msg { margin-top: 12px; padding: 0; font-size: 14px; min-height: 20px; }
.sby-msg.error { color: #ff3b30; }
.sby-msg.success { color: #25d366; }
.sby-msg.loading { color: #a6abb4; }

/* ── Fleet Management ── */
.sby-fleet-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.sby-filter-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #6a6f77;
    background: #141519;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 10px;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}
.sby-filter-btn:hover { color: #a6abb4; border-color: rgba(255,255,255,.15); }
.sby-filter-btn.active {
    color: #f5f6f8;
    background: #1a1c21;
    border-color: #e2231a;
}
.sby-filter-btn .count {
    display: inline-block;
    background: rgba(255,255,255,.1);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    margin-right: 6px;
}

/* Fleet stats */
.sby-fleet-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.sby-stat-card {
    flex: 1;
    min-width: 120px;
    background: #141519;
    border-radius: 14px;
    padding: 18px;
    text-align: center;
    border: 1px solid rgba(255,255,255,.07);
}
.sby-stat-card .num {
    font-size: 28px;
    font-weight: 800;
    color: #f5f6f8;
}
.sby-stat-card .lbl {
    font-size: 13px;
    color: #6a6f77;
    margin-top: 4px;
}
.sby-stat-card.green .num { color: #25d366; }
.sby-stat-card.yellow .num { color: #f5a623; }
.sby-stat-card.red .num { color: #e2231a; }
.sby-stat-card.blue .num { color: #4da3ff; }
.sby-stat-card .sub {
    font-size: 11px;
    color: #6a6f77;
    margin-top: 2px;
    white-space: nowrap;
}
.sby-src-card {
    flex: 100%;
    background: #141519;
    border-radius: 14px;
    padding: 18px;
    border: 1px solid rgba(255,255,255,.07);
}
.sby-src-card > .lbl {
    font-size: 13px;
    color: #6a6f77;
    margin-bottom: 10px;
}
.sby-src-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    color: #f5f6f8;
}
.sby-src-table th {
    text-align: right;
    font-size: 12px;
    color: #6a6f77;
    font-weight: 600;
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.sby-src-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,.04);
}
.sby-src-table tr:last-child td { border-bottom: 0; }

/* Fleet toolbar — free-text search + engagement period */
.sby-fleet-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.sby-fleet-search {
    flex: 1;
    min-width: 220px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    color: #f5f6f8;
    background: #141519;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 10px;
    outline: none;
    transition: border-color .2s;
}
.sby-fleet-search:focus { border-color: #e2231a; }
.sby-fleet-search::placeholder { color: #6a6f77; }
.sby-period {
    display: flex;
    gap: 4px;
    background: #141519;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 10px;
    padding: 4px;
}
.sby-period-btn {
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: #6a6f77;
    background: transparent;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.sby-period-btn:hover { color: #a6abb4; }
.sby-period-btn.active { color: #f5f6f8; background: #e2231a; }

/* Per-vehicle engagement row (panel only) */
.sby-fleet-engage {
    font-size: 12px;
    color: #a6abb4;
    margin-top: 6px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.sby-fleet-engage span { white-space: nowrap; }

/* Fleet list */
.sby-fleet-list { display: flex; flex-direction: column; gap: 12px; }

.sby-fleet-row { display: flex; flex-direction: column; gap: 6px; }

/* In-panel preview — verify hand/details without opening each vehicle */
.sby-fleet-details {
    background: #101116;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 12px;
    padding: 14px 16px;
    animation: sbyDetIn .18s ease;
}
@keyframes sbyDetIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.sby-det-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px 18px;
}
.sby-det-cell { display: flex; flex-direction: column; gap: 3px; }
.sby-det-cell .k { font-size: 11px; color: #6a6f77; }
.sby-det-cell .v { font-size: 14px; color: #f5f6f8; font-weight: 600; }
.sby-det-cell.hl { background: rgba(226,35,26,.10); border-radius: 8px; padding: 6px 10px; }
.sby-det-cell.hl .v { color: #ff5b52; }

.sby-fleet-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #141519;
    border-radius: 14px;
    padding: 16px;
    border: 1px solid rgba(255,255,255,.07);
    transition: border-color .2s;
}
.sby-fleet-item:hover { border-color: rgba(255,255,255,.15); }

.sby-fleet-thumb {
    width: 80px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #1a1c21;
}
.sby-fleet-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sby-fleet-thumb-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6a6f77;
    font-size: 11px;
}

.sby-fleet-info { flex: 1; min-width: 0; }
.sby-fleet-title {
    font-size: 16px;
    font-weight: 700;
    color: #f5f6f8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sby-fleet-meta {
    font-size: 13px;
    color: #6a6f77;
    margin-top: 4px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.sby-fleet-meta span { white-space: nowrap; }

.sby-fleet-price {
    text-align: left;
    flex-shrink: 0;
    min-width: 100px;
}
.sby-fleet-monthly {
    font-size: 18px;
    font-weight: 800;
    color: #e2231a;
}
.sby-fleet-full-price {
    font-size: 12px;
    color: #6a6f77;
}

.sby-fleet-status {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}
.sby-fleet-status.available { background: rgba(37,211,102,.13); color: #25d366; }
.sby-fleet-status.incoming { background: rgba(245,166,35,.13); color: #f5a623; }
.sby-fleet-status.sold { background: rgba(255,59,48,.13); color: #ff3b30; }
.sby-fleet-status.trash { background: rgba(255,255,255,.07); color: #6a6f77; }

.sby-fleet-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.sby-fleet-actions .sby-btn-sm { white-space: nowrap; }
.sby-act-edit { background: rgba(255,255,255,.07); color: #a6abb4; }
.sby-act-edit:hover { background: rgba(255,255,255,.13); color: #f5f6f8; }
.sby-act-sold { background: rgba(245,166,35,.13); color: #f5a623; }
.sby-act-sold:hover { background: rgba(245,166,35,.22); }
.sby-act-delete { background: rgba(255,59,48,.1); color: #ff3b30; }
.sby-act-delete:hover { background: rgba(255,59,48,.2); }
.sby-act-share { background: rgba(110,193,228,.12); color: #6ec1e4; }
.sby-act-share:hover { background: rgba(110,193,228,.22); }
.sby-act-fb { background: rgba(24,119,242,.15); color: #4a9eff; }
.sby-act-fb:hover { background: rgba(24,119,242,.28); }
.sby-act-fb.posted { background: rgba(37,211,102,.13); color: #25d366; }
.sby-act-fb:disabled { opacity: .6; cursor: default; }
.sby-act-restore { background: rgba(37,211,102,.13); color: #25d366; }
.sby-act-restore:hover { background: rgba(37,211,102,.22); }

/* Fleet empty */
.sby-fleet-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6a6f77;
}
.sby-fleet-empty h3 { color: #a6abb4; margin-bottom: 8px; }

/* (confirm dialog and spinner removed — unused) */

/* Hide WP theme chrome — hello-elementor + generic themes */
body:has(#sby-upload-root) #site-header,
body:has(#sby-upload-root) .site-header,
body:has(#sby-upload-root) #site-footer,
body:has(#sby-upload-root) .site-footer,
body:has(#sby-upload-root) .page-header,
body:has(#sby-upload-root) .entry-title,
body:has(#sby-upload-root) .entry-header,
body:has(#sby-upload-root) .page-title,
body:has(#sby-upload-root) .site-branding,
body:has(#sby-upload-root) #masthead,
body:has(#sby-upload-root) #colophon,
body:has(#sby-upload-root) .elementor-location-header,
body:has(#sby-upload-root) .elementor-location-footer,
body:has(#sby-upload-root) .wp-block-post-title,
body:has(#sby-upload-root) .dynamic-header,
body:has(#sby-upload-root) .dynamic-footer { display: none !important; }
body:has(#sby-upload-root) .page-content,
body:has(#sby-upload-root) #content,
body:has(#sby-upload-root) .site-main,
body:has(#sby-upload-root) .content-area,
body:has(#sby-upload-root) .site-content,
body:has(#sby-upload-root) .header-inner,
body:has(#sby-upload-root) .footer-inner { padding: 0 !important; margin: 0 !important; max-width: 100% !important; width: 100% !important; }
body:has(#sby-upload-root) { background: #0e0f12 !important; }

/* Mobile */
@media (max-width: 600px) {
    .sby-form-grid { grid-template-columns: 1fr; }
    .sby-plate-row { flex-direction: column; }
    .sby-form-section { padding: 20px 16px; }
    .sby-form-wrap h1 { font-size: 24px; }
    .sby-fleet-item { flex-wrap: wrap; }
    .sby-fleet-thumb { width: 60px; height: 45px; }
    .sby-fleet-actions { width: 100%; justify-content: flex-end; }
    .sby-fleet-price { min-width: auto; }
    .sby-tabs { flex-direction: column; }
    .sby-fleet-filters { overflow-x: auto; flex-wrap: nowrap; }
    .sby-form-actions { flex-direction: column; }
}

/* ── Test-expiry alert (dealer fleet panel only) ── */
.sby-test-alert {
  display: inline-block;
  margin-inline-start: 8px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
  white-space: nowrap;
}
.sby-test-alert.expired { background: rgba(255,59,48,.15); color: #ff3b30; }
.sby-test-alert.soon { background: rgba(255,159,10,.15); color: #ff9f0a; }

/* ── "Go to existing vehicle" button on duplicate plate ── */
.sby-goto-existing { margin-inline-start: 10px; cursor: pointer; }

/* ── Ad Generator modal (admin-only) ── */
#sby-adg-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,.75);
    align-items: flex-start;
    justify-content: center;
    padding: 24px 12px;
    overflow-y: auto;
    direction: rtl;
    font-family: 'Heebo', system-ui, sans-serif;
}
.adg-panel {
    background: #101114;
    border: 1px solid #2a2c33;
    border-radius: 18px;
    width: 100%;
    max-width: 1320px;
    color: #f5f6f8;
    box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.adg-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #2a2c33;
}
.adg-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.adg-close {
    background: #1c1e24;
    border: 1px solid #33363f;
    color: #f5f6f8;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.adg-close:hover { background: #e2231a; border-color: #e2231a; }
.adg-body {
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: 18px;
    padding: 20px 24px 24px;
    align-items: start;
}
.adg-controls label {
    display: block;
    margin: 10px 0 4px;
    font-weight: 700;
    font-size: 13px;
    color: #c9cdd6;
}
.adg-controls input {
    width: 100%;
    background: #0a0b0d;
    color: #fff;
    border: 1px solid #33363f;
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}
.adg-controls input[type="range"] { padding: 0; accent-color: #e2231a; }
.adg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.adg-btn { width: 100%; margin-top: 12px; }
.adg-btn-fb { background: #1877f2; }
.adg-btn-fb:hover { background: #0f5fd0; }
.adg-note { font-size: 12px; color: #8b8f99; line-height: 1.5; margin-top: 12px; }
.adg-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.adg-item {
    background: #0a0b0d;
    border: 1px solid #2a2c33;
    border-radius: 14px;
    padding: 8px;
}
.adg-item canvas { width: 100%; display: block; border-radius: 10px; background: #111; }
a.adg-dl {
    display: block;
    margin-top: 8px;
    padding: 10px;
    background: #1c1e24;
    color: #fff;
    text-align: center;
    text-decoration: none;
    border-radius: 9px;
    font-weight: 700;
    font-size: 14px;
}
a.adg-dl:hover { background: #e2231a; }
.sby-act-ads { background: #3b2a6e; }
@media (max-width: 900px) {
    .adg-body { grid-template-columns: 1fr; }
}
