/* ==========================================================================
   Admin Unscratched Cards Screen Styles
   Pixel-accurate parity with Super Admin Portal design
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --navy: #0f172a;
  --sidebar-bg: #101b3b;
  --sidebar-hover: #1e2c56;
  --purple: #7c3aed;
  --purple-light: #6366f1;
  --purple-gradient: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --blue-border: #bfdbfe;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --green-pill: #dcfce7;
  --orange: #ea580c;
  --orange-light: #fff7ed;
  --orange-pill: #ffedd5;
  --pink: #db2777;
  --pink-light: #fdf2f8;
  --bg-page: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-sub: #475569;
  --text-muted: #64748b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 13px;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  width: 255px;
  background: #172554;
  color: #fff;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  padding: 22px 15px;
  overflow: auto;
}

.sidebar .brand {
  font-size: 19px;
  font-weight: 900;
  line-height: 1.2;
  padding: 8px 10px 22px;
  border-bottom: 1px solid #33447a;
}

.sidebar .brand span {
  display: block;
  color: #67e8f9;
  font-size: 11px;
  margin-top: 6px;
  letter-spacing: 1px;
}

.sidebar .nav-title {
  font-size: 10px;
  font-weight: 800;
  color: #93a4d1;
  margin: 20px 10px 8px;
  letter-spacing: 1.2px;
}

.sidebar .nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  margin: 3px 0;
  border-radius: 9px;
  color: #dbe5ff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
}

.sidebar .nav a:hover {
  background: #263a7a;
  color: #fff;
}

.sidebar .nav a.active {
  background: #7c3aed;
  color: #fff;
}

.sidebar .icon {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #33447a;
  font-size: 13px;
  font-style: normal;
}

.sidebar .nav a.active .icon { background: #5b21b6; }

/* ==========================================================================
   MAIN CONTENT & TOPBAR
   ========================================================================== */
.main {
  margin-left: 255px;
  width: calc(100% - 255px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-search-wrap {
  position: relative;
  width: 440px;
}

.topbar-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #94a3b8;
}

.topbar .search-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 9px 14px 9px 38px;
  font-size: 12.5px;
  outline: none;
  background: #fdfdfd;
  color: var(--text-main);
  transition: all 0.2s;
}

.topbar .search-input:focus {
  border-color: var(--purple-light);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.notif-bell-btn {
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.15s;
}

.notif-bell-btn:hover {
  background: #f1f5f9;
}

.notif-bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}

.admin-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-profile-info {
  text-align: right;
  line-height: 1.25;
}

.admin-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
}

.admin-role {
  font-size: 11px;
  color: #64748b;
}

.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--purple);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #fecaca;
  color: #ef4444;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-logout-btn:hover {
  background: #fee2e2;
  border-color: #f87171;
}

/* ==========================================================================
   PAGE CONTENT
   ========================================================================== */
.content-area {
  padding: 24px 32px 60px;
  flex: 1;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-head-titles h1 {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
}

.page-head-titles p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: var(--blue);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: all 0.15s ease;
}

.export-btn:hover {
  background: var(--blue-light);
  border-color: #93c5fd;
}

/* ==========================================================================
   TOP 4 KPI CARDS
   ========================================================================== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.kpi-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.kpi-box.kpi-blue::before { background: var(--blue); }
.kpi-box.kpi-green::before { background: var(--green); }
.kpi-box.kpi-orange::before { background: var(--orange); }
.kpi-box.kpi-pink::before { background: var(--pink); }

.kpi-bubble {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-box.kpi-blue .kpi-bubble { background: #eff6ff; color: #2563eb; }
.kpi-box.kpi-green .kpi-bubble { background: #f0fdf4; color: #16a34a; }
.kpi-box.kpi-orange .kpi-bubble { background: #fff7ed; color: #ea580c; }
.kpi-box.kpi-pink .kpi-bubble { background: #fdf2f8; color: #db2777; }

.kpi-bubble svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

.kpi-details {
  flex: 1;
}

.kpi-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #334155;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 4px;
}

.kpi-box.kpi-blue .kpi-value { color: #2563eb; }
.kpi-box.kpi-green .kpi-value { color: #16a34a; }
.kpi-box.kpi-orange .kpi-value { color: #ea580c; }
.kpi-box.kpi-pink .kpi-value { color: #db2777; }

.kpi-caption {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   FILTER CARD
   ========================================================================== */
