/**
 * AUTENDE - CSS Base Responsivo
 * Sistema de Gestao para Restaurantes e Delivery
 */

:root {
  --primary: #6366F1;
  --primary-dark: #4F46E5;
  --primary-light: #818CF8;
  --secondary: #8B5CF6;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --dark: #1E293B;
  --gray-900: #0F172A;
  --gray-800: #1E293B;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748B;
  --gray-400: #94A3B8;
  --gray-300: #CBD5E1;
  --gray-200: #E2E8F0;
  --gray-100: #F1F5F9;
  --gray-50: #F8FAFC;
  --white: #FFFFFF;
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.15);
  
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --transition: all 0.2s ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

/* ============================================
   LAYOUT
   ============================================ */

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--gray-900);
  color: var(--white);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1000;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-nav {
  padding: 1rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.5rem;
  color: var(--gray-400);
  text-decoration: none;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.nav-item:hover {
  color: var(--white);
  background: rgba(255,255,255,0.05);
}

.nav-item.active {
  color: var(--white);
  background: rgba(99, 102, 241, 0.15);
  border-left-color: var(--primary);
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1.125rem;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 1.5rem 2rem;
  min-height: 100vh;
}

/* ============================================
   HEADER
   ============================================ */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
}

.card-body {
  padding: 1.5rem;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

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

.btn-success:hover:not(:disabled) {
  background: #16A34A;
}

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

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
}

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

.btn-warning:hover:not(:disabled) {
  background: #D97706;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-outline:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--gray-100);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  min-height: 36px;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--gray-700);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-800);
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
  color: var(--gray-400);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* ============================================
   GRID DE MESAS
   ============================================ */

.table-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.table-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  box-shadow: var(--shadow-sm);
}

.table-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.table-card.free {
  border-left: 4px solid var(--success);
}

.table-card.occupied {
  border-left: 4px solid var(--danger);
}

.table-card.reserved {
  border-left: 4px solid var(--warning);
}

.table-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.table-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
}

.table-status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  display: inline-block;
}

.table-card.free .table-status {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.table-card.occupied .table-status {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.table-card.reserved .table-status {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.table-info {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.5rem;
}

/* ============================================
   COMANDA / PEDIDO
   ============================================ */

.order-panel {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 12rem);
  position: sticky;
  top: 1.5rem;
}

.order-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--gray-100);
}

.order-items {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.order-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.875rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  background: var(--gray-50);
  transition: var(--transition);
}

.order-item:hover {
  background: var(--gray-100);
}

.order-item-info {
  flex: 1;
}

.order-item-name {
  font-weight: 500;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.order-item-obs {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-style: italic;
}

.order-item-price {
  font-weight: 600;
  color: var(--primary);
}

.order-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.order-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--gray-800);
}

/* ============================================
   PRODUTOS
   ============================================ */

.product-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.product-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.product-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--gray-100);
}

.product-info {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.product-description {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 0.75rem;
  flex: 1;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.product-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
}

/* ============================================
   COZINHA - PEDIDOS
   ============================================ */

.kitchen-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.kitchen-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  border-left: 4px solid var(--warning);
  transition: var(--transition);
}

.kitchen-card.preparing {
  border-left-color: var(--primary);
}

.kitchen-card.ready {
  border-left-color: var(--success);
}

.kitchen-card.overdue {
  border-left-color: var(--danger);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.kitchen-header {
  padding: 1rem;
  background: var(--gray-50);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kitchen-type {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  background: var(--primary);
  color: var(--white);
}

.kitchen-time {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.kitchen-time.overdue {
  color: var(--danger);
  font-weight: 600;
}

.kitchen-body {
  padding: 1rem;
}

.kitchen-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.kitchen-item:last-child {
  border-bottom: none;
}

.kitchen-item-qty {
  font-weight: 700;
  color: var(--primary);
  margin-right: 0.5rem;
}

.kitchen-item-obs {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-style: italic;
  margin-top: 0.25rem;
}

.kitchen-footer {
  padding: 1rem;
  background: var(--gray-50);
  display: flex;
  gap: 0.5rem;
}

/* ============================================
   ESTATISTICAS / DASHBOARD
   ============================================ */

.stats-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-icon.primary { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.stat-icon.success { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-800);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 300px;
  max-width: 400px;
  animation: slideIn 0.3s ease;
  border-left: 4px solid;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

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

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 1rem;
}

.toast-close:hover {
  color: var(--gray-600);
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  max-height: 60vh;
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ============================================
   TABELAS
   ============================================ */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
}

.data-table th {
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.75rem;
  text-transform: uppercase;
  background: var(--gray-50);
}

.data-table tbody tr:hover {
  background: var(--gray-50);
}

/* ============================================
   BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
}

.badge-success { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: var(--info); }

/* ============================================
   UTILITARIOS
   ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }

.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none !important; }

/* ============================================
   RESPONSIVIDADE
   ============================================ */

.menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  background: var(--gray-900);
  color: var(--white);
  border: none;
  padding: 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: 4rem 1rem 1rem;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .table-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .product-grid {
    grid-template-columns: 1fr;
  }
  
  .kitchen-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .order-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    height: 100vh;
    border-radius: 0;
  }
}

@media (max-width: 480px) {
  .table-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   LOADING
   ============================================ */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--gray-300);
}
