/* Estilo Global */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #132744;
  --primary-dark: #0d1a2d;
  --primary-light: #1e3a5f;
  --secondary: #00a86b;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --light: #f8f9fa;
  --dark: #343a40;
  --white: #ffffff;
  --gray: #6c757d;
  --gray-light: #e9ecef;
  --border-radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(19, 39, 68, 0.2);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.container {
  max-width: 100%;
  padding: 10px;
  margin: 0 auto;
  animation: slideUp 0.6s ease-out;
}

/* Container mais ampuro para tela de pedido */
body.pedido .container {
  padding: 5px 10px;
}

body.pedido .card {
  margin-bottom: 10px;
  padding: 15px;
}

@keyframes slideUp {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

.header-title {
  font-size: 20px;
  font-weight: 600;
}

.header-user {
  font-size: 14px;
  opacity: 0.9;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  transition: left 0.5s;
}

.card:hover::before {
  left: 100%;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 10px;
}

.card-value {
  font-size: 28px;
  font-weight: bold;
  color: var(--primary);
  animation: countUp 1s ease-out;
}

@keyframes countUp {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Botões */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(19, 39, 68, 0.3);
}

.btn-secondary {
  background: var(--gray);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 10px;
  border-radius: 50%;
}

/* Formulários */
.form-group {
  margin-bottom: 12px;
  animation: fadeInLeft 0.5s ease-out;
}

/* Formulário mais compacto na tela de pedido */
body.pedido .form-group {
  margin-bottom: 10px;
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.form-label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark);
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 15px;
  transition: all 0.3s;
}

/* Form controls menores no pedido */
body.pedido .form-control {
  padding: 8px;
  font-size: 14px;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 39, 68, 0.1);
  transform: scale(1.02);
}

/* Abas */
.tabs {
  display: flex;
  background: white;
  overflow-x: auto;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  width: 100%;
}

.tab {
  flex: 1;
  padding: 12px 20px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--gray);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab i {
  font-size: 16px;
}


.tab:hover {
  color: var(--primary);
  background: rgba(19, 39, 68, 0.05);
}

.tab.active {
  color: var(--primary);
  background: rgba(19, 39, 68, 0.1);
  font-weight: 600;
}

/* Tab content mais fluido */
.tab-content {
  display: none;
  padding: 15px;
  background: white;
  animation: fadeIn 0.4s ease-out;
}

body.pedido .tab-content {
  padding: 10px;
}


.tab-content.active {
  display: block;
}

/* Lista de Pedidos */
.pedido-list {
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.pedido-item {
  padding: 15px;
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.pedido-item::before {
  content: '';
  position: absolute;
  left: -100%;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
  transition: left 0.3s;
}

.pedido-item:hover::before {
  left: 0;
}

.pedido-item:hover {
  background: #f8f9fa;
  padding-left: 25px;
}

.pedido-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pedido-number {
  font-weight: 600;
  color: var(--primary);
}

.pedido-status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-digitacao {
  background: #e3f2fd;
  color: #1976d2;
}

.status-separacao {
  background: #fff3e0;
  color: #f57c00;
}

.status-offline {
  background: #fce4ec;
  color: #c2185b;
}

/* Novos status de pedido */
.status-aberto {
  background: #e3f2fd;
  color: #1976d2;
}

.status-faturado {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-cancelado {
  background: #ffebee;
  color: #c62828;
}

.status-andamento {
  background: #fff3e0;
  color: #f57c00;
}

/* Produtos Grid - Padrão Força de Vendas */
.produtos-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}

.produto-row {
  background: white;
  width: 100%;
  padding: 15px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.produto-row:hover {
  background: #f8f9fa;
  border-left: 4px solid var(--primary);
  padding-left: 11px; /* Compensa a borda */
}

.produto-row:last-child {
  border-bottom: none;
}

/* Imagem do produto - compacta */
.produto-row .produto-img {
  width: 50px;
  height: 50px;
  background: #f0f0f0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #999;
  flex-shrink: 0;
  transition: all 0.2s;
}

/* Informações do produto */
.produto-info {
  flex: 1;
  min-width: 0;
}

.produto-nome {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.produto-detalhes {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.produto-detalhe {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.produto-detalhe i {
  font-size: 12px;
  opacity: 0.7;
}

.produto-preco {
  font-size: 15px;
  font-weight: bold;
  color: var(--primary);
}

/* Ações do produto */
.produto-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.produto-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--gray);
}

.produto-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.05);
}

.produto-btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.produto-btn.primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* Botão adicionar (mais destacado) */
.produto-btn.add {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.produto-btn.add:hover {
  background: #218838;
  border-color: #218838;
}

/* Responsivo */
@media (max-width: 480px) {
  .produto-detalhes {
    gap: 10px;
  }

  .produto-detalhe span {
    font-size: 12px;
  }

  .produto-actions {
    gap: 6px;
  }

  .produto-btn {
    width: 32px;
    height: 32px;
  }
}

/* Footer Fixo */
.footer-fixed {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 15px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 100;
  animation: slideUp 0.5s ease-out;
}

/* Menu Lateral - Hover Effects */
#sideMenu .modal-content a:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
}

#sideMenu .modal-content a {
  position: relative;
  overflow: hidden;
}

#sideMenu .modal-content a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  transition: left 0.5s;
}

