/* ==========================================================================
   IBGPP PYTHON ANALYTICS DASHBOARD - STREAMLIT & PLOTLY STYLE
   Modern, Dark-Slate, High-Tech Executive Interface
   ========================================================================== */

:root {
  --py-bg-dark: #0b0f19;
  --py-card-bg: #111827;
  --py-card-bg-hover: #151f33;
  --py-card-border: rgba(255, 255, 255, 0.08);
  --py-card-border-glow: rgba(56, 189, 248, 0.35);
  --py-blue: #38bdf8;
  --py-blue-glow: rgba(56, 189, 248, 0.25);
  --py-yellow: #fbbf24;
  --py-green: #10b981;
  --py-green-glow: rgba(16, 185, 129, 0.25);
  --py-purple: #a855f7;
  --py-rose: #f43f5e;
  --py-text-main: #f8fafc;
  --py-text-muted: #94a3b8;
  --py-text-dim: #64748b;
  --py-radius: 14px;
}

/* Dashboard Outer Container */
.py-dashboard-wrapper {
  background: var(--py-bg-dark);
  color: var(--py-text-main);
  padding: 1.5rem 1.75rem 3rem 1.75rem;
  border-radius: var(--py-radius);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  margin-bottom: 2rem;
}

/* Header Banner - Streamlit / Python Tech Style */
.py-dash-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #111827 0%, #0f172a 100%);
  border: 1px solid var(--py-card-border);
  border-radius: var(--py-radius);
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.py-dash-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #38bdf8 0%, #fbbf24 50%, #10b981 100%);
}

.py-dash-title-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.py-logo-badge {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #ffffff;
  box-shadow: 0 0 20px var(--py-blue-glow);
}

.py-dash-title h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.py-dash-title p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--py-text-muted);
}

.py-header-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.py-pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--py-text-muted);
}

.py-pill-tag.live {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.py-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pyPulse 1.8s infinite;
}

@keyframes pyPulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.py-btn-refresh {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: 10px;
  padding: 0.55rem 1.1rem;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.25s ease;
}

.py-btn-refresh:hover {
  background: #0284c7;
  border-color: #38bdf8;
  box-shadow: 0 0 15px var(--py-blue-glow);
  transform: translateY(-1px);
}

/* Quick Action Toolbar */
.py-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.py-action-chip {
  background: #131b2e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.55rem 1rem;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.py-action-chip:hover {
  background: #1a253f;
  border-color: #38bdf8;
  color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.15);
}

.py-action-chip i {
  color: #38bdf8;
}

/* Metric Cards Grid (Plotly / Streamlit Style) */
.py-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.py-metric-card {
  background: var(--py-card-bg);
  border: 1px solid var(--py-card-border);
  border-radius: var(--py-radius);
  padding: 1.35rem 1.4rem;
  position: relative;
  transition: all 0.28s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.py-metric-card:hover {
  transform: translateY(-3px);
  border-color: var(--py-card-border-glow);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.12);
}

.py-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.py-card-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--py-text-muted);
}

.py-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.py-metric-card.cyan .py-card-icon {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
}
.py-metric-card.emerald .py-card-icon {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}
.py-metric-card.amber .py-card-icon {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}
.py-metric-card.purple .py-card-icon {
  background: rgba(168, 85, 247, 0.12);
  color: #a855f7;
}

.py-card-value {
  font-size: 2rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.1;
  margin-bottom: 0.4rem;
  letter-spacing: -0.03em;
  font-feature-settings: "tnum";
}

.py-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--py-text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.6rem;
  margin-top: 0.25rem;
}

.py-trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
}

.py-trend-badge.up {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.py-trend-badge.info {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

/* Charts Grid (Plotly Dark Theme) */
.py-charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

@media (max-width: 1024px) {
  .py-charts-grid {
    grid-template-columns: 1fr;
  }
}

.py-chart-box {
  background: var(--py-card-bg);
  border: 1px solid var(--py-card-border);
  border-radius: var(--py-radius);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
}

.py-chart-box.full-width {
  grid-column: 1 / -1;
}

.py-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.py-chart-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.py-chart-title i {
  color: #38bdf8;
}

.py-chart-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 270px;
}

/* Tabbed Data Lists (Tables in Dark Glass) */
.py-table-card {
  background: var(--py-card-bg);
  border: 1px solid var(--py-card-border);
  border-radius: var(--py-radius);
  overflow: hidden;
  margin-top: 1.75rem;
}

.py-tabs-nav {
  display: flex;
  background: #0d121e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 1rem;
  overflow-x: auto;
}

.py-tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--py-text-muted);
  padding: 1rem 1.25rem;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.py-tab-btn:hover {
  color: #ffffff;
}

.py-tab-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

.py-tab-content {
  padding: 1.25rem 1.5rem;
  display: none;
}

.py-tab-content.active {
  display: block;
}

.py-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.py-data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--py-text-dim);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.py-data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.py-data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.py-status-pill {
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.py-status-pill.success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.py-status-pill.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.py-status-pill.danger {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}
