/* ========================================
   SISTEMA POS - CSS GLOBAL
   Variables, componentes y estilos base
   ======================================== */

:root {
  /* Paleta de Colores */
  --primary: #0099FF;
  --primary-dark: #0077CC;
  --primary-light: #4db8ff;
  --secondary: #00a8e8;
  
  --success: #10b981;
  --success-dark: #059669;
  --success-light: #d1fae5;
  
  --warning: #f59e0b;
  --warning-dark: #d97706;
  --warning-light: #fef3c7;
  
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --danger-light: #fee2e2;
  
  --info: #3b82f6;
  --info-dark: #1d4ed8;
  --info-light: #dbeafe;
  
  /* Grises */
  --dark: #1f2937;
  --dark-secondary: #374151;
  --medium: #6b7280;
  --light: #f9fafb;
  --light-secondary: #f3f4f6;
  --border: #e5e7eb;
  
  /* Espaciado */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;
  
  /* Bordes */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 15px;
  --radius-2xl: 16px;
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.12);
  
  /* Transiciones */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ========================================
   RESET Y BASE
   ======================================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--dark);
  background: linear-gradient(135deg, var(--light) 0%, var(--light-secondary) 100%);
  line-height: 1.5;
  min-height: 100vh;
}

/* ========================================
   TIPOGRAFÍA
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-lg);
}

h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 12px; }

p {
  margin-bottom: var(--space-md);
  color: var(--dark-secondary);
}

small {
  font-size: 12px;
  color: var(--medium);
}

/* ========================================
   BOTONES - ESTILOS MEJORADOS
   ======================================== */

.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-size: 13px;
  font-weight: 600;
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

/* Botón Primario */
.btn-primary, .btn.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-md);
}

/* Botón Secundario */
.btn-secondary, .btn.btn-secondary {
  background: var(--light-secondary);
  color: var(--dark);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  transform: translateY(-1px);
}

/* Botón Success */
.btn-success, .btn.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Botón Danger */
.btn-danger, .btn.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Botón Info */
.btn-info, .btn.btn-info {
  background: linear-gradient(135deg, var(--info) 0%, var(--info-dark) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-info:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Botón Warning */
.btn-warning, .btn.btn-warning {
  background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Botón pequeño */
.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: 12px;
}

/* Botón grande */
.btn-lg {
  padding: var(--space-lg) var(--space-2xl);
  font-size: 14px;
}

/* Botón deshabilitado */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ========================================
   INPUTS Y FORMULARIOS
   ======================================== */

input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: white;
  color: var(--dark);
  transition: all var(--transition-base);
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 153, 255, 0.1);
  background: white;
}

input::placeholder {
  color: var(--medium);
  opacity: 0.7;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  font-size: 13px;
  color: var(--dark);
}

.form-group {
  margin-bottom: var(--space-lg);
}

/* Input con validación */
input.is-valid {
  border-color: var(--success);
  background: linear-gradient(to right, white 90%, var(--success-light) 100%);
}

input.is-invalid {
  border-color: var(--danger);
  background: linear-gradient(to right, white 90%, var(--danger-light) 100%);
}

.error-message {
  color: var(--danger);
  font-size: 12px;
  margin-top: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.success-message {
  color: var(--success);
  font-size: 12px;
  margin-top: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ========================================
   TABLAS MEJORADAS
   ======================================== */

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

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

thead th {
  padding: var(--space-md) var(--space-lg);
  font-weight: 700;
  text-align: left;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: all var(--transition-fast);
}

tbody tr:nth-child(even) {
  background: var(--light-secondary);
}

tbody tr:hover {
  background: var(--light);
  box-shadow: inset 0 0 0 1px var(--primary-light);
}

tbody td {
  padding: var(--space-md) var(--space-lg);
  font-size: 13px;
}

tbody td:last-child {
  text-align: right;
}

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

.card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  border: 1px solid var(--border);
}

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

.card-header {
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}

.card-header h3 {
  margin-bottom: 0;
}

.card-body {
  padding: 0;
}

.card-footer {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  margin-top: var(--space-lg);
}

/* Menu Card */
.menu-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-3xl) var(--space-2xl);
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  position: relative;
  overflow: hidden;
  border-left: 4px solid transparent;
}

.menu-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(0, 153, 255, 0.05) 0%, rgba(0, 153, 255, 0) 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.menu-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-left-color: var(--primary);
}

.menu-card:hover::before {
  opacity: 1;
}

.menu-icon {
  font-size: 56px;
  margin-bottom: var(--space-lg);
  line-height: 1;
}

.menu-card h3 {
  font-size: 20px;
  color: var(--primary-dark);
  margin-bottom: var(--space-md);
}

.menu-card p {
  font-size: 13px;
  color: var(--medium);
  margin-bottom: 0;
}

/* ========================================
   MODALES
   ======================================== */

.modal, .modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.show, .modal-overlay.show {
  display: flex;
  animation: fadeIn var(--transition-base) ease;
}

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

.modal-content {
  background: white;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  width: 95%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp var(--transition-base) ease;
}

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

.modal-header {
  padding: var(--space-2xl);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-base);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.modal-body {
  padding: var(--space-2xl);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-2xl);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-lg);
  justify-content: flex-end;
  background: var(--light);
}

.modal-footer .btn {
  margin: 0;
}

/* ========================================
   ALERTAS Y NOTIFICACIONES
   ======================================== */

.alert {
  padding: var(--space-lg) var(--space-xl);
  border-radius: var(--radius-md);
  border-left: 4px solid;
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
  animation: slideDown var(--transition-base) ease;
}

@keyframes slideDown {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.alert-success {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success-dark);
}

.alert-danger {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger-dark);
}

.alert-warning {
  background: var(--warning-light);
  border-color: var(--warning);
  color: var(--warning-dark);
}

.alert-info {
  background: var(--info-light);
  border-color: var(--info);
  color: var(--info-dark);
}

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

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

/* ========================================
   UTILITIES
   ======================================== */

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

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

.mt-0 { margin-top: 0; }
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.text-muted { color: var(--medium); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  h3 { font-size: 18px; }
  
  .btn {
    padding: var(--space-md) var(--space-md);
  }
  
  .modal-content {
    width: 98%;
    max-height: 95vh;
  }
  
  table {
    font-size: 12px;
  }
  
  thead th, tbody td {
    padding: var(--space-sm) var(--space-md);
  }
}

@media (max-width: 480px) {
  h1 { font-size: 20px; }
  h2 { font-size: 18px; }
  
  .menu-card {
    min-height: 200px;
    padding: var(--space-2xl) var(--space-lg);
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
}
