/* =========================================================================
   Pantausentimen — Dashboard Monitoring Styles
   Design System: modern, clean, professional, analytical, calm
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. CSS Variables
   ------------------------------------------------------------------------- */
:root {
  --color-primary: #2563EB;
  --color-primary-hover: #1D4ED8;
  --color-primary-soft: #EFF6FF;
  --color-bg: #F1F5F9;
  --color-surface: #FFFFFF;
  --color-text: #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted: #64748B;
  --color-border: #E2E8F0;
  --color-border-soft: #EEF2F7;
  --color-success: #16A34A;
  --color-success-soft: #DCFCE7;
  --color-danger: #DC2626;
  --color-danger-soft: #FEE2E2;
  --color-warning: #F59E0B;
  --color-warning-soft: #FEF3C7;
  --color-neutral: #94A3B8;
  --color-neutral-soft: #F1F5F9;
  --color-purple: #7C3AED;
  --color-cyan: #0891B2;

  --radius-card: 12px;
  --radius-button: 10px;
  --radius-chip: 999px;
  --radius-input: 8px;

  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-dropdown: 0 8px 24px rgba(15, 23, 42, 0.12);

  --sidebar-width: 240px;
  --sidebar-collapsed-width: 70px;
  --header-height: auto;
  --status-strip-height: 40px;

  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --transition: 0.2s ease;
  --transition-sidebar: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* -------------------------------------------------------------------------
   2. Reset / Base
   ------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input, select {
  font-family: inherit;
  font-size: inherit;
}

img, svg {
  display: block;
}

/* -------------------------------------------------------------------------
   3. Layout
   ------------------------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-sidebar);
}

.app-shell.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

.content-body {
  flex: 1;
  padding: 24px 28px 32px;
  overflow-y: auto;
}

@media (max-width: 1400px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1200px) {
  .dashboard-grid-wide { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  .insight-block { border-right: none; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 150;
  }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0 !important; }
  .sidebar-collapse-btn { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid-3 { grid-template-columns: 1fr; }
  .topbar-header { flex-direction: column; gap: 12px; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .filter-bar { flex-direction: column; align-items: flex-start; }
  .mobile-menu-btn { display: flex !important; }
  .content-body { padding: 16px; }
  .topbar { padding: 16px; }
  .status-strip { padding: 0 16px; }
  .stepper { flex-wrap: wrap; gap: 8px; }
  .stepper-step:not(:last-child)::after { display: none; }
}

@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-card-value { font-size: 22px; }
  .crawler-stats { grid-template-columns: 1fr; }
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color-neutral-soft);
  color: var(--color-text-secondary);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-menu-btn svg { width: 18px; height: 18px; }

/* -------------------------------------------------------------------------
   Utility
   ------------------------------------------------------------------------- */
.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.hidden { display: none !important; }

/* -------------------------------------------------------------------------
   Correction Modal Styles (Human-in-the-Loop)
   ------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6); /* dark slate backdrop */
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 16px;
}

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

.modal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-dropdown);
  border-radius: var(--radius-card);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-zoom-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-zoom-in {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--color-text);
}

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

.comment-preview-box {
  background: var(--color-neutral-soft);
  border: 1px solid var(--color-border-soft);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.comment-preview-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0 0 4px 0;
}

.comment-preview-text {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0;
  word-break: break-word;
}

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

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.form-select {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input, 8px);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

.form-control::placeholder {
  color: var(--color-text-muted);
  opacity: 0.7;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.help-text {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* Wide modal variant for project management */
.modal-card.modal-wide {
  max-width: 800px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border-soft);
  background: var(--color-neutral-soft);
}

/* ==========================================================================
   Dropdown Menu
   ========================================================================== */
.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  background-color: #fff;
  min-width: 200px;
  box-shadow: var(--shadow-dropdown);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  z-index: 1000;
  overflow: hidden;
}

.dropdown-content.show {
  display: block;
}

.dropdown-content a {
  color: var(--color-text);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s ease;
}

.dropdown-content a:hover {
  background-color: var(--color-bg);
}
