/* ==========================================================================
   MídiaInfo Premium Identity System - Advertiser Portal stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg-dark: #030712;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --border-color: rgba(255, 255, 255, 0.06);
  --primary-blue: #3b82f6;
  --primary-orange: #ff7a00;
  --success-green: #10b981;
  --alert-amber: #f59e0b;
  --danger-red: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-family: 'Outfit', sans-serif;
}

/* ─── RESET & BASE ─── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(249, 115, 22, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 0%, #0f172a 0%, #030712 100%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── GLOW EFFECT DECORATION ─── */
.glow-spot {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.12;
}
.glow-blue { top: -100px; left: -100px; background: radial-gradient(circle, var(--primary-blue), transparent); }
.glow-orange { bottom: -100px; right: -100px; background: radial-gradient(circle, var(--primary-orange), transparent); }

/* ─── TOP BAR ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 32px;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand img.logo {
  height: 38px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(255, 122, 0, 0.25));
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 1px;
}

.tabs {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.tabbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tabbtn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.tabbtn.active {
  background: rgba(255, 122, 0, 0.1);
  border-color: rgba(255, 122, 0, 0.25);
  color: var(--primary-orange);
  box-shadow: 0 0 16px rgba(255, 122, 0, 0.05);
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-weight: 600;
  font-size: 13.5px;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary-orange), #e06c00);
  border-color: var(--primary-orange);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(255, 122, 0, 0.2);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #ff8c21, #f57400);
  box-shadow: 0 6px 20px rgba(255, 122, 0, 0.3);
}

.btn.blue {
  background: linear-gradient(135deg, var(--primary-blue), #1d4ed8);
  border-color: var(--primary-blue);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.btn.blue:hover:not(:disabled) {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.btn.danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn.danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.45);
  color: #f87171;
}

/* ─── CONTAINER & GRIDS ─── */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 24px;
}

.grid {
  display: grid;
  gap: 24px;
}

.grid.cols2 {
  grid-template-columns: 1fr 1fr;
}

.grid.main {
  grid-template-columns: 420px 1fr;
  align-items: start;
}

@media (max-width: 1100px) {
  .grid.main, .grid.cols2 {
    grid-template-columns: 1fr;
  }
}

/* ─── GLASS CARDS ─── */
.cardx, .card {
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: border-color 0.3s;
}

.cardx:hover, .card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.cardx .hd, .card .hd {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(3, 7, 18, 0.4);
}

.cardx .hd h2, .card .hd h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cardx .hd .sub, .card .hd .sub {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.cardx .bd, .card .bd {
  padding: 24px;
}

/* ─── KPIs GRID ─── */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.kpi {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.25));
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.kpi:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 122, 0, 0.2);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.kpi .label {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.kpi .value {
  font-size: 2.2rem;
  font-weight: 900;
  margin-top: 10px;
  line-height: 1;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff, #e2e8f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.kpi .hint {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 10px;
}

/* ─── PILLS & BADGES ─── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-muted);
}

.pill.orange { border-color: rgba(255, 122, 0, 0.35); color: #ff912b; background: rgba(255, 122, 0, 0.08); }
.pill.blue   { border-color: rgba(59, 130, 246, 0.35); color: #60a5fa; background: rgba(59, 130, 246, 0.08); }
.pill.green  { border-color: rgba(16, 185, 129, 0.35); color: #34d399; background: rgba(16, 185, 129, 0.08); }
.pill.gold   { border-color: rgba(245, 158, 11, 0.35); color: #fbbf24; background: rgba(245, 158, 11, 0.08); }

/* ─── FORMS & INPUTS ─── */
.filters {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

select, input {
  width: 100%;
  background: rgba(3, 7, 18, 0.6);
  border: 1px solid var(--border-color);
  color: #ffffff;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14.5px;
  font-weight: 500;
  font-family: var(--font-family);
  outline: none;
  transition: all 0.2s ease;
}

select:focus, input:focus {
  border-color: var(--primary-orange);
  background: rgba(255, 122, 0, 0.03);
  box-shadow: 0 0 16px rgba(255, 122, 0, 0.08);
}

select option {
  background-color: #111827;
  color: #f3f4f6;
}

/* ─── TABLES ─── */
.tablewrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: rgba(3, 7, 18, 0.25);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

th, td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

th {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: rgba(255, 255, 255, 0.01);
}

tr:last-child td {
  border-bottom: none;
}

tr[style*="cursor:pointer"]:hover td {
  background: rgba(255, 122, 0, 0.03);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

/* Custom Scrollbar for scrollable tables */
.tablewrap-scroll {
  max-height: 380px;
  overflow-y: auto;
}

.tablewrap-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.tablewrap-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.tablewrap-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.tablewrap-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ─── MAP & CHART CANVAS ─── */
#map {
  height: 450px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.canvas {
  height: 240px;
  margin-top: 10px;
}

/* ─── LEAFLET RESET ─── */
.leaflet-container img {
  max-width: none !important;
  max-height: none !important;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  max-width: none !important;
  max-height: none !important;
}

/* ─── MESSAGES ─── */
.msg {
  margin-top: 12px;
  font-size: 13px;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  line-height: 1.4;
}

.msg.ok {
  color: var(--success-green);
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.05);
}

.msg.bad {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.05);
}

/* ─── ADVANCED DETAILS AUDITORIA ─── */
details.advanced {
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  overflow: hidden;
  margin-top: 24px;
}

details.advanced summary {
  list-style: none;
  cursor: pointer;
  padding: 20px 24px;
  font-weight: 700;
  background: rgba(3, 7, 18, 0.4);
  transition: background 0.2s;
  outline: none;
}

details.advanced summary:hover {
  background: rgba(3, 7, 18, 0.6);
}

details.advanced summary::-webkit-details-marker {
  display: none;
}
