/* ========================================
   Stats Visoro - Custom Styles
   Inspired by app.makh.org design
   ======================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --dark: #1e293b;
  --dark-hover: #334155;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --text: #1e293b;
  --text-muted: #64748b;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --transition: all 0.2s ease;
}

* {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ---- Navbar ---- */
.navbar {
  background: linear-gradient(135deg, var(--dark) 0%, #0f172a 100%) !important;
  box-shadow: var(--shadow-md);
  padding: 0.5rem 1rem;
}

.navbar-brand {
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  color: #fff !important;
}

.navbar-brand i {
  color: var(--primary);
  font-size: 1.4rem;
}

.nav-link {
  color: rgba(255, 255, 255, 0.75) !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.1);
}

/* ---- Main Content ---- */
.main-content {
  padding-top: 1rem;
  min-height: calc(100vh - 56px);
}

/* ---- Auth Layout ---- */
.auth-body {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  min-height: 100vh;
}

.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  animation: fadeInUp 0.4s ease;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: -1px;
  margin-bottom: 0.25rem;
}

.auth-logo {
  font-size: 3rem;
  color: var(--primary);
  display: block;
  margin-bottom: 0.5rem;
}

/* ---- Cards ---- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.stat-card .card-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
}

.stat-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
}

.stat-title:hover {
  color: var(--primary);
}

.stat-assigned {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.add-value-btn {
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.add-value-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: scale(1.1);
}

/* ---- Chart ---- */
.chart-container {
  min-height: 200px;
  position: relative;
}

.chart-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ---- Toolbar ---- */
.toolbar {
  background: var(--card-bg);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 4rem;
  display: block;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state h3 {
  color: var(--text);
  font-weight: 600;
}

/* ---- Tables ---- */
.table th {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom-width: 2px;
}

.table td {
  vertical-align: middle;
  font-size: 0.9rem;
}

/* ---- Badges ---- */
.badge {
  font-weight: 500;
  font-size: 0.8rem;
  padding: 0.35em 0.65em;
}

/* ---- Buttons ---- */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 500;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-lg {
  padding: 0.625rem 1.5rem;
  font-size: 1rem;
  border-radius: var(--radius-sm);
}

/* ---- Detail Header ---- */
.detail-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

/* ---- Settings Form ---- */
.form-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text);
}

.form-control,
.form-select {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ---- Alerts ---- */
.alert {
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.9rem;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
}

.alert-info {
  background: var(--primary-light);
  color: #1e40af;
}

/* ---- Modals ---- */
.modal-content {
  border-radius: var(--radius);
  border: none;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

/* ---- Tabs ---- */
.nav-tabs .nav-link {
  color: var(--text-muted) !important;
  background: transparent !important;
  border: none;
  padding: 0.75rem 1.25rem !important;
  font-weight: 500;
}

.nav-tabs .nav-link.active {
  color: var(--primary) !important;
  border-bottom: 2px solid var(--primary);
}

/* ---- Animations ---- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card-wrapper {
  animation: fadeInUp 0.4s ease;
  animation-fill-mode: both;
}

.stat-card-wrapper:nth-child(1) {
  animation-delay: 0.05s;
}

.stat-card-wrapper:nth-child(2) {
  animation-delay: 0.1s;
}

.stat-card-wrapper:nth-child(3) {
  animation-delay: 0.15s;
}

.stat-card-wrapper:nth-child(4) {
  animation-delay: 0.2s;
}

.stat-card-wrapper:nth-child(5) {
  animation-delay: 0.25s;
}

.stat-card-wrapper:nth-child(6) {
  animation-delay: 0.3s;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .toolbar .row {
    flex-direction: column;
  }

  .btn-group {
    flex-wrap: wrap;
  }

  .detail-header .d-flex {
    flex-direction: column;
    gap: 1rem;
  }
}

/* ---- Print Mode ---- */
@media print {

  .navbar,
  .btn,
  .modal,
  .toolbar,
  footer,
  form,
  .alert,
  .card-header .btn,
  .no-print {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt;
  }

  .main-content {
    padding: 0 !important;
  }

  .container-fluid {
    padding: 0 !important;
    max-width: 100%;
  }

  .card {
    border: none !important;
    box-shadow: none !important;
  }

  .print-content {
    display: block !important;
  }

  h2,
  h3,
  h4,
  h5 {
    page-break-after: avoid;
  }

  .mb-4 {
    margin-bottom: 0.5rem !important;
  }
}
/* Value table: aggregated decrease, MAKH colours it orange (PRP 001) */
.stat-change-orange {
    color: #f97316;
}

/* Graph drawing (PRP 002): SVG chart, hover bubble with the period's note */
.stat-chart {
    display: block;
    font-family: Inter, sans-serif;
}

.stat-chart-tooltip {
    position: absolute;
    z-index: 5;
    max-width: 260px;
    padding: 6px 10px;
    border-radius: 6px;
    background: #1e293b;
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
    pointer-events: none;
}

.stat-chart-note {
    color: #FFA500;
}

/* Összefoglalás grid (PRP 006): sticky graph names, highlighted unsaved cells */
.summary-grid .summary-title {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 200px;
    background: #fff;
}

.summary-grid .summary-cell {
    min-width: 80px;
}

.summary-grid .summary-cell-changed {
    background: #fff7e6;
}

/* The test version says so on every page (PRP 009) */
.test-env-banner {
  background: #f59e0b;
  color: #111827;
  font-weight: 700;
  text-align: center;
  padding: 0.35rem 1rem;
}

.auth-body .test-env-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}
