/* ================================================================
   MotoraFinance — components.css
   Sistema de componentes utilitários para eliminar inline styles
   Importar APÓS app.css e dashboard.css
   ================================================================ */

/* ================================================================
   1. UTILITÁRIOS DE LAYOUT (flex, gap, alinhamento)
   ================================================================ */
.d-flex        { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-grid        { display: grid; }
.d-none        { display: none; }
.d-block       { display: block; }

.flex-1        { flex: 1; }
.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }

.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.ml-auto       { margin-left: auto; }

.gap-2  { gap: 2px; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

/* ================================================================
   2. UTILITÁRIOS DE ESPAÇAMENTO
   ================================================================ */
.p-0    { padding: 0; }
.p-4    { padding: 4px; }
.p-8    { padding: 8px; }
.p-10   { padding: 10px; }
.p-12   { padding: 12px; }
.p-16   { padding: 16px; }
.p-20   { padding: 20px; }
.px-8   { padding-left: 8px;  padding-right: 8px; }
.px-10  { padding-left: 10px; padding-right: 10px; }
.px-12  { padding-left: 12px; padding-right: 12px; }
.px-16  { padding-left: 16px; padding-right: 16px; }
.px-20  { padding-left: 20px; padding-right: 20px; }
.py-4   { padding-top: 4px;  padding-bottom: 4px; }
.py-6   { padding-top: 6px;  padding-bottom: 6px; }
.py-8   { padding-top: 8px;  padding-bottom: 8px; }
.py-10  { padding-top: 10px; padding-bottom: 10px; }
.py-12  { padding-top: 12px; padding-bottom: 12px; }
.py-16  { padding-top: 16px; padding-bottom: 16px; }

.m-0    { margin: 0; }
.mb-4   { margin-bottom: 4px; }
.mb-6   { margin-bottom: 6px; }
.mb-8   { margin-bottom: 8px; }
.mb-10  { margin-bottom: 10px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }
.mb-20  { margin-bottom: 20px; }
.mb-24  { margin-bottom: 24px; }
.mt-2   { margin-top: 2px; }
.mt-4   { margin-top: 4px; }
.mt-6   { margin-top: 6px; }
.mt-8   { margin-top: 8px; }
.mt-10  { margin-top: 10px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mt-20  { margin-top: 20px; }

/* ================================================================
   3. UTILITÁRIOS DE TIPOGRAFIA
   ================================================================ */
.text-xs    { font-size: 10px; }
.text-sm    { font-size: 11px; }
.text-base  { font-size: 12px; }
.text-md    { font-size: 13px; }
.text-lg    { font-size: 14px; }
.text-xl    { font-size: 15px; }
.text-2xl   { font-size: 17px; }
.text-3xl   { font-size: 20px; }
.text-4xl   { font-size: 24px; }
.text-5xl   { font-size: 32px; }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fw-900 { font-weight: 900; }

.text-primary  { color: var(--color-primary); }
.text-success  { color: var(--color-success); }
.text-warning  { color: var(--color-warning); }
.text-danger   { color: var(--color-danger); }
.text-info     { color: var(--color-info); }
.text-muted    { color: var(--color-text-2); }
.text-main     { color: var(--color-text); }
.text-white    { color: #fff; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

.uppercase    { text-transform: uppercase; }
.letter-wide  { letter-spacing: .5px; }
.letter-wider { letter-spacing: 1px; }
.line-height-normal { line-height: 1.5; }
.truncate     { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.no-wrap      { white-space: nowrap; }

/* ================================================================
   4. UTILITÁRIOS DE BORDA E RADIUS
   ================================================================ */
.rounded    { border-radius: var(--radius); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-xs { border-radius: 6px; }
.rounded-lg { border-radius: 16px; }
.rounded-xl { border-radius: 20px; }
.rounded-full { border-radius: 9999px; }

.border     { border: 1px solid var(--color-border); }
.border-top { border-top: 1px solid var(--color-border); }
.border-bottom { border-bottom: 1px solid var(--color-border); }

/* ================================================================
   5. BADGES DE STATUS (pill labels)
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  line-height: 1;
  white-space: nowrap;
}
.badge-sm { font-size: 9px; padding: 2px 7px; }
.badge-lg { font-size: 12px; padding: 4px 12px; }

.badge-primary {
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  color: var(--color-primary);
  border: 1px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
}
.badge-success {
  background: rgba(46,196,182,.12);
  color: var(--color-success);
  border: 1px solid rgba(46,196,182,.3);
}
.badge-warning {
  background: rgba(255,159,28,.12);
  color: var(--color-warning);
  border: 1px solid rgba(255,159,28,.25);
}
.badge-danger {
  background: rgba(230,57,70,.1);
  color: var(--color-danger);
  border: 1px solid rgba(230,57,70,.2);
}
.badge-info {
  background: rgba(69,123,157,.1);
  color: var(--color-info);
  border: 1px solid rgba(69,123,157,.2);
}
.badge-neutral {
  background: var(--color-bg);
  color: var(--color-text-2);
  border: 1px solid var(--color-border);
}
.badge-gold {
  background: rgba(245,158,11,.15);
  color: #D97706;
  border: 1px solid rgba(245,158,11,.3);
}

/* Badge nav menu (NEW, DEMO) */
.nav-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: auto;
  line-height: 1.4;
}
.nav-badge-new  { background: rgba(255,159,28,.2); color: #FF9F1C; }
.nav-badge-demo { background: rgba(244,162,40,.2); color: #F4A228; }
.nav-badge-hot  { background: rgba(230,57,70,.15); color: var(--color-primary); }

/* ================================================================
   6. CAIXAS DE STATUS / TRIAL BANNER
   ================================================================ */
.trial-banner {
  background: rgba(99,102,241,.06);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--color-text-2);
}
.trial-banner__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.trial-banner__icon { color: #6366F1; }
.trial-banner__link { color: #6366F1; font-weight: 700; margin-left: 4px; }
.trial-banner__link:hover { text-decoration: underline; }
.trial-banner__bar {
  height: 4px;
  background: rgba(99,102,241,.15);
  border-radius: 4px;
  overflow: hidden;
}
.trial-banner__fill {
  height: 100%;
  background: linear-gradient(90deg, #6366F1, #818CF8);
  border-radius: 4px;
  transition: width .4s;
}

/* ================================================================
   7. ÍCONE CONTAINER (ícones quadrados com background)
   ================================================================ */
.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 10px;
}
.icon-box-sm  { width: 28px; height: 28px; font-size: 12px; border-radius: 7px; }
.icon-box-md  { width: 36px; height: 36px; font-size: 15px; border-radius: 9px; }
.icon-box-lg  { width: 44px; height: 44px; font-size: 20px; border-radius: 11px; }
.icon-box-xl  { width: 52px; height: 52px; font-size: 24px; border-radius: 13px; }

.icon-box-primary  { background: color-mix(in srgb, var(--color-primary) 12%, transparent); color: var(--color-primary); }
.icon-box-success  { background: rgba(46,196,182,.12);  color: var(--color-success); }
.icon-box-warning  { background: rgba(255,159,28,.12);  color: var(--color-warning); }
.icon-box-danger   { background: rgba(230,57,70,.1);    color: var(--color-danger); }
.icon-box-info     { background: rgba(69,123,157,.1);   color: var(--color-info); }
.icon-box-purple   { background: rgba(124,58,237,.1);   color: #7C3AED; }
.icon-box-neutral  { background: var(--color-bg);       color: var(--color-text-2); border: 1px solid var(--color-border); }

/* ================================================================
   8. SEÇÃO DE ITEM (linha de lista com ícone + texto + ação)
   ================================================================ */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.list-item:last-child { border-bottom: none; }
.list-item:first-child { padding-top: 0; }

.list-item__content { flex: 1; min-width: 0; }
.list-item__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.list-item__sub {
  font-size: 11px;
  color: var(--color-text-2);
  line-height: 1.4;
}
.list-item__value {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  text-align: right;
}
.list-item__value.positive { color: var(--color-success); }
.list-item__value.negative { color: var(--color-danger); }

/* ================================================================
   9. DIVIDER
   ================================================================ */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: 12px 0;
}
.divider-v {
  width: 1px;
  background: var(--color-border);
  align-self: stretch;
}

/* ================================================================
   10. PROGRESS BAR GENÉRICO
   ================================================================ */
.progress {
  height: 8px;
  background: var(--color-bg);
  border-radius: 8px;
  overflow: hidden;
}
.progress-sm { height: 5px; }
.progress-lg { height: 12px; }

.progress-fill {
  height: 100%;
  border-radius: 8px;
  background: var(--color-primary);
  transition: width .7s cubic-bezier(.4,0,.2,1);
}
.progress-fill-success { background: var(--color-success); }
.progress-fill-warning { background: var(--color-warning); }
.progress-fill-info    { background: var(--color-info); }

/* ================================================================
   11. CARD SIDEBAR CTA (Pro upgrade ou Pro ativo)
   ================================================================ */
.sidebar-cta {
  margin: 12px;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11px;
}
.sidebar-cta--upgrade {
  background: var(--color-primary);
  color: #fff;
  display: block;
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  transition: opacity .2s, transform .15s;
}
.sidebar-cta--upgrade:hover { opacity: .9; transform: translateY(-1px); }
.sidebar-cta--active {
  background: linear-gradient(135deg, var(--color-primary), #0891B2);
  color: #fff;
}
.sidebar-cta__expires {
  opacity: .8;
  font-size: 10px;
  margin-top: 3px;
}

/* ================================================================
   12. INLINE STAT (mini-métricas dentro de cards)
   ================================================================ */
.inline-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.inline-stat__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--color-text-2);
}
.inline-stat__value {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}
.inline-stat__value--primary { color: var(--color-primary); }
.inline-stat__value--success { color: var(--color-success); }
.inline-stat__value--warning { color: var(--color-warning); }

/* ================================================================
   13. ALERT BANNER INLINE (substituição de alerts com style="")
   ================================================================ */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  margin-bottom: 8px;
  animation: alertSlideIn .3s ease;
}
@keyframes alertSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.alert-banner--danger {
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  border-color: color-mix(in srgb, var(--color-primary) 25%, transparent);
}
.alert-banner--warning {
  background: rgba(255,159,28,.08);
  border-color: rgba(255,159,28,.25);
}
.alert-banner--info {
  background: rgba(29,53,87,.08);
  border-color: rgba(29,53,87,.2);
}
.alert-banner--success {
  background: rgba(46,196,182,.08);
  border-color: rgba(46,196,182,.25);
}
.alert-banner__icon {
  font-size: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}
.alert-banner__body { flex: 1; }
.alert-banner__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 2px;
}
.alert-banner__msg {
  font-size: 12px;
  color: var(--color-text-2);
  line-height: 1.5;
}
.alert-banner__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-2);
  font-size: 12px;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
  opacity: .6;
  transition: opacity .2s;
}
.alert-banner__close:hover { opacity: 1; }

/* ================================================================
   14. TOOLTIP NATIVO
   ================================================================ */
[data-tooltip] {
  position: relative;
  cursor: help;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-sidebar);
  color: rgba(255,255,255,.9);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 9000;
  font-family: var(--font);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ================================================================
   15. SKELETON LOADER (placeholders de loading)
   ================================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--color-bg) 25%, var(--color-border) 50%, var(--color-bg) 75%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.skeleton-text    { height: 14px; margin-bottom: 8px; }
.skeleton-title   { height: 20px; width: 60%; margin-bottom: 10px; }
.skeleton-value   { height: 28px; width: 40%; }
.skeleton-card    { height: 100px; border-radius: var(--radius); }

/* ================================================================
   16. GRID UTILITÁRIO RESPONSIVO
   ================================================================ */
.grid-auto-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.grid-auto-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.grid-auto-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }

