/* ============================================================
   Drive Klean — Admin Dashboard Layout Styles (v8 Redesign)
   Sidebar layout with dark theme, stat cards with colored borders,
   Chart.js integration, full-width data tables.
   ============================================================ */

/* ============ SIDEBAR ============ */
.dk-dash-page {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.dk-sidebar {
  width: 260px;
  min-width: 260px;
  background: #1e293b;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.dk-sidebar.collapsed {
  transform: translateX(-260px);
}

.dk-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.dk-sidebar-brand img { height: 30px; }

.dk-sidebar-title {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: 17px;
  color: #fff;
}

.dk-sidebar-nav {
  flex: 1;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dk-sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.6);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.dk-sidebar-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}

.dk-sidebar-item.active {
  color: #fff;
  background: rgba(59,130,246,0.12);
  border-left-color: #3b82f6;
}

.dk-sidebar-item i {
  width: 20px;
  text-align: center;
  font-size: 14px;
}

.dk-sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ============ MAIN CONTENT ============ */
.dk-main {
  flex: 1;
  min-width: 0;
  margin-left: 260px;
  background: #f8fafc;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.dk-main.expanded {
  margin-left: 0;
}

/* ============ HEADER ============ */
.dk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
  flex-wrap: wrap;
}

.dk-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dk-header-left h3 {
  font-family: var(--ff-display);
  font-size: 20px;
  color: #1e293b;
  margin: 0;
}

.dk-sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid #e2e8f0;
  color: #64748b;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.2s;
}

.dk-sidebar-toggle:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.dk-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dk-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 14px;
  transition: 0.2s;
}

