/* GastroCloud - Estilos Globais */

:root {
  /* Light Mode Colors */
  --color-background: #f9fafb;
  --color-surface: #ffffff;
  --color-text-primary: #1f2937;
  --color-text-secondary: #6b7280;
  --color-border: #e5e7eb;
  --color-primary: #D35400;
  --color-primary-hover: #A84300;
  
  /* Dark Mode Colors - Melhor contraste */
  --dark-background: #0a0a0a;
  --dark-surface: #1a1a1a;
  --dark-surface-hover: #2a2a2a;
  --dark-text-primary: #ffffff;
  --dark-text-secondary: #e0e0e0;
  --dark-border: #333333;
  --dark-accent: #f97316;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark Mode Styles */
body.dark {
  background-color: var(--dark-background);
  color: var(--dark-text-primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

body.dark ::-webkit-scrollbar-track {
  background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
  background: #E2725B;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #D35400;
}

/* Loading Spinner */
.loading-spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #E2725B;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

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

/* Card Hover Effect */
.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Button Effects */
.btn-primary {
  background: linear-gradient(135deg, #E2725B 0%, #D35400 100%);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(226, 114, 91, 0.4);
}

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

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Badge Styles */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 9999px;
}

.badge-success {
  background-color: #10b981;
  color: white;
}

.badge-warning {
  background-color: #f59e0b;
  color: white;
}

.badge-danger {
  background-color: #ef4444;
  color: white;
}

.badge-info {
  background-color: #3b82f6;
  color: white;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

body.dark .modal-overlay {
  background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
  background: white;
  border-radius: 0.5rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

body.dark .modal-content {
  background: #1a1a1a;
  color: #ffffff;
  border: 1px solid #333333;
}

body.dark .modal-content h2,
body.dark .modal-content h3 {
  color: #ffffff;
}

body.dark .modal-content input,
body.dark .modal-content textarea,
body.dark .modal-content select {
  background-color: #2a2a2a;
  border-color: #444444;
  color: #ffffff;
}

body.dark .modal-content input::placeholder,
body.dark .modal-content textarea::placeholder {
  color: #888888;
}

/* Table Styles */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  background-color: #f9fafb;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #e5e7eb;
}

body.dark .table th {
  background-color: #2a2a2a;
  border-bottom-color: #444444;
  color: #ffffff;
}

.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

body.dark .table td {
  border-bottom-color: #333333;
  color: #e0e0e0;
}

.table tr:hover {
  background-color: #f9fafb;
}

body.dark .table tr:hover {
  background-color: #2a2a2a;
}

/* Dark Mode Utilities - Melhor contraste */
body.dark .bg-white {
  background-color: #1a1a1a !important;
}

body.dark .bg-gray-50 {
  background-color: #0a0a0a !important;
}

body.dark .bg-gray-100 {
  background-color: #1a1a1a !important;
}

body.dark .bg-gray-200 {
  background-color: #2a2a2a !important;
}

body.dark .text-gray-800 {
  color: #ffffff !important;
}

body.dark .text-gray-700 {
  color: #f0f0f0 !important;
}

body.dark .text-gray-600 {
  color: #e0e0e0 !important;
}

body.dark .text-gray-500 {
  color: #c0c0c0 !important;
}

body.dark .text-gray-900 {
  color: #ffffff !important;
}

body.dark .border-gray-300 {
  border-color: #444444 !important;
}

body.dark .border-gray-200 {
  border-color: #333333 !important;
}

body.dark .border-gray-700 {
  border-color: #444444 !important;
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
  transition: all 0.3s ease;
}

.dark-mode-toggle:hover {
  transform: scale(1.05);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.toast {
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s ease-out;
  background: white;
  border-left: 4px solid;
  min-width: 300px;
}

body.dark .toast {
  background: #2a2a2a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.toast-success {
  border-left-color: #10b981;
}

.toast-error {
  border-left-color: #ef4444;
}

.toast-warning {
  border-left-color: #f59e0b;
}

.toast-info {
  border-left-color: #3b82f6;
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.toast-success .toast-icon {
  color: #10b981;
}

.toast-error .toast-icon {
  color: #ef4444;
}

.toast-warning .toast-icon {
  color: #f59e0b;
}

.toast-info .toast-icon {
  color: #3b82f6;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #1f2937;
}

body.dark .toast-title {
  color: #ffffff;
}

.toast-message {
  font-size: 14px;
  color: #6b7280;
}

body.dark .toast-message {
  color: #e0e0e0;
}

.toast-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

body.dark .toast-close {
  color: #e0e0e0;
}

.toast-close:hover {
  background-color: #f3f4f6;
}

body.dark .toast-close:hover {
  background-color: #333333;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast.removing {
  animation: slideOutRight 0.3s ease-out forwards;
}

/* Badge Counters */
.badge-counter {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background: #ef4444;
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
  line-height: 1;
}

.badge-counter.hidden {
  display: none;
}

/* SweetAlert2 Dark Mode Override */
body.dark .swal2-popup {
  background: #1a1a1a !important;
  border: 1px solid #333333 !important;
}

body.dark .swal2-title {
  color: #ffffff !important;
}

body.dark .swal2-html-container {
  color: #e0e0e0 !important;
}

body.dark .swal2-confirm {
  background: #ef4444 !important;
}

body.dark .swal2-cancel {
  background: #6b7280 !important;
}

/* Responsive */
@media (max-width: 768px) {
  .modal-content {
    margin: 1rem;
  }
  
  .toast-container {
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .toast {
    min-width: auto;
  }
  
  /* Mobile-specific improvements */
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Larger touch targets for mobile */
  button {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Better text readability on mobile */
  body {
    font-size: 16px;
  }
  
  /* Improve table scrolling on mobile */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Better spacing for mobile cards */
  .gap-6 {
    gap: 1rem;
  }
  
  /* Mobile-friendly forms */
  input, textarea, select {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  /* Better modal positioning on mobile */
  .modal-overlay {
    align-items: flex-start;
    padding-top: 2rem;
  }
  
  /* Adjust FAB buttons spacing for better thumb reach */
  .fixed.bottom-6.right-4 {
    bottom: 1rem;
    right: 1rem;
  }
}

/* Landscape phone optimization */
@media (max-width: 896px) and (orientation: landscape) {
  .modal-content {
    max-height: 80vh;
  }
  
  /* Reduce header size in landscape */
  header .h-16 {
    height: 3rem;
  }
  
  /* Stack FAB buttons horizontally in landscape */
  .fixed.bottom-6.right-4 {
    flex-direction: row;
    bottom: 0.5rem;
  }
}

/* Small mobile devices */
@media (max-width: 375px) {
  .text-2xl {
    font-size: 1.25rem;
  }
  
  .text-3xl {
    font-size: 1.5rem;
  }
  
  /* Reduce padding on small devices */
  .p-6 {
    padding: 1rem;
  }
  
  .p-8 {
    padding: 1.5rem;
  }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .hover\:shadow-xl:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  }
  
  .hover\:scale-110:hover {
    transform: scale(1);
  }
  
  /* Add active states instead */
  button:active {
    transform: scale(0.95);
    opacity: 0.9;
  }
}

/* Additional Mobile Improvements */
@media (max-width: 768px) {
  /* Admin navigation horizontal scroll improvements */
  nav.flex.space-x-4 {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.3) transparent;
  }
  
  nav.flex.space-x-4::-webkit-scrollbar {
    height: 4px;
  }
  
  nav.flex.space-x-4::-webkit-scrollbar-track {
    background: transparent;
  }
  
  nav.flex.space-x-4::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 4px;
  }
  
  /* Table improvements for mobile */
  table {
    font-size: 14px;
  }
  
  table th,
  table td {
    padding: 0.75rem 0.5rem !important;
    white-space: nowrap;
  }
  
  /* Badge positioning adjustment for smaller buttons */
  .badge-counter {
    font-size: 10px;
    padding: 1px 4px;
    min-width: 18px;
    right: 4px;
  }
  
  /* Better card spacing on mobile */
  .grid.gap-6 {
    gap: 1rem;
  }
  
  /* Responsive header sizing */
  header h1 {
    font-size: 1.5rem;
  }
  
  header p.text-xs {
    font-size: 0.7rem;
  }
}

/* Tablet improvements */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
  
  table th,
  table td {
    padding: 0.875rem 1rem !important;
  }
}
