/* ================================================================
   FECEJ 2026 — Global Stylesheet
   ================================================================ */

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

:root {
  --blue-900: #1e3a8a;
  --blue-800: #1e40af;
  --blue-600: #2563eb;
  --blue-400: #60a5fa;
  --blue-50:  #eff6ff;

  --purple-700: #6d28d9;
  --purple-600: #7c3aed;

  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-50:  #f0fdf4;

  --amber-500: #f59e0b;
  --red-500:   #ef4444;
  --red-50:    #fef2f2;

  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50:  #f8fafc;
  --white:     #ffffff;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,.1);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12);
  --shadow-xl:  0 20px 50px rgba(0,0,0,.15);
  --shadow-glow: 0 0 0 3px rgba(37,99,235,.2);

  --transition: .2s ease;
  --transition-slow: .35s ease;

  --font: 'Inter', 'Segoe UI', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--slate-100);
  color: var(--slate-800);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── PARTÍCULAS ── */
.particles { display: none !important; }
.particle {
  position: absolute;
  border-radius: 50%;
  opacity: .12;
  animation: floatParticle linear infinite;
}
@keyframes floatParticle {
  0%   { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10%  { opacity: .12; }
  90%  { opacity: .12; }
  100% { transform: translateY(-150px) rotate(720deg); opacity: 0; }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--slate-100); }
::-webkit-scrollbar-thumb { background: var(--blue-400); border-radius: 3px; }

/* ── CONTAINER ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ================================================================
   SITE HEADER
   ================================================================ */
.site-header {
  background: linear-gradient(135deg, var(--blue-900) 0%, var(--purple-700) 100%);
  color: var(--white);
  padding: 24px 0;
  position: relative;
  z-index: 10;
  box-shadow: var(--shadow-lg);
}
.site-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  position: relative; z-index: 1;
}
.header-brand { display: flex; align-items: center; gap: 18px; }
.brand-icon {
  width: 65px; height: 65px;
  background: rgba(30, 27, 75, 0.6);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  color: #c084fc;
  border: 2px solid rgba(192, 132, 252, 0.4);
  box-shadow: 0 0 24px rgba(192, 132, 252, 0.35);
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}
.brand-text h1 {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.2px;
}
.brand-sub {
  font-size: .85rem;
  opacity: .85;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-admin {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  background: rgba(255,255,255,.12);
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,.3);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
.btn-admin:hover {
  background: rgba(255,255,255,.22);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,.2);
}

/* ── HERO BAR ── */
.hero-bar {
  background: linear-gradient(90deg, var(--blue-800) 0%, var(--blue-600) 100%);
  padding: 16px 0;
  position: relative; z-index: 9;
}
.hero-inner {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  color: var(--white);
  font-size: .9rem;
  opacity: .95;
}
.hero-badge {
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.3);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .3px;
  display: flex; align-items: center; gap: 6px;
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main-content { padding: 36px 24px 48px; position: relative; z-index: 5; }
.form-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ── FORM SECTION ── */
.form-section {
  padding: 36px 40px;
  border-bottom: 1px solid var(--slate-200);
  position: relative;
}
.form-section:last-of-type { border-bottom: none; }
.section-header {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 28px;
}
.section-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--blue-800), var(--blue-600));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--white);
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
}
.section-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--slate-800);
}
.section-desc { font-size: .85rem; color: var(--slate-500, #64748b); margin-top: 2px; }

/* ── FORM ROWS ── */
.form-row { display: grid; gap: 20px; margin-bottom: 20px; }
.form-row.cols-top { grid-template-columns: 2fr 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: repeat(3,1fr); }
.form-row.cols-2 { grid-template-columns: repeat(2,1fr); }
.form-row.full-width .form-group { grid-column: 1/-1; }
.form-group { display: flex; flex-direction: column; }
.form-group.full-width { grid-column: 1/-1; }

label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 8px;
  display: block;
}
.req { color: var(--red-500); margin-left: 2px; }

/* ── INPUTS ── */
.input-wrap { position: relative; }
.input-wrap .input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--slate-400); font-size: .9rem; pointer-events: none;
}
.input-wrap input { padding-left: 40px; }

