/* =========================================================
   ORÇA FÁCIL — CSS BASE (DARK/LIGHT + SIDEBAR POR VARIÁVEIS)
   ========================================================= */

/* ============= 1) VARIÁVEIS GLOBAIS ============= */
:root {
  /* Layout */
  --of-sidebar-w: 260px;

  /* Fundo geral (fora dos cards) */
  --of-content-bg: #f4f6f9;
  --bs-body-bg:    #f4f6f9;

  /* Realces/sombras */
  --of-paper-shadow: 0 6px 22px rgba(0,0,0,.05);

  /* Upload/logo */
  --of-logo-border: #cbd5e1;
  --of-logo-bg:     #f8fafc;

  /* Sidebar (tema claro) */
  --of-sidebar-bg:            #0d6efd;
  --of-sidebar-fg:            #ffffff;
  --of-sidebar-link:          rgba(255,255,255,.88);
  --of-sidebar-link-hover-bg: rgba(255,255,255,.15);
  --of-sidebar-active-bg:     #ffffff;
  --of-sidebar-active-fg:     #0d6efd;
  --of-sidebar-border:        rgba(255,255,255,.25);

  /* Auth: imagem remota padrão */
  --auth-bg-img: url('https://images.unsplash.com/photo-1554224155-6726b3ff858f?q=80&w=1600&auto=format&fit=crop');

  /* Tamanhos utilitários */
  --logo-w: 150px;

  /* Quote */
  --quote-card-bg: #ffffff;
  --quote-card-border: #e2e8f0;
  --quote-head-gradient: linear-gradient(120deg, rgba(238,242,255,.9), rgba(248,250,252,.95));
  --quote-head-text: #475467;
  --quote-chip-bg: #eef2ff;
  --quote-chip-color: #4338ca;
  --quote-row-hover: rgba(99,102,241,.08);
  --quote-shadow: 0 26px 50px rgba(15, 23, 42, .08);
  --quote-field-bg: #f9fafb;
  --placeholder-color: #94a3b8;
  --placeholder-strong-color: #cbd5f5;
}

/* Dark mode (somente o que precisa mudar) */
[data-bs-theme="dark"] {
  --of-content-bg: #16191c;
  --bs-body-bg:    #16191c;
  --of-paper-shadow: 0 6px 22px rgba(0,0,0,.20);

  --of-logo-border: rgba(255,255,255,.25);
  --of-logo-bg:     rgba(255,255,255,.03);

  /* Sidebar escura (azul mais fechado) */
  --of-sidebar-bg:            #0b5ed7;
  --of-sidebar-fg:            #e9ecef;
  --of-sidebar-link:          rgba(255,255,255,.92);
  --of-sidebar-link-hover-bg: rgba(255,255,255,.16);
  --of-sidebar-active-bg:     #ffffff;
  --of-sidebar-active-fg:     #0b5ed7;
  --of-sidebar-border:        rgba(255,255,255,.25);

  /* Auth: variação mais escura */
  --auth-bg-img: url('https://images.unsplash.com/photo-1554224154-22dec7ec8818?q=80&w=1600&auto=format&fit=crop');

  --quote-card-bg: rgba(18,19,23,.95);
  --quote-card-border: rgba(255,255,255,.08);
  --quote-head-gradient: linear-gradient(120deg, rgba(62,72,99,.55), rgba(32,38,54,.9));
  --quote-head-text: #e0e7ff;
  --quote-chip-bg: rgba(99,102,241,.25);
  --quote-chip-color: #c7d2fe;
  --quote-row-hover: rgba(99,102,241,.15);
  --quote-shadow: 0 26px 60px rgba(0,0,0,.55);
  --quote-field-bg: rgba(255,255,255,.05);
  --placeholder-color: rgba(226,232,240,.65);
  --placeholder-strong-color: rgba(226,232,240,.4);
}

/* ============= 2) LOGIN / AUTENTICAÇÃO ============= */
.auth-body {
  background: #f8f9fa;
  background-image:
    linear-gradient(135deg, #6610f21a 0%, #0d6efd1a 100%),
    radial-gradient(circle at top left, #fff, #fff 2px, transparent 2.5px),
    radial-gradient(circle at bottom right, #fff, #fff 2px, transparent 2.5px);
  background-size: 100% 100%, 25px 25px, 25px 25px;
}
.auth-wrap { min-height: 100vh; }

.auth-right {
  position: relative;
  min-height: 100%;
  background-image:
    linear-gradient(135deg, rgba(13,110,253,.18), rgba(102,16,242,.18)),
    var(--auth-bg-img);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-left: 1px solid var(--bs-border-color);
}

.auth-card {
  background: var(--bs-body-bg);
  padding: 2.5rem;
  border-radius: 1rem;
  box-shadow: var(--of-paper-shadow);
  border: 1px solid var(--bs-border-color);
}

.password-wrapper { position: relative; }
.password-toggle {
  position: absolute;
  top: 50%; right: 12px;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--bs-secondary-color);
}

/* ============= 3) LAYOUT (SIDEBAR / TOPBAR / CONTENT) ============= */
.of-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--of-sidebar-w);
  background: var(--of-sidebar-bg);
  color: var(--of-sidebar-fg);
  box-shadow: 0 0 12px rgba(0,0,0,.15);
  z-index: 1040;
}
.of-sidebar .of-sidebar-header,
.of-sidebar .of-sidebar-footer {
  border-color: var(--of-sidebar-border) !important;
}

