/* ═══════════════════════════════════════════════════════════════════
   SahaShift Web Panel — Dashboard CSS
   Surukle-birak grid layout, widget stilleri, edit mode, grafikler
   ═══════════════════════════════════════════════════════════════════ */

/* ── EDIT DIVIDER ──────────────────────────────────────────────── */
.dash-edit-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color, #E2E8F0);
  margin: 0 4px;
}

/* ── EDIT TOOLBAR ──────────────────────────────────────────────── */
.dash-edit-toolbar {
  margin-bottom: 16px;
  animation: dashSlideDown 0.2s ease-out;
}

.dash-edit-toolbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card-bg, #FFF);
  border: 2px dashed var(--primary, #3B82F6);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

@keyframes dashSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.btn-success {
  background: #10B981;
  color: white;
  border: none;
}
.btn-success:hover {
  background: #059669;
}

/* ── GRID CONTAINER ────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(6, 80px);
  gap: 12px;
  min-height: 400px;
  transition: min-height 0.3s ease;
}

.dash-grid--editing {
  background-image:
    repeating-linear-gradient(
      90deg,
      var(--grid-line, rgba(59,130,246,0.05)) 0px,
      var(--grid-line, rgba(59,130,246,0.05)) 1px,
      transparent 1px,
      transparent calc(100% / 12)
    ),
    repeating-linear-gradient(
      0deg,
      var(--grid-line, rgba(59,130,246,0.05)) 0px,
      var(--grid-line, rgba(59,130,246,0.05)) 1px,
      transparent 1px,
      transparent 80px
    );
  border-radius: 12px;
  padding: 4px;
}

/* ── WIDGET BASE ───────────────────────────────────────────────── */
.dash-widget {
  position: relative;
  background: var(--card-bg, #FFF);
  border-radius: 16px;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.06));
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
}

.dash-widget:hover {
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08));
}