.dk-search-box:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.dk-search-box i { color: #94a3b8; font-size: 13px; }

.dk-search-box input {
  background: none;
  border: none;
  color: #1e293b;
  font-size: 13px;
  font-family: var(--ff-body);
  outline: none;
  width: 180px;
}

.dk-search-box input::placeholder { color: #94a3b8; }

.dk-header-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: 0.2s;
}

.dk-header-profile:hover { background: #f1f5f9; }

.dk-header-profile span {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

.dk-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
}

/* ============ PAGES ============ */
.dk-page {
  padding: 24px 28px;
  animation: dkFadeIn 0.25s ease;
}

@keyframes dkFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ============ STAT CARDS ============ */
.dk-stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.dk-stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  border-left: 4px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s;
}

.dk-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.dk-stat-card.dk-stat-blue   { border-left-color: #3b82f6; }
.dk-stat-card.dk-stat-green  { border-left-color: #22c55e; }
.dk-stat-card.dk-stat-orange { border-left-color: #f97316; }
.dk-stat-card.dk-stat-red    { border-left-color: #ef4444; }
.dk-stat-card.dk-stat-purple { border-left-color: #8b5cf6; }

.dk-stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.dk-stat-blue .dk-stat-icon   { background: rgba(59,130,246,0.1); color: #3b82f6; }
.dk-stat-green .dk-stat-icon  { background: rgba(34,197,94,0.1); color: #22c55e; }
.dk-stat-orange .dk-stat-icon { background: rgba(249,115,22,0.1); color: #f97316; }
.dk-stat-red .dk-stat-icon    { background: rgba(239,68,68,0.1); color: #ef4444; }
.dk-stat-purple .dk-stat-icon { background: rgba(139,92,246,0.1); color: #8b5cf6; }

.dk-stat-info { flex: 1; }

.dk-stat-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}

.dk-stat-value {
  display: block;
  font-family: var(--ff-display);
  font-size: 24px;
  color: #1e293b;
  line-height: 1.2;
}

.dk-stat-trend {
  font-size: 11px;
  color: #94a3b8;
}

.dk-stat-trend.trend-up { color: #22c55e; }
.dk-stat-trend.trend-down { color: #ef4444; }

/* ============ CHARTS ROW ============ */
.dk-charts-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  margin-bottom: 24px;
}

.dk-chart-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.dk-chart-card h4 {
  font-family: var(--ff-display);
  font-size: 15px;
  color: #1e293b;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dk-chart-card h4 i { color: #3b82f6; }

.dk-chart-card canvas {
  max-height: 280px;
}

/* ============ TABLE CARD ============ */
.dk-table-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

.dk-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.dk-table-header h4 {
  font-family: var(--ff-display);
  font-size: 15px;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dk-table-header h4 i { color: #3b82f6; }

.dk-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dk-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dk-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.dk-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: top;
  white-space: nowrap;
}

.dk-table tr:hover td {
  background: #f8fafc;
}

.dk-table .dk-cell-truncate {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ STATUS PILLS (light theme) ============ */
.dk-status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.dk-status-PENDING, .dk-status-ASSIGNED { background: #fef3c7; color: #d97706; }
.dk-status-CONFIRMED, .dk-status-IN_PROGRESS { background: #dbeafe; color: #2563eb; }
.dk-status-COMPLETED { background: #dcfce7; color: #16a34a; }
.dk-status-CANCELLED, .dk-status-PARTIALLY_CANCELLED { background: #fee2e2; color: #dc2626; }
.dk-status-ACTIVE { background: #dcfce7; color: #16a34a; }
.dk-status-SUSPENDED { background: #fef3c7; color: #d97706; }
.dk-status-TERMINATED { background: #fee2e2; color: #dc2626; }

/* ============ ACTION BUTTONS ============ */
.dk-action-btn {
  background: none;
  border: 1px solid #e2e8f0;
  color: #64748b;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}

.dk-action-btn:hover { background: #f1f5f9; color: #1e293b; }
.dk-action-btn.dk-action-view:hover { background: #dbeafe; color: #2563eb; border-color: #bfdbfe; }
.dk-action-btn.dk-action-edit:hover { background: #fef3c7; color: #d97706; border-color: #fde68a; }
.dk-action-btn.dk-action-complete:hover { background: #dcfce7; color: #16a34a; border-color: #bbf7d0; }
.dk-action-btn.dk-action-cancel:hover { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.dk-action-btn.dk-action-delete:hover { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.dk-action-btn.dk-action-suspend:hover { background: #fef3c7; color: #d97706; border-color: #fde68a; }
.dk-action-btn.dk-action-activate:hover { background: #dcfce7; color: #16a34a; border-color: #bbf7d0; }

/* ============ FILTERS BAR ============ */
.dk-filters-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  background: #fff;
  padding: 14px 18px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.dk-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dk-filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}

.dk-input, .dk-select {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--ff-body);
  color: #1e293b;
  background: #fff;
  transition: 0.2s;
}

.dk-input:focus, .dk-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.dk-filter-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* Override dark theme buttons for light content */
.dk-page .btn-primary {
  background: #3b82f6;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}

.dk-page .btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59,130,246,0.4);
  color: #fff;
}

.dk-page .btn-ghost {
  border-color: #e2e8f0;
  color: #64748b;
}

.dk-page .btn-ghost:hover {
  border-color: #94a3b8;
  color: #1e293b;
  background: #f8fafc;
}

/* ============ PAGINATION ============ */
.dk-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 0 4px;
}

.dk-pagination button {
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #64748b;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
}

.dk-pagination button:hover:not(:disabled) {
  background: #f1f5f9;
  color: #1e293b;
}

.dk-pagination button.active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}

.dk-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dk-pagination .dk-page-info {
  font-size: 12px;
  color: #94a3b8;
  padding: 0 8px;
}

/* ============ FORM CARD ============ */
.dk-form-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.dk-form-card h4 {
  font-family: var(--ff-display);
  font-size: 15px;
  color: #1e293b;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dk-form-card h4 i { color: #3b82f6; }

.dk-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dk-form-grid input,
.dk-form-grid select,
.dk-form-grid textarea {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--ff-body);
  color: #1e293b;
  background: #f8fafc;
  transition: 0.2s;
}

.dk-form-grid input:focus,
.dk-form-grid select:focus,
.dk-form-grid textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ============ DATA GRID (cards for franchise, stores, etc.) ============ */
.dk-data-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dk-data-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  transition: 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.dk-data-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.dk-data-info { flex: 1; }

.dk-data-info b {
  display: block;
  font-size: 14px;
  color: #1e293b;
}

.dk-data-info span {
  font-size: 12.5px;
  color: #64748b;
  display: block;
  margin-top: 2px;
}

.dk-data-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============ GALLERY GRID ============ */
.dk-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.dk-gallery-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4/3;
  border: 1px solid #e2e8f0;
}

.dk-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dk-gallery-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(239,68,68,0.9);
  border: none;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
}

.dk-gallery-remove:hover {
  background: rgba(220,38,38,1);
  transform: scale(1.1);
}

/* ============ EMPTY STATE ============ */
.dk-empty-state {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  padding: 40px 16px;
  background: #f8fafc;
  border: 1px dashed #e2e8f0;
  border-radius: 12px;
}

.dk-empty-state i { font-size: 32px; margin-bottom: 10px; display: block; color: #cbd5e1; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
  .dk-stat-cards { grid-template-columns: repeat(2, 1fr); }
  .dk-charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .dk-sidebar { transform: translateX(-260px); }
  .dk-sidebar.open { transform: translateX(0); }
  .dk-main { margin-left: 0; }
  .dk-sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .dk-stat-cards { grid-template-columns: 1fr; }
  .dk-form-grid { grid-template-columns: 1fr; }
  .dk-gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .dk-filters-bar { flex-direction: column; align-items: stretch; }
  .dk-filter-actions { margin-left: 0; }
  .dk-search-box input { width: 120px; }
  .dk-header { padding: 12px 16px; }
  .dk-page { padding: 16px; }
}

@media (max-width: 480px) {
  .dk-gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .dk-header-right { gap: 8px; }
  .dk-search-box { display: none; }
}
