/* ============================================================
   Smart Prótese · KPI — Gestão de Anúncios
   ============================================================ */

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

  --brand: #4A3FC7;
  --brand-light: #6B5BE8;
  --brand-deep: #3730A3;

  --bg: #F4F4F8;
  --ink: #1A1A2E;
  --muted: #8A8AA0;
  --muted-soft: #B4B4C6;

  --surface: #FFFFFF;
  --metric-bg: #F6F6F6;
  --metric-border: #ECECF1;

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-card: 0 2px 14px rgba(26, 26, 60, 0.06);
  --shadow-kpi: 0 10px 24px -8px rgba(43, 34, 130, 0.35);
  --shadow-header: 0 10px 30px rgba(74, 63, 199, 0.22);
  --shadow-pop: 0 20px 50px rgba(20, 16, 60, 0.18);

  --ease: cubic-bezier(.4, 0, .2, 1);
}

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

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

/* ---------- Login ---------- */

#loginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 15% 15%, rgba(255,255,255,0.10), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(255,255,255,0.08), transparent 40%),
    linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 50%, var(--brand-light) 100%);
}

.login-box {
  background: var(--surface);
  border-radius: 22px;
  padding: 2.75rem 2.25rem 2.25rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow-pop);
}

.login-logo-img { height: 52px; margin: 0 auto 0.9rem; display: block; object-fit: contain; }
.login-sub { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 2rem; letter-spacing: .01em; }

.login-field { position: relative; margin-bottom: 12px; }
.login-field .field-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted-soft); font-size: 17px; pointer-events: none;
}
.login-input {
  width: 100%; padding: 13px 16px 13px 40px;
  border: 1.5px solid #E4E4EF; border-radius: 12px;
  font-family: var(--font); font-size: 15px; color: var(--ink);
  outline: none; transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.login-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(74,63,199,0.10); }

.login-btn {
  width: 100%; padding: 13px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  color: white; border: none; border-radius: 12px;
  font-family: var(--font); font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity .2s var(--ease), transform .15s var(--ease);
}
.login-btn:hover { opacity: .92; }
.login-btn:active { transform: scale(.98); }

.login-error {
  display: none; align-items: center; justify-content: center; gap: 6px;
  color: #E53E3E; font-size: 13px; font-weight: 500; margin-top: 14px;
}

/* ---------- Shell ---------- */

#dashScreen { display: none; }
.container { max-width: 1040px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }

.header {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.75rem;
  margin-bottom: 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
  box-shadow: var(--shadow-header);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-logo { height: 34px; display: block; object-fit: contain; transition: opacity .2s var(--ease); }
.header-logo:hover { opacity: .82; }
.header-sub { color: rgba(255,255,255,0.72); font-size: 12px; font-weight: 500; margin-top: 3px; letter-spacing: .01em; }

.tabs { display: flex; gap: 4px; background: rgba(255,255,255,0.14); border-radius: 11px; padding: 4px; }
.tab {
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 8px 16px; border-radius: 8px;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,0.75); cursor: pointer; border: none; background: none;
  transition: all .2s var(--ease);
}
.tab i { font-size: 15px; }
.tab:hover { color: white; }
.tab.active { background: white; color: var(--brand); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.section-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: .1em; text-transform: uppercase; margin-bottom: 14px;
}

/* ---------- KPI cards ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 1.75rem;
}

.kpi-card {
  position: relative;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-kpi);
  overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.kpi-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(255,255,255,0.14), rgba(255,255,255,0) 55%);
  pointer-events: none;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -8px rgba(43,34,130,0.4); }

.kpi-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,0.20);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.kpi-icon i { font-size: 18px; color: white; }

.kpi-label {
  font-size: 10.5px; color: rgba(255,255,255,0.78); font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; line-height: 1.4;
  position: relative;
}
.kpi-value { font-size: 22px; font-weight: 800; color: white; letter-spacing: -0.4px; position: relative; }

/* ---------- Platform sections ---------- */

.platform-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}
.platform-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 1.25rem; padding-bottom: 1rem;
  border-bottom: 1px solid #F0F0F4;
}
.platform-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.platform-name { font-size: 16px; font-weight: 800; color: var(--ink); }
.platform-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.metric-card {
  background: var(--metric-bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--metric-border);
  transition: border-color .2s var(--ease);
}
.metric-card:hover { border-color: #DEDEEA; }
.metric-icon { font-size: 15px; color: #9E9EC0; margin-bottom: 7px; }
.metric-label { font-size: 11px; color: var(--muted); margin-bottom: 5px; line-height: 1.35; font-weight: 500; }
.metric-value { font-size: 17px; font-weight: 700; color: var(--ink); }
.metric-value.accent { color: var(--brand); }

/* ---------- Controls ---------- */

.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 1.5rem; }

.select-wrap { position: relative; }
.select-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--brand); font-size: 15px; pointer-events: none;
}
.styled-select {
  background: white; border: 1.5px solid #E4E4EF; color: var(--ink);
  padding: 9px 34px 9px 36px; border-radius: 11px;
  font-family: var(--font); font-size: 14px; font-weight: 500; cursor: pointer;
  min-width: 190px; outline: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234A3FC7' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  transition: border-color .2s var(--ease);
}
.styled-select:hover { border-color: #CFCFE4; }
.styled-select:focus { border-color: var(--brand); }

/* ---------- Charts ---------- */

.chart-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}
.chart-title { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 1.25rem; }
.chart-wrap { position: relative; width: 100%; height: 280px; }

/* ---------- Year tabs ---------- */

.year-tabs { display: flex; gap: 8px; margin-bottom: 1.5rem; flex-wrap: wrap; }
.year-tab {
  padding: 8px 20px; border-radius: 11px;
  font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1.5px solid #E4E4EF; background: white; color: var(--muted);
  transition: all .2s var(--ease);
}
.year-tab:hover { border-color: var(--brand-light); color: var(--brand); }
.year-tab.active { border-color: var(--brand); background: var(--brand); color: white; }

/* ---------- Misc ---------- */

.no-data { color: var(--muted-soft); font-size: 14px; text-align: center; padding: 2.5rem; }
.footer { text-align: center; color: var(--muted-soft); font-size: 12px; margin-top: 2rem; }

@media (max-width: 600px) {
  .header { flex-direction: column; align-items: flex-start; }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; padding: 8px 6px; font-size: 12px; gap: 4px; }
  .tab i { font-size: 14px; }
  .kpi-value { font-size: 19px; }
  .container { padding: 1.25rem .85rem 2.5rem; }
}

@media (max-width: 360px) {
  .tab i { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
