/* =====================================================================
   WABY Visits — Admin Dashboard Stylesheet
   Modern SaaS design · Indigo accent · CSS-only
   ===================================================================== */

/* ----- Design tokens (as values, not custom properties for WP compat) -----
   Primary:       #6366f1  (indigo-500)
   Primary hover: #4f46e5  (indigo-600)
   Primary light: #eef2ff  (indigo-50)
   Primary ring:  rgba(99,102,241,.15)
   Text:          #0f172a  (slate-900)
   Text secondary:#64748b  (slate-500)
   Text muted:    #94a3b8  (slate-400)
   Border:        #e2e8f0  (slate-200)
   Border light:  #f1f5f9  (slate-100)
   Surface:       #ffffff
   Background:    #f8fafc  (slate-50)
   Success:       #059669 / #ecfdf5
   Warning:       #d97706 / #fffbeb
   Danger:        #dc2626 / #fef2f2
   --------------------------------------------------------------------- */

/* ==========================  PAGE WRAPPER  ============================ */
.wrap > h1:first-child {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -.01em;
  padding-bottom: 16px;
  margin-bottom: 0;
  border-bottom: 1px solid #e2e8f0;
}

/* ==========================  TAB NAVIGATION  ========================= */
.yeb-tabs {
  margin: 0;
  padding: 12px 0 0;
  border-bottom: none;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: transparent;
}
.yeb-tabs a {
  padding: 7px 16px 8px;
  display: inline-block;
  text-decoration: none;
  border: none;
  border-radius: 8px;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.yeb-tabs a:hover {
  background: #f1f5f9;
  color: #334155;
}
.yeb-tabs a.active {
  background: #6366f1;
  color: #fff;
  font-weight: 600;
  border: none;
  box-shadow: 0 1px 3px rgba(99,102,241,.3);
}

/* ==========================  DATE PRESETS  ============================ */
.yeb-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.yeb-preset {
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 5px 14px !important;
  border-radius: 20px !important;
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
  cursor: pointer;
  transition: all .15s ease !important;
  line-height: 1.4 !important;
}
.yeb-preset:hover {
  background: #e2e8f0 !important;
  color: #1e293b !important;
}
.yeb-preset.active {
  background: #6366f1 !important;
  color: #fff !important;
  border-color: #6366f1 !important;
  box-shadow: 0 1px 3px rgba(99,102,241,.3) !important;
}

/* ==========================  FILTER PANEL  ============================ */
.yeb-filters {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
/* --- Filter sidebar + panels layout --- */
.yeb-filter-sections {
  display: flex;
  gap: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.yeb-filter-nav {
  display: flex;
  flex-direction: column;
  min-width: 160px;
  border-right: 1px solid #e2e8f0;
  background: #f8fafc;
  flex-shrink: 0;
}
.yeb-filter-tab {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  border-left: 3px solid transparent;
  outline: none;
}
.yeb-filter-tab:hover {
  background: #f1f5f9;
  color: #334155;
}
.yeb-filter-tab.active {
  background: #fff;
  color: #6366f1;
  font-weight: 600;
  border-left-color: #6366f1;
}
.yeb-filter-panels {
  flex: 1;
  min-width: 0;
  padding: 16px 20px;
}
.yeb-filter-panel {
  display: none;
}
.yeb-filter-panel.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.yeb-filter-panel .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  font-size: 13px;
  color: #475569;
}
/* --- Filter labels --- */
.yeb-flabel {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
  letter-spacing: .01em;
}
.yeb-fcb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .yeb-filter-sections {
    flex-direction: column;
  }
  .yeb-filter-nav {
    flex-direction: row;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
  }
  .yeb-filter-tab {
    white-space: nowrap;
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 8px 14px;
  }
  .yeb-filter-tab.active {
    border-bottom-color: #6366f1;
    border-left-color: transparent;
  }
}

/* --- Filter inputs --- */
.yeb-filter-panel input[type=text],
.yeb-filter-panel input[type=number],
.yeb-filter-panel input[type=date],
.yeb-filter-panel select {
  min-width: 130px;
  height: 34px;
  padding: 4px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #1e293b;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
  box-sizing: border-box;
}
.yeb-filter-panel input:focus,
.yeb-filter-panel select:focus {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  outline: none;
}

/* --- Compare range label --- */
.yeb-comp-range {
  color: #6366f1;
  font-weight: 500;
  margin-left: 4px;
  font-size: 12px;
}

/* --- Actions row --- */
.yeb-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}
.yeb-actions .button-primary,
.yeb-filters .button-primary {
  background: #6366f1 !important;
  border-color: #4f46e5 !important;
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(99,102,241,.2) !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  padding: 6px 20px !important;
  transition: background .15s ease !important;
}
.yeb-actions .button-primary:hover,
.yeb-filters .button-primary:hover {
  background: #4f46e5 !important;
}
.yeb-actions .button {
  border-radius: 8px !important;
}