/* ================================================================
   17. PILL TABS (variação do period-tabs para outros contextos)
   ================================================================ */
.pill-tabs {
  display: inline-flex;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 9999px;
  padding: 3px;
  gap: 2px;
}
.pill-tab {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-2);
  border-radius: 9999px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font);
  transition: all .18s;
}
.pill-tab.active,
.pill-tab:hover {
  background: var(--color-white);
  color: var(--color-text);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.pill-tab.active { color: var(--color-primary); }

/* ================================================================
   18. CARD HIGHLIGHT (destaque em linha com cor primária)
   ================================================================ */
.card-highlight {
  border-left: 3px solid var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 4%, var(--color-white));
  border-radius: 0 var(--radius) var(--radius) 0;
}
.card-highlight--success { border-left-color: var(--color-success); background: rgba(46,196,182,.04); }
.card-highlight--warning { border-left-color: var(--color-warning); background: rgba(255,159,28,.04); }

/* ================================================================
   19. FLOATING ACTION BUTTON (mobile)
   ================================================================ */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  z-index: 200;
  transition: transform .2s, box-shadow .2s;
  text-decoration: none;
}
.fab:hover { transform: scale(1.08) translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.3); }
.fab:active { transform: scale(.96); }

@media (min-width: 769px) { .fab { display: none; } }

/* ================================================================
   20. MICRO-ANIMAÇÕES DE ENTRADA
   ================================================================ */
.fade-in {
  animation: fadeIn .35s ease;
}
.slide-up {
  animation: slideUp .3s ease;
}
.scale-in {
  animation: scaleIn .25s cubic-bezier(.34,1.56,.64,1);
}

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }

/* ================================================================
   21. RESPONSIVIDADE — utilitários mobile
   ================================================================ */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: flex !important; }
  .full-mobile  { width: 100% !important; }
  .stack-mobile { flex-direction: column !important; }
  .text-center-mobile { text-align: center !important; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
  .show-desktop { display: flex !important; }
}

/* ================================================================
   22. FOCUS VISÍVEL (acessibilidade)
   ================================================================ */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}
