/* =========================================================
   AutoGestão - Estilos Globais (versão compatível com Tailwind CDN)
   ========================================================= */

/* ===== Tipografia e Layout Base ===== */
html {
  scroll-behavior: smooth;
}

body {
  background-color: #f9fafb; /* gray-50 */
  color: #1f2937; /* gray-800 */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 {
  font-weight: 700;
  color: #111827; /* gray-900 */
}

/* ===== Sidebar ===== */
.sidebar {
  background: linear-gradient(180deg, #1e40af 0%, #3730a3 100%);
  color: #fff;
}
.sidebar a {
  color: #e0e7ff;
}
.sidebar a:hover {
  color: #fff;
}

/* ===== Cards e tabelas ===== */
.dashboard-card {
  transition: all 0.3s ease;
}
.dashboard-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
              0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

table {
  border-collapse: collapse;
  width: 100%;
}
th {
  text-transform: uppercase;
  font-weight: 600;
  color: #4b5563; /* gray-600 */
  background-color: #f9fafb;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}
td, th {
  border-bottom: 1px solid #f1f5f9; /* gray-100 */
  padding: 0.75rem 1rem;
}
tbody tr:hover {
  background-color: #f8fafc; /* gray-50 */
}

/* ===== Inputs, Selects e Textareas ===== */
input[type="text"],
input[type="email"],
input[type="number"],
textarea,
select {
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  width: 100%;
}
input:focus,
textarea:focus,
select:focus {
  border-color: #2563eb; /* blue-600 */
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
  outline: none;
}

/* ===== Botões ===== */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background-color: #2563eb;
  color: #fff;
}
.btn-primary:hover {
  background-color: #1d4ed8;
}
.btn-secondary {
  background-color: #e5e7eb;
  color: #374151;
}
.btn-secondary:hover {
  background-color: #d1d5db;
}
.btn-danger {
  background-color: #dc2626;
  color: #fff;
}
.btn-danger:hover {
  background-color: #b91c1c;
}

/* ===== Efeito Ripple nos Botões ===== */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  animation: ripple 0.6s linear;
  transform: scale(0);
  pointer-events: none;
}
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}
::-webkit-scrollbar-track {
  background: #f3f4f6;
}

/* ===== Modais ===== */
#orcamentoModal,
#clienteModal {
  backdrop-filter: blur(3px);
}

/* ===== Toasts ===== */
#toastContainer, #toast-container {
  pointer-events: none;
}
.toast {
  opacity: 0;
  transform: translateY(20px);
  animation: toastIn 0.3s ease-out forwards;
  pointer-events: all;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Animações ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

/* ===== Cards, sombras e detalhes ===== */
.shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.shadow { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.shadow-md { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 10px 15px rgba(0, 0, 0, 0.15); }

/* ===== Scrollbars da Sidebar ===== */
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

/* ===== Tabelas internas (ex: modal de itens) ===== */
.modal-table thead th {
  font-size: 0.85rem;
}
.modal-table tbody td {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

/* ===== Suavização de seções ===== */
section + section {
  margin-top: 2rem;
}

/* =========================================================
   Dark Mode
   ========================================================= */

body.dark {
  background-color: #0f172a; /* slate-900 */
  color: #e2e8f0; /* slate-200 */
}

body.dark h1, 
body.dark h2, 
body.dark h3, 
body.dark h4, 
body.dark h5 {
  color: #f8fafc;
}


body.dark .text-gray-600 { color: #cbd5e1 !important; }
body.dark .text-gray-500 { color: #94a3b8 !important; }

body.dark .border-gray-100 { border-color: #475569 !important; }
body.dark .bg-gray-50 { background-color: #1e293b !important; }

body.dark table th {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
}
body.dark table td, 
body.dark table th {
  border-color: #334155 !important;
}

body.dark tbody tr:hover {
  background-color: #334155 !important;
}

body.dark .sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
}

body.dark .btn-primary {
  background-color: #3b82f6;
}
body.dark .btn-secondary {
  background-color: #475569;
  color: #e2e8f0;
}
body.dark .btn-secondary:hover {
  background-color: #64748b;
}
body.dark .bg-blue-600 {
  background-color: #2563eb !important;
}

body.dark .shadow, 
body.dark .shadow-sm, 
body.dark .shadow-md {
  box-shadow: none;
}

/* Toasts no modo escuro */
body.dark #toastContainer .toast {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #334155;
}

.sidebar button {
  background: linear-gradient(90deg, #1e3a8a 0%, #2563eb 100%);
}

@media (max-width: 640px) {
  table th, table td { padding: 0.5rem 0.75rem; font-size: 0.85rem; }
}

.status-pago {
  background-color: #dcfce7;
  color: #166534;
  transition: all 0.3s ease;
}

html.dark body {
  background-color: #111827;
  color: #e5e7eb;
}

html.dark .bg-white {
  background-color: #1f2937 !important;
  color: #e5e7eb !important;
}

html.dark .text-gray-700, 
html.dark .text-gray-800 {
  color: #d1d5db !important;
}

/* ============================== */
/* Modo escuro refinado */
/* ============================== */
body.dark {
  background-color: #111827;
  color: #e5e7eb;
}

body.dark .bg-white {
  background-color: #1f2937 !important;
  color: #e5e7eb !important;
}

body.dark .text-gray-700,
body.dark .text-gray-800 {
  color: #d1d5db !important;
}

body.dark .border-gray-200 {
  border-color: #374151 !important;
}

body.dark .hover\\:bg-gray-50:hover {
  background-color: #1f2937 !important;
}

.fade-in {
  animation: fadeIn 0.25s ease-in-out forwards;
}
.fade-out {
  animation: fadeOut 0.25s ease-in-out forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes fadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.98); }
}