/* ==========================  KPI CARDS  ============================== */
.yeb-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 20px 0;
}
@media (max-width: 1200px) {
  .yeb-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .yeb-cards { grid-template-columns: 1fr; }
}
.yeb-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
  position: relative;
  overflow: hidden;
}
.yeb-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #818cf8);
  opacity: 0;
  transition: opacity .2s ease;
}
.yeb-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 4px 12px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05);
  transform: translateY(-1px);
}
.yeb-card:hover::before {
  opacity: 1;
}
.yeb-card h4 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.yeb-card .val {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  letter-spacing: -.02em;
}

/* ==========================  DELTA INDICATORS  ======================= */
.yeb-delta {
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px 2px 4px;
  border-radius: 6px;
  line-height: 1;
}
.yeb-delta .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  line-height: 14px;
}
.yeb-delta-up {
  color: #059669;
  background: #ecfdf5;
}
.yeb-delta-down {
  color: #dc2626;
  background: #fef2f2;
}
.yeb-delta-flat {
  color: #64748b;
  background: #f1f5f9;
}
/* Inline delta (inside table cells) */
.yeb-delta-i {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.4;
}
.yeb-delta-i.yeb-delta-up   { color: #059669; background: #ecfdf5; }
.yeb-delta-i.yeb-delta-down { color: #dc2626; background: #fef2f2; }
.yeb-delta-i.yeb-delta-flat { color: #64748b; background: #f1f5f9; }

/* ==========================  TABLE GRID LAYOUTS  ===================== */
.yeb-table-grid {
  display: grid;
  gap: 20px;
}
.yeb-table-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}
.yeb-table-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.yeb-table-wrap {
  min-width: 0;
}
.yeb-table-wrap h3 {
  margin-top: 12px;
}
@media (max-width: 1200px) {
  .yeb-table-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .yeb-table-grid.cols-2,
  .yeb-table-grid.cols-3 { grid-template-columns: 1fr; }
}

/* ==========================  DATA TABLES  ============================ */
.wrap h3 {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 24px 0 10px;
  padding: 0;
}
.wrap table.widefat {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  border-spacing: 0;
  border-collapse: separate;
  width: 100%;
}
.wrap table.widefat thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.wrap table.widefat tbody td {
  padding: 10px 14px;
  font-size: 13px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.wrap table.widefat tbody tr:last-child td {
  border-bottom: none;
}
.wrap table.widefat.striped tbody tr:nth-child(even) {
  background: transparent;
}
.wrap table.widefat tbody tr:hover td {
  background: #eef2ff;
}

/* --- Percentage text in tables --- */
.yeb-pct {
  color: #94a3b8;
  font-size: .85em;
  font-weight: 400;
}

/* --- Table responsive scroll --- */
@media (max-width: 768px) {
  .wrap table.widefat {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ==========================  INTERACTIONS  ============================ */
.yeb-interactions table.widefat .toggle {
  cursor: pointer;
  color: #94a3b8;
  transition: color .15s ease;
}
.yeb-interactions table.widefat .toggle:hover {
  color: #6366f1;
}
.yeb-interactions .sess-details {
  display: none;
  background: #fff;
}
.yeb-interactions .sess-details .inner {
  padding: 12px 16px;
  border-left: 3px solid #6366f1;
  margin: 0 8px 8px;
  border-radius: 0 8px 8px 0;
  background: #fafbff;
}

/* ==========================  BADGES  ================================= */
.yeb-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  white-space: nowrap;
}
.yeb-badge.ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.yeb-badge.warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
.yeb-badge.err {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* ==========================  URL LINKS  =============================== */
.yeb-link-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  word-break: break-all;
}
.yeb-link-icon.dashicons {
  font-size: 14px;
  line-height: 14px;
  width: 14px;
  height: 14px;
  text-decoration: none;
  color: #a5b4fc;
  transition: color .15s ease;
}
.yeb-link-icon.dashicons:hover {
  color: #6366f1;
}

/* ==========================  SCREEN POPOVER  ========================== */
.yeb-float {
  position: relative;
  display: inline-block;
}
.yeb-pop {
  position: absolute;
  z-index: 999;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.1), 0 2px 8px rgba(0,0,0,.04);
  min-width: 280px;
  top: 38px;
  right: 0;
  display: none;
}
.yeb-pop .row {
  display: flex;
  gap: 6px;
  margin: 6px 0;
  align-items: center;
}