#sideMenu .modal-content a:hover::before {
  left: 100%;
}

/* Footer do pedido sem margens */
body.pedido .footer-fixed {
  padding: 15px 0;
  margin: 0;
  width: 100%;
}

body.pedido .footer-fixed > div {
  padding: 0 15px;
}

.footer-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.total-label {
  font-weight: 500;
}

.total-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  padding: 0;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.3s;
}

/* Modal Fullscreen - especifico para consulta */
.modal.fullscreen {
  align-items: stretch;
  justify-content: stretch;
}

/* Modal fullscreen para consulta de produto */
#consultaProdutoModal.fullscreen .modal-content {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Modal fullscreen para novo cliente */
#novoClienteModal.fullscreen .modal-content {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.3s;
}

.modal-content {
  background: white;
  border-radius: var(--border-radius);
  padding: 30px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  animation: modalSlide 0.3s ease-out;
}

/* Modal de cliente - fullscreen no mobile */
#clienteModal .modal-content {
  width: 100%;
  max-width: 100%;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  margin: 0;
  padding: 20px;
}

@media (max-width: 768px) {
  #clienteModal .modal-content {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(50px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
}

/* Filtros */
.filtros {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.filtro-btn {
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: white;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s;
}

.filtro-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.filtro-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border-color: var(--primary);
}

/* Offline Banner */
.offline-banner {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  color: white;
  padding: 10px;
  text-align: center;
  display: none;
  animation: slideDown 0.5s ease-out;
}

.offline-banner.active {
  display: block;
}

/* Loading Spinner */
.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-top: 20px;
}

.quick-action {
  background: white;
  border-radius: var(--border-radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.quick-action::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.quick-action:hover::before {
  opacity: 0.1;
}

.quick-action:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.quick-action-icon {
  font-size: 32px;
  margin-bottom: 8px;
  color: var(--primary);
  transition: all 0.3s;
}

.quick-action:hover .quick-action-icon {
  transform: scale(1.2);
}

.quick-action-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--dark);
}

/* Badge */
.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger);
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: bold;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 10px 30px rgba(19, 39, 68, 0.4);
}

.fab:active {
  transform: scale(0.95);
}

/* Classes Bootstrap-like */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -15px;
  margin-left: -15px;
}

.col-12 {
  flex: 0 0 100%;
  max-width: 100%;
  padding-right: 15px;
  padding-left: 15px;
}

.d-flex {
  display: flex !important;
}

.justify-content-between {
  justify-content: space-between !important;
}

.align-items-start {
  align-items: flex-start !important;
}

.flex-grow-1 {
  flex-grow: 1 !important;
}

.text-end {
  text-align: right !important;
}

.fw-bold {
  font-weight: 700 !important;
}

.text-primary {
  color: var(--primary) !important;
}

.text-muted {
  color: var(--gray) !important;
}

.small {
  font-size: 0.875em !important;
}

.mt-1 {
  margin-top: 0.25rem !important;
}

.mb-2 {
  margin-bottom: 0.5rem !important;
}

.badge {
  display: inline-block;
  padding: 0.25em 0.4em;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25rem;
}

/* Pedido row hover effect */
.pedido-row:hover {
  background: #f8f9fa !important;
}

/* Responsive */
@media (max-width: 480px) {
  .header-title {
    font-size: 18px;
  }

  .card-value {
    font-size: 24px;
  }

  .produtos-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .container {
    padding: 10px;
  }

  /* Dashboard Mobile */
  body.dashboard .card {
    margin-bottom: 15px;
    padding: 15px;
  }

  /* Gráfico Mobile */
  .chart-container {
    position: relative;
    height: 280px;
    width: 100%;
    min-height: 280px;
  }

  #vendasChart {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
  }

  /* Títulos das seções */
  .card h3 {
    font-size: 16px !important;
    margin-bottom: 10px !important;
  }

  /* Cards de resumo */
  .card .card-title {
    font-size: 13px !important;
    margin-bottom: 3px;
  }

  .card .card-value {
    font-size: 20px !important;
  }

  /* Progress bar mobile */
  .card #progressBar {
    height: 6px !important;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .container {
    padding: 5px;
  }

  body.dashboard .card {
    padding: 12px;
    margin-bottom: 12px;
  }

  .card h3 {
    font-size: 15px !important;
  }

  .chart-container {
    height: 200px !important;
    min-height: 200px !important;
  }
}