.of-link {
  color: var(--of-sidebar-link);
  padding: .6rem .85rem;
  border-radius: .5rem;
  margin: .15rem .25rem;
  transition: all .2s ease-in-out;
  font-weight: 500;
}
.of-link:hover { background: var(--of-sidebar-link-hover-bg); color: #fff; }
.of-link.active { background: var(--of-sidebar-active-bg); color: var(--of-sidebar-active-fg); font-weight: 600; }

.of-content {
  margin-left: var(--of-sidebar-w);
  min-height: 100vh;
  background-color: var(--of-content-bg);
  transition: background-color .3s;
}
.of-topbar {
  height: 56px;
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
  position: sticky; top: 0; z-index: 1020;
  transition: background-color .3s, border-color .3s;
  box-shadow: 0 2px 6px rgba(15,23,42,.05);
}
[data-bs-theme="dark"] .of-topbar {
  background: rgba(19,22,29, .97);
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

/* Sidebar responsiva */
@media (max-width: 992px) {
  .of-content { margin-left: 0; }
  .of-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.of-menu-open .of-sidebar { transform: translateX(0); }
  body.of-menu-open::after {
    content: ""; position: fixed; inset: 0;
    background: rgba(0,0,0,.35); z-index: 1030;
  }
}

/* ============= 4) QUOTE / CARDS / TABELAS ============= */
.quote-paper {
  background: var(--quote-card-bg);
  border: 1px solid var(--quote-card-border);
  border-radius: 1.25rem;
  box-shadow: var(--quote-shadow);
  position: relative;
  overflow: hidden;
}
.quote-paper::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at top right, rgba(99,102,241,.18), transparent 46%);
  opacity: .7;
}

.quote-paper::after {
  content: "";
  position: absolute;
  inset: 1.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(255,255,255,.6);
  opacity: .35;
  pointer-events: none;
}

.quote-head {
  padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--quote-card-border);
  background: var(--quote-head-gradient);
  position: relative;
  z-index: 1;
}
.quote-body {
  padding: 1.5rem 1.75rem 2rem;
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, rgba(249,250,251,.8), rgba(255,255,255,.4));
}
[data-bs-theme="dark"] .quote-body {
  background: linear-gradient(180deg, rgba(18,19,23,.9), rgba(15,15,25,.6));
}

.quote-title { letter-spacing: .12em; font-weight: 700; font-size: .95rem; color: var(--quote-head-text); }
.quote-total { font-weight: 800; font-size: 1.9rem; color: var(--bs-primary); text-shadow: 0 6px 14px rgba(13,110,253,.25); }
.quote-grid .form-label { font-size: .78rem; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: .05em; }

.quote-grid .form-control,
.quote-grid .form-select,
.quote-grid textarea {
  background-color: var(--quote-field-bg);
  border: 1px solid rgba(148,163,184,.35);
  border-radius: .85rem;
  padding-block: .65rem;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.quote-grid .form-control:focus,
.quote-grid .form-select:focus,
.quote-grid textarea:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,.18);
  transform: translateY(-1px);
  background-color: #fff;
}

.quote-table thead th {
  background: rgba(15,23,42,.03);
  border-bottom: 1px solid var(--quote-card-border);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--bs-secondary-color);
}
.quote-table tfoot th {
  font-size: 1rem;
  background: rgba(15,23,42,.03);
  border-top: 1px solid var(--bs-border-color);
}
.quote-table tbody tr:hover {
  background-color: var(--quote-row-hover);
  transition: background-color .2s ease;
}

.glass-chip {
  background: rgba(255,255,255,.65);
  padding: .35rem .75rem;
  border-radius: 999px;
  font-size: .68rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--quote-chip-color);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(99,102,241,.25);
}
[data-bs-theme="dark"] .glass-chip {
  background: rgba(16,18,28,.6);
  border-color: rgba(182,198,255,.25);
}

.quote-subtitle {
  font-size: .8rem;
  color: var(--placeholder-color);
  letter-spacing: .04em;
}

.quote-section-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148,163,184,.45), transparent);
  margin: 2rem 0 1.2rem;
}

.quote-ghost-input {
  border-radius: .75rem;
  border: 1px dashed rgba(148,163,184,.5);
  background: rgba(255,255,255,.6);
  color: #475467;
}
[data-bs-theme="dark"] .quote-ghost-input {
  background: rgba(255,255,255,.03);
  color: rgba(226,232,240,.85);
}