input[type=text], input[type=email], input[type=tel],
input[type=number], textarea, select {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-md);
  font-size: .93rem;
  font-family: var(--font);
  color: var(--slate-800);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: var(--shadow-glow);
}
input.error, select.error, textarea.error {
  border-color: var(--red-500);
  box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}
textarea { resize: vertical; min-height: 90px; }
small {
  font-size: .78rem;
  color: var(--slate-400);
  margin-top: 5px;
  display: flex; align-items: center; gap: 5px;
}

/* SELECT */
.select-wrap { position: relative; }
.select-arrow {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--slate-400); font-size: .8rem; pointer-events: none;
}
.select-wrap select { padding-right: 36px; }

/* ── TOGGLE SIM/NÃO ── */
.toggle-group { display: flex; gap: 12px; margin-top: 2px; }
.toggle-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px;
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--slate-600);
  font-size: .9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.toggle-btn:hover { border-color: var(--blue-600); color: var(--blue-800); }
.toggle-btn.active {
  background: linear-gradient(135deg, var(--blue-800), var(--blue-600));
  border-color: var(--blue-600);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
}
.toggle-btn.toggle-no.active {
  background: linear-gradient(135deg, #dc2626, var(--red-500));
  border-color: var(--red-500);
  box-shadow: 0 4px 12px rgba(239,68,68,.25);
}

/* ── TABLES ── */
.table-responsive { overflow-x: auto; margin-bottom: 16px; border-radius: var(--radius-md); border: 1.5px solid var(--slate-200); }
.data-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.data-table thead th {
  background: var(--slate-50);
  padding: 12px 14px;
  text-align: left;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--slate-500, #64748b);
  border-bottom: 2px solid var(--slate-200);
}
.data-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--blue-50); }
.data-table input, .data-table select {
  padding: 8px 10px;
  font-size: .88rem;
  border-radius: var(--radius-sm);
}
.col-num  { width: 52px; text-align: center; }
.col-action { width: 70px; text-align: center; }
.col-qty  { width: 80px; }
.col-price { width: 120px; }
.col-total { width: 110px; }
.num-cell {
  font-weight: 700; color: var(--blue-600);
  text-align: center; font-size: .95rem;
}
.cost-total { font-weight: 600; color: var(--green-600); }

/* GRAND TOTAL */
.grand-total-row { background: var(--blue-50); }
.grand-total-row td { padding: 12px 14px; font-size: .9rem; }
.text-right { text-align: right; }
.grand-total-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--green-600);
}

/* COSTS AREA */
.costs-area {
  margin-top: 20px;
  padding: 24px;
  background: var(--slate-50);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--slate-200);
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:none} }

/* ADD ROW BUTTON */
.btn-add-row {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  background: var(--white);
  border: 2px solid var(--blue-600);
  color: var(--blue-800);
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-add-row:hover {
  background: var(--blue-800);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30,64,175,.3);
}

/* DELETE BUTTON */
.btn-icon-del {
  background: none; border: none;
  color: var(--slate-400);
  cursor: pointer; padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-size: 1rem;
}
.btn-icon-del:hover { color: var(--red-500); background: var(--red-50); }

/* ── CHECKBOXES ── */
.check-label {
  display: flex; align-items: flex-start; gap: 14px;
  cursor: pointer; padding: 18px 22px;
  background: var(--white);
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  transition: all var(--transition);
  font-size: .95rem; color: #1e293b;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.check-label:hover { border-color: #2563eb; background: #eff6ff; }
.check-label input[type=checkbox] { display: none; }
.check-box {
  width: 26px; height: 26px; flex-shrink: 0; margin-top: 1px;
  border: 2.5px solid #64748b;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  background: var(--white);
}
.check-label input:checked ~ .check-box {
  background: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37,99,235,.2);
}
.check-label input:checked ~ .check-box::after {
  content: '✓';
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 800;
}
.check-label input:checked ~ span:last-child { color: #1e40af; font-weight: 600; }

/* ── FORM ACTIONS ── */
.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 18px 32px;
  background: var(--slate-50);
  border-top: 2px solid var(--slate-200);
  flex-wrap: wrap;
}

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--blue-900), var(--blue-600));
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-size: .88rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 3px 10px rgba(37,99,235,.28);
  white-space: nowrap;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37,99,235,.38);
}
.btn-primary:disabled { opacity: .65; cursor: not-allowed; }