/* ── WIDGET EDITING STATE ──────────────────────────────────────── */
.dash-widget--editing {
  border: 2px dashed var(--primary, #3B82F6);
  cursor: default;
}

.dash-widget--editing:hover {
  border-color: var(--primary, #3B82F6);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.dash-widget-placeholder {
  opacity: 0.3;
  border: 2px dashed var(--primary, #3B82F6);
  background: var(--primary-light, rgba(59,130,246,0.04));
}

.dash-widget-resizing {
  opacity: 0.85;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

/* ── WIDGET GHOST (surukleme sirasinda) ────────────────────────── */
.dash-widget-ghost {
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  border: 2px solid var(--primary, #3B82F6);
  background: var(--card-bg, #FFF);
}

/* ── WIDGET CONTROLS (edit mode) ───────────────────────────────── */
.dash-widget-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 2px;
  gap: 4px;
}

.dash-widget-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  cursor: grab;
  border-radius: 6px;
  color: var(--text-secondary, #94A3B8);
  transition: background 0.15s, color 0.15s;
}

.dash-widget-drag-handle:hover {
  background: var(--hover-bg, rgba(0,0,0,0.04));
  color: var(--primary, #3B82F6);
}

.dash-widget-drag-handle:active {
  cursor: grabbing;
}

.dash-widget-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #94A3B8);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.dash-widget-delete:hover {
  background: rgba(239,68,68,0.1);
  color: #EF4444;
}

/* ── WIDGET RESIZE HANDLE ──────────────────────────────────────── */
.dash-widget-resize-handle {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: se-resize;
  border-radius: 6px;
  color: var(--text-secondary, #94A3B8);
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.dash-widget--editing:hover .dash-widget-resize-handle {
  opacity: 1;
}

.dash-widget-resize-handle:hover {
  background: var(--hover-bg, rgba(0,0,0,0.04));
  color: var(--primary, #3B82F6);
}

/* ── WIDGET BODY ───────────────────────────────────────────────── */
.dash-widget-body {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.dash-widget--editing .dash-widget-body {
  padding: 8px 12px 12px;
}

.dash-widget-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
}

.dash-widget-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary, #94A3B8);
  font-size: 13px;
  min-height: 60px;
}

/* ═══════════════════════════════════════════════════════════════
   STAT WIDGET LAYOUT
   ═══════════════════════════════════════════════════════════════ */
.dash-stat-widget {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  justify-content: center;
}

.dash-stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.dash-stat-icon .material-icons-round {
  font-size: 22px;
}

.dash-stat-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary, #1E293B);
  line-height: 1.1;
}

.dash-stat-of {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-secondary, #94A3B8);
  margin-left: 4px;
}

.dash-stat-label {
  font-size: 13px;
  color: var(--text-secondary, #64748B);
  font-weight: 500;
}

/* Progress bar */
.dash-stat-bar-track {
  height: 6px;
  background: var(--border-color, #E2E8F0);
  border-radius: 3px;
  overflow: hidden;
}

.dash-stat-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease-out;
}

.dash-stat-footer {
  font-size: 12px;
  color: var(--text-secondary, #94A3B8);
}

/* Meta */
.dash-stat-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary, #94A3B8);
  margin-top: 4px;
}

/* Breakdown */
.dash-stat-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color, #E2E8F0);
}

.dash-stat-breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary, #64748B);
}

.dash-stat-breakdown-row span:last-child {
  font-weight: 600;
  color: var(--text-primary, #1E293B);
}

/* ═══════════════════════════════════════════════════════════════
   CHART WIDGET LAYOUT
   ═══════════════════════════════════════════════════════════════ */
.dash-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dash-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #1E293B);
}

.dash-chart-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}

.dash-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ═══════════════════════════════════════════════════════════════
   WIDGET MODAL
   ═══════════════════════════════════════════════════════════════ */
.dash-widget-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-widget-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
}

.dash-widget-modal-content {
  position: relative;
  background: var(--card-bg, #FFF);
  border-radius: 16px;
  width: 440px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: dashModalIn 0.2s ease-out;
}

@keyframes dashModalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.dash-widget-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
}

.dash-widget-modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary, #1E293B);
}

.dash-widget-modal-body {
  padding: 8px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── CATALOG ITEM ──────────────────────────────────────────────── */
.dash-catalog-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  cursor: default;
}

.dash-catalog-item:hover {
  border-color: var(--primary, #3B82F6);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.06);
  background: var(--hover-bg, rgba(59,130,246,0.02));
}

.dash-catalog-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--primary-light, rgba(59,130,246,0.08));
  border-radius: 10px;
  color: var(--primary, #3B82F6);
  flex-shrink: 0;
}

.dash-catalog-icon .material-icons-round {
  font-size: 22px;
}

.dash-catalog-info {
  flex: 1;
}

.dash-catalog-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #1E293B);
}

.dash-catalog-size {
  font-size: 12px;
  color: var(--text-secondary, #94A3B8);
  margin-top: 1px;
}

.dash-catalog-add-btn {
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE OVERRIDES
   ═══════════════════════════════════════════════════════════════ */
body.dark-mode .dash-edit-toolbar-inner {
  background: var(--card-bg);
  border-color: rgba(59,130,246,0.3);
}

body.dark-mode .dash-grid--editing {
  --grid-line: rgba(59,130,246,0.08);
}

body.dark-mode .dash-widget {
  background: var(--card-bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

body.dark-mode .dash-widget:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

body.dark-mode .dash-stat-value {
  color: var(--text-primary);
}

body.dark-mode .dash-stat-breakdown-row span:last-child {
  color: var(--text-primary);
}

body.dark-mode .dash-widget-modal-content {
  background: var(--card-bg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

body.dark-mode .dash-widget-modal-backdrop {
  background: rgba(0,0,0,0.6);
}

body.dark-mode .dash-catalog-item {
  border-color: var(--border-color);
}

body.dark-mode .dash-catalog-item:hover {
  border-color: var(--primary);
  background: rgba(59,130,246,0.06);
}

body.dark-mode .dash-widget-ghost {
  background: var(--card-bg);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .dash-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 768px) {
  .dash-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .dash-widget-modal-content {
    width: 95vw;
  }

  .dash-edit-toolbar-inner {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
    gap: 8px;
  }

  .dash-stat-value {
    font-size: 22px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   WIDGET: Santiye Durumu + Son Hareketler (Liste Widget'lari)
   ═══════════════════════════════════════════════════════════════════ */

.dash-list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 8px;
}

.dash-list-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #1E293B);
}

.dash-list-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 12px;
}

/* ── Santiye Satiri ── */
.dash-site-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color, #F1F5F9);
}

.dash-site-row:last-child {
  border-bottom: none;
}

.dash-site-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-site-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #334155);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-site-count {
  font-size: 12px;
  color: var(--text-secondary, #64748B);
  white-space: nowrap;
}

.dash-site-bar-track {
  width: 50px;
  height: 4px;
  background: var(--border-color, #E2E8F0);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.dash-site-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ── Hareket Satiri ── */
.dash-activity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-color, #F1F5F9);
}

.dash-activity-row:last-child {
  border-bottom: none;
}

.dash-activity-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary, #334155);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-activity-label {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.dash-activity-time {
  font-size: 11px;
  color: var(--text-secondary, #94A3B8);
  white-space: nowrap;
}