/* Placeholders mais suaves */
::placeholder {
  color: var(--placeholder-color) !important;
  opacity: 1;
}

.quote-grid input::placeholder,
.quote-grid textarea::placeholder {
  color: var(--placeholder-color);
}

input::placeholder {
  font-weight: 500;
  letter-spacing: .01em;
}

.quote-body input,
.quote-body textarea {
  font-size: .95rem;
  color: var(--bs-body-color);
}

/* Inputs coerentes com tema */
.input-group-text {
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}

/* ============= 5) LOGO / UPLOAD BOX ============= */
.logo-box {
  width: 100%;
  max-width: var(--logo-w);
  aspect-ratio: 3 / 4;
  border: 2px dashed var(--of-logo-border);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: block;
  transition: .15s ease-in-out;
  margin-inline: auto;
  background: var(--of-logo-bg);
}
.logo-box:hover { border-color: rgba(148,163,184,.8); }
.logo-box.dragover { border-color: #0d6efd; background: #e7f1ff; }

.logo-box img {
  width: 100%; height: 100%;
  object-fit: contain;
  background: transparent;  /* respeita transparência */
}
.logo-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 6px;
  color: #94a3b8; font-weight: 600; user-select: none;
}
.logo-placeholder i { font-size: 30px; opacity: .7; }
.logo-actions { width: 100%; max-width: var(--logo-w); margin-inline: auto; }
.logo-actions .btn { padding: .35rem .5rem; font-size: .85rem; }
.sticky-box { position: sticky; top: 10px; }

/* ============= 6) BANNER DEMO (OPCIONAL) ============= */
.banner-area { background: linear-gradient(135deg, #007bff, #0056b3); min-height: 100vh; }
.banner-content img { max-width: 80%; }
.banner-content h1, .banner-content p { color: #fff; text-shadow: 1px 1px 3px rgba(0,0,0,.5); }
.banner-content .lead {
  font-size: 1.5rem; color: #ffc107; padding: 5px;
  border: 2px solid #ffc107; display: inline-block; border-radius: 5px;
}

/* ============= 7) UTILITÁRIOS / AJUSTES ============= */
#btnNewProduct { width: 100%; }
.ta-compact { height: calc(2.25rem + 2px); resize: vertical; }

.of-actions-footer {
  position: sticky; bottom: 0;
  background-color: var(--bs-body-bg);
  padding: .75rem 1rem;
  border-top: 1px solid var(--bs-border-color);
  box-shadow: 0 -4px 12px rgba(0,0,0,.05);
  transition: background-color .3s, border-color .3s;
  z-index: 100;
}
[data-bs-theme="dark"] .of-actions-footer { box-shadow: 0 -4px 12px rgba(0,0,0,.2); }
.of-actions-footer > div {
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
}
.card:last-of-type { margin-bottom: 120px !important; } /* espaço p/ não cobrir conteúdo */

.loading-overlay {
  position: absolute; inset: 0;
  background-color: rgba(255,255,255,.7);
  z-index: 10; display: flex; align-items: center; justify-content: center;
  border-radius: var(--bs-card-inner-border-radius);
}
[data-bs-theme="dark"] .loading-overlay { background-color: rgba(33,37,41,.7); }

@keyframes flash-success-anim { from { background-color:#d1e7dd; } to { background-color:transparent; } }
@keyframes flash-error-anim   { from { background-color:#f8d7da; } to { background-color:transparent; } }
.flash-success { animation: flash-success-anim 1.2s ease-out; }
.flash-error   { animation: flash-error-anim   1.2s ease-out; }

/* ============= 8) RESPONSIVO ============= */
@media (min-width: 576px) { .logo-box { max-width: 150px; } }
@media (min-width: 768px) {
  #btnNewProduct { width: auto; max-width: 180px; }
  .w-md-auto { width: auto !important; }
  .of-actions-footer { padding: 1rem 1.5rem; }
}
@media (min-width: 992px)   { :root { --logo-w: 160px; } .logo-box { max-width: 160px; } }
@media (min-width: 1200px)  {
  :root { --logo-w: 170px; }
  .logo-box { max-width: 170px; }
  .col-xl-8 { flex: 0 0 auto; width: 68%; }
  .col-xl-4 { flex: 0 0 auto; width: 32%; }
}
@media (min-width: 1400px)  { .logo-box { max-width: 180px; } }

/* ============= 9) COMPLEMENTOS DARK ============= */
[data-bs-theme="dark"] {
  .form-control,
  .form-select,
  .input-group-text {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color-translucent);
  }

  .form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
  }

  .table {
    color: var(--bs-body-color);
    --bs-table-bg: var(--bs-body-bg);
  }
  .table > :not(caption) > * > * { background-color: var(--bs-table-bg); }
  .table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-bg-type: var(--bs-tertiary-bg); }

  .badge.text-bg-light {
    color: var(--bs-light) !important;
    background-color: var(--bs-secondary-bg) !important;
    border-color: var(--bs-border-color) !important;
  }
}