.filter-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.filter-row-1 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 14px;
}

.filter-row-2 {
  display: grid;
  grid-template-columns: 1.3fr 1.3fr 1fr 1fr auto auto;
  gap: 14px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

.input-with-icon {
  position: relative;
}

.input-icon-svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: #94a3b8;
}

.input-with-icon input {
  width: 100%;
  padding-left: 34px !important;
}

.filter-card input,
.filter-card select {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-main);
  background: #ffffff;
  outline: none;
  transition: all 0.15s ease;
  width: 100%;
  height: 38px;
}

.filter-card input:focus,
.filter-card select:focus {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.date-range-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-range-box input[type="date"] {
  padding: 7px 8px;
  font-size: 11px;
}

.date-sep {
  color: #94a3b8;
  font-weight: 600;
}

.btn-apply {
  background: #6366f1;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  height: 38px;
  padding: 0 24px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-apply:hover {
  background: #4f46e5;
}

.btn-reset {
  background: #ffffff;
  color: #475569;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  height: 38px;
  padding: 0 20px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-reset:hover {
  background: #f1f5f9;
  border-color: #9ca3af;
}

/* ==========================================================================
   TABLE CARD
   ========================================================================== */
.table-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  overflow: hidden;
}

.table-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-color);
}

.table-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.table-controls-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.entries-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-sub);
}

.entries-wrap select {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  outline: none;
  background: #fff;
  cursor: pointer;
}

.pagination-mini {
  display: flex;
  gap: 4px;
}

.pagination-mini button {
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: #334155;
  border-radius: 6px;
  min-width: 28px;
  height: 28px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.pagination-mini button:hover:not(:disabled) {
  background: #f1f5f9;
}

.pagination-mini button.active {
  background: #6366f1;
  color: #ffffff;
  border-color: #6366f1;
}

.pagination-mini button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ==========================================================================
   DATA TABLE
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.unscratched-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
}

.unscratched-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.unscratched-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

.unscratched-table tbody tr:hover td {
  background: #fafbfd;
}

.td-index {
  color: #64748b;
  font-weight: 600;
}

.td-business {
  font-weight: 700;
  color: #0f172a;
}

.td-owner {
  color: #334155;
  font-weight: 500;
}

.td-mobile {
  color: #475569;
  font-family: monospace, inherit;
  font-size: 12px;
}

.cards-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  font-weight: 800;
  font-size: 12px;
}

.date-text {
  color: #475569;
  font-weight: 500;
  white-space: nowrap;
}

/* Days Left Pill */
.days-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.days-pill.days-green {
  background: #dcfce7;
  color: #16a34a;
}

.days-pill.days-orange {
  background: #ffedd5;
  color: #ea580c;
}

.days-pill.days-red {
  background: #fee2e2;
  color: #dc2626;
}

/* Actions */
.actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-table-view {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #bfdbfe;
  background: #ffffff;
  color: #2563eb;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-table-view:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.btn-table-view svg {
  width: 14px;
  height: 14px;
}

.btn-table-more {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  border-radius: 6px;
  width: 28px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.15s;
}

.btn-table-more:hover {
  background: #f8fafc;
  color: #0f172a;
}

/* Table Footer */
.table-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay.open {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: min(650px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}

.modal-close-btn {
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 14px;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.modal-close-btn:hover {
  background: #e2e8f0;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.modal-info-item {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 14px;
}

.modal-info-item label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.modal-info-item strong {
  font-size: 13px;
  color: var(--text-main);
}

.modal-codes-section {
  border-top: 1px solid var(--border-color);
  padding-top: 18px;
}

.modal-codes-section h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #0f172a;
}

.modal-codes-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-code-pill {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .filter-row-1 { grid-template-columns: 1fr; }
  .filter-row-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 850px) {
  .sidebar { width: 72px; padding: 22px 15px; }
  .sidebar .brand,
  .sidebar .nav-title,
  .sidebar .nav a span { display: none; }
  .sidebar .nav a { justify-content: center; }
  .main { margin-left: 72px; width: calc(100% - 72px); }
  .topbar-search-wrap { width: 260px; }
}

@media (max-width: 600px) {
  .content-area { padding: 16px; }
  .kpi-row { grid-template-columns: 1fr; }
  .filter-row-2 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .admin-profile-info { display: none; }
}