.btn-submit-full {
  flex: 0 0 auto;
  justify-content: center;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  border-radius: var(--radius-md);
  padding: 10px 24px;
  font-size: .9rem;
  font-weight: 600;
}
.btn-submit-full:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
}

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  background: var(--white);
  color: var(--slate-600);
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-md);
  font-size: .88rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover { background: var(--slate-100); border-color: var(--slate-300); }

/* ================================================================
   FOOTER
   ================================================================ */
.site-footer {
  background: var(--slate-900);
  color: var(--slate-400);
  padding: 30px 0;
  margin-top: auto;
  position: relative; z-index: 5;
}
.footer-inner { text-align: center; font-size: .875rem; line-height: 2; }
.footer-brand {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--white); font-size: 1rem; font-weight: 700;
  margin-bottom: 4px;
}
.footer-brand i { color: var(--blue-400); }
.footer-dev strong { color: var(--slate-200); }

/* ================================================================
   MODAIS
   ================================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.7);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeOverlay .2s ease;
}
@keyframes fadeOverlay { from{opacity:0} to{opacity:1} }

.modal-box {
  background: var(--white);
  border-radius: var(--radius-xl);
  max-width: 480px; width: 100%;
  box-shadow: var(--shadow-xl);
  text-align: center;
  padding: 44px 36px;
  animation: slideModal .25s ease;
}
@keyframes slideModal { from{transform:scale(.9) translateY(20px)} to{transform:none} }

.modal-success-icon {
  font-size: 4rem; color: var(--green-500);
  margin-bottom: 16px;
  animation: popIn .4s cubic-bezier(.68,-.55,.27,1.55);
}
@keyframes popIn { 0%{transform:scale(0)} 60%{transform:scale(1.15)} 100%{transform:scale(1)} }

.modal-alert-icon {
  font-size: 3.5rem; color: var(--amber-500); margin-bottom: 16px;
}

.modal-box h3 { font-size: 1.4rem; font-weight: 700; color: var(--slate-800); margin-bottom: 8px; }
.modal-lead { color: var(--slate-500, #64748b); font-size: .95rem; margin-bottom: 20px; }

.modal-num-box {
  background: var(--blue-50);
  border: 2px solid var(--blue-200, #bfdbfe);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.modal-num-label {
  display: block; font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--blue-600); margin-bottom: 4px;
}
.modal-num {
  display: block; font-size: 1.1rem; font-weight: 800;
  color: var(--blue-900); letter-spacing: .5px;
}
.modal-hint { font-size: .8rem; color: var(--slate-400); margin-bottom: 24px; }
.modal-btn { width: 100%; justify-content: center; margin-top: 4px; }

/* ALERT BOX */
.alert-box { padding: 40px 32px; }
.alert-box h3 { font-size: 1.2rem; }
.alert-box p { color: var(--slate-600); margin: 12px 0 24px; font-size: .93rem; }

/* ── LOADING OVERLAY ── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.92);
  display: none; align-items: center; justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}
.loading-box {
  text-align: center;
  color: var(--slate-600);
  font-weight: 500;
  font-size: .95rem;
}

/* ── LOADER RING ── */
.loader-ring {
  width: 50px; height: 50px;
  border: 4px solid var(--slate-200);
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   PRINT STYLES (relatório PDF)
   ================================================================ */
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  /* estilos de impressão definidos no admin.css */
}

/* ================================================================
   RESPONSIVO
   ================================================================ */
@media (max-width: 900px) {
  .form-row.cols-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .form-section { padding: 24px 20px; }
  .form-actions { padding: 20px; flex-direction: column; }
  .btn-primary, .btn-secondary { width: 100%; justify-content: center; }
  .form-row.cols-3, .form-row.cols-2 { grid-template-columns: 1fr; }
  .brand-icon { display: none; }
  .brand-text h1 { font-size: .95rem; }
  .hero-inner p { display: none; }
}
