/* ============================================
   TAVLO MANAGER - ESTILOS PRINCIPALES
   Colores: #0A1C2F (azul) | #f6a702 (mostaza)
   ============================================ */

/* Variables CSS */
:root {
  /* Primario - Azul Tavlo */
  --color-primary: #0A1C2F;
  --color-primary-light: #1a3a52;
  --color-primary-lighter: #2d4a66;
  --color-primary-dark: #050e17;

  /* Secundario - Mostaza */
  --color-secondary: #f6a702;
  --color-secondary-light: #ffc233;
  --color-secondary-dark: #d08f00;
  --color-secondary-hover: #e09602;

  /* Neutrales */
  --color-white: #ffffff;
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;

  /* Semánticos */
  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-error: #ef4444;
  --color-error-light: #fee2e2;
  --color-info: #3b82f6;
  --color-info-light: #dbeafe;

  /* Espaciado */
  --spacing-xs: 0.25rem;    /* 4px */
  --spacing-sm: 0.5rem;     /* 8px */
  --spacing-md: 1rem;       /* 16px */
  --spacing-lg: 1.5rem;     /* 24px */
  --spacing-xl: 2rem;       /* 32px */
  --spacing-2xl: 3rem;      /* 48px */

  /* Bordes */
  --radius-sm: 0.375rem;    /* 6px */
  --radius-md: 0.5rem;      /* 8px */
  --radius-lg: 0.75rem;     /* 12px */
  --radius-xl: 1rem;        /* 16px */
  --radius-full: 9999px;

  /* 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), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 70px;

  /* Transiciones */
  --transition-fast: 150ms;
  --transition-normal: 250ms;
  --transition-slow: 350ms;
}

/* ============================================
   RESET Y BASE
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-gray-900);
  background-color: var(--color-gray-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   TIPOGRAFÍA
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-primary);
  margin-bottom: var(--spacing-md);
}

h1 { font-size: 2.25rem; }  /* 36px */
h2 { font-size: 1.875rem; } /* 30px */
h3 { font-size: 1.5rem; }   /* 24px */
h4 { font-size: 1.25rem; }  /* 20px */
h5 { font-size: 1.125rem; } /* 18px */
h6 { font-size: 1rem; }     /* 16px */

p {
  margin-bottom: var(--spacing-md);
  color: var(--color-gray-700);
}

a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--transition-fast) ease;
}

a:hover {
  color: var(--color-secondary-dark);
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-normal) ease;
  text-decoration: none;
  gap: 0.5rem;
}

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

/* Botón Primario */
.btn-primary {
  background-color: var(--color-secondary);
  color: var(--color-white);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-secondary-hover);
  box-shadow: var(--shadow-md);
}

/* Botón Secundario */
.btn-secondary {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
}

/* Botón Outline */
.btn-outline {
  background-color: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* Botón Ghost */
.btn-ghost {
  background-color: transparent;
  color: var(--color-gray-700);
}

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

/* Botón Danger */
.btn-danger {
  background-color: var(--color-error);
  color: var(--color-white);
}

.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
  box-shadow: var(--shadow-md);
}

/* Tamaños de botón */
.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.813rem;
}

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

.btn-block {
  width: 100%;
  display: flex;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background-color: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(10, 28, 47, 0.08);
  border: none !important;
  overflow: hidden;
  transition: box-shadow var(--transition-normal) ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(10, 28, 47, 0.12);
}

.card-header {
  padding: var(--spacing-lg);
  border-bottom: none !important;
  background-color: var(--color-white);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-primary);
  margin: 0;
}

.card-body {
  padding: var(--spacing-lg);
}

.card-footer {
  padding: var(--spacing-lg);
  border-top: none !important;
  background-color: var(--color-white);
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-group {
  margin-bottom: var(--spacing-lg);
}

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

.form-label-required::after {
  content: ' *';
  color: var(--color-error);
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-gray-900);
  background-color: var(--color-white);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast) ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(246, 167, 2, 0.1);
}

.form-control:disabled {
  background-color: var(--color-gray-100);
  cursor: not-allowed;
  opacity: 0.6;
}

.form-control.is-invalid {
  border-color: var(--color-error);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-error {
  display: block;
  margin-top: var(--spacing-xs);
  font-size: 0.813rem;
  color: var(--color-error);
}

.form-help {
  display: block;
  margin-top: var(--spacing-xs);
  font-size: 0.813rem;
  color: var(--color-gray-500);
}

/* Select */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px;
  padding-right: 2.5rem;
}

/* Textarea */
textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* Checkbox y Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.form-check-input {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid var(--color-gray-300);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.form-check-input[type="radio"] {
  border-radius: var(--radius-full);
}

.form-check-input:checked {
  background-color: var(--color-secondary);
  border-color: var(--color-secondary);
}

.form-check-label {
  font-size: 0.875rem;
  color: var(--color-gray-700);
  cursor: pointer;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-primary {
  background-color: var(--color-secondary-light);
  color: var(--color-secondary-dark);
}

.badge-success {
  background-color: var(--color-success-light);
  color: #065f46;
}

.badge-warning {
  background-color: var(--color-warning-light);
  color: #92400e;
}

.badge-error {
  background-color: var(--color-error-light);
  color: #991b1b;
}

.badge-info {
  background-color: var(--color-info-light);
  color: #1e40af;
}

.badge-gray {
  background-color: var(--color-gray-200);
  color: var(--color-gray-700);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  margin-bottom: var(--spacing-md);
}

.alert-success {
  background-color: var(--color-success-light);
  border-color: var(--color-success);
  color: #065f46;
}

.alert-warning {
  background-color: var(--color-warning-light);
  border-color: var(--color-warning);
  color: #92400e;
}

.alert-error {
  background-color: var(--color-error-light);
  border-color: var(--color-error);
  color: #991b1b;
}

.alert-info {
  background-color: var(--color-info-light);
  border-color: var(--color-info);
  color: #1e40af;
}

/* ============================================
   TABLAS
   ============================================ */
.table-container {
  overflow-x: auto;
  background-color: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead {
  background-color: var(--color-gray-50);
  border-bottom: 2px solid var(--color-gray-200);
}

.table th {
  padding: var(--spacing-md);
  text-align: left;
  font-weight: 600;
  color: var(--color-gray-700);
  white-space: nowrap;
}

.table td {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-gray-200);
  color: var(--color-gray-900);
}

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

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================
   UTILIDADES
   ============================================ */

/* Text */
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-gray { color: var(--color-gray-600); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-info { color: var(--color-info); }

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

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

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

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.gap-xl { gap: var(--spacing-xl); }

/* Spacing */
.m-0 { margin: 0; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Border */
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadow */
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ============================================
   BOOTSTRAP-LIKE UTILITIES
   ============================================ */

/* Grid System */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-left: -0.75rem;
  margin-right: -0.75rem;
}

.col, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-12 {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  width: 100%;
}

@media (min-width: 768px) {
  .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  .col-md-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}

/* Bootstrap Utilities */
.d-flex { display: flex !important; }
.d-block { display: block !important; }
.d-none { display: none !important; }

.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }

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

.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around { justify-content: space-around !important; }
.justify-content-end { justify-content: flex-end !important; }

/* Spacing utilities */
.m-0 { margin: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }

.mr-2 { margin-right: 0.5rem !important; }
.mr-3 { margin-right: 1rem !important; }
.ml-auto { margin-left: auto !important; }
.mr-auto { margin-right: auto !important; }

.p-0 { padding: 0 !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }

/* Height utilities */
.h-100 { height: 100% !important; }

/* Text utilities */
.text-muted { color: var(--color-gray-500) !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-uppercase { text-transform: uppercase !important; }

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

/* Typography sizes */
.h1 { font-size: 2.25rem !important; font-weight: 600; }
.h2 { font-size: 1.875rem !important; font-weight: 600; }
.h3 { font-size: 1.5rem !important; font-weight: 600; }
.h4 { font-size: 1.25rem !important; font-weight: 600; }
.h5 { font-size: 1.125rem !important; font-weight: 600; }
.h6 { font-size: 1rem !important; font-weight: 600; }

/* ============================================
   TABS & NAVIGATION
   ============================================ */
.nav {
  display: flex;
  flex-wrap: wrap;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

.nav-pills {
  gap: 0;
  border-bottom: none !important;
  padding-bottom: 0;
  display: flex;
  justify-content: center;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  font-size: 0.938rem;
  font-weight: 500;
  color: var(--color-gray-700) !important;
  text-decoration: none;
  transition: all var(--transition-fast) ease;
  border-bottom: 3px solid transparent !important;
  border: none !important;
  margin-bottom: 0;
  cursor: pointer;
  background-color: transparent !important;
  background: none !important;
  flex: 0 0 auto;
  min-width: 15%;
  text-align: center;
  border-radius: 0 !important;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: transparent;
  transition: background-color var(--transition-fast) ease;
}

.nav-link:hover {
  color: var(--color-primary) !important;
  background-color: transparent !important;
  background: none !important;
}

.nav-link.active {
  color: var(--color-primary) !important;
  background-color: transparent !important;
  background: none !important;
  font-weight: 600;
}

.nav-link.active::after {
  background-color: var(--color-primary);
}

/* Ocultar iconos en nav-link */
.nav-link i {
  display: none;
}

.tab-content {
  margin-top: 2rem;
}

.tab-pane {
  display: none;
}

.tab-pane.active,
.tab-pane.show {
  display: block;
}

.tab-pane.fade {
  opacity: 0;
  transition: opacity 0.15s linear;
}

.tab-pane.fade.show {
  opacity: 1;
}

/* ============================================
   DROPDOWNS
   ============================================ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle::after {
  display: inline-block;
  margin-left: 0.5rem;
  vertical-align: middle;
  content: "";
  border-top: 0.3em solid;
  border-right: 0.3em solid transparent;
  border-bottom: 0;
  border-left: 0.3em solid transparent;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  display: none;
  min-width: 10rem;
  padding: 0.5rem 0;
  margin: 0.125rem 0 0;
  font-size: 0.875rem;
  color: var(--color-gray-900);
  background-color: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.dropdown-menu.show {
  display: block;
}

/* ============================================
   TABLE IMPROVEMENTS
   ============================================ */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-hover tbody tr {
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

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

/* Badge variants con más padding */
.badge {
  padding: 0.375rem 0.875rem !important;
  font-size: 0.813rem !important;
  font-weight: 600 !important;
}

.badge-success {
  background-color: #d1fae5 !important;
  color: #065f46 !important;
}

.badge-danger {
  background-color: #fee2e2 !important;
  color: #991b1b !important;
}

.badge-warning {
  background-color: #fef3c7 !important;
  color: #92400e !important;
}

.badge-info {
  background-color: #dbeafe !important;
  color: #1e40af !important;
}

.badge-gray {
  background-color: #f3f4f6 !important;
  color: #4b5563 !important;
}

.badge-primary {
  background-color: #dbeafe !important;
  color: #1e40af !important;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0.25rem;
}

.page-item {
  display: inline-block;
}

.page-link {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--color-gray-700);
  background-color: var(--color-white);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.page-link:hover {
  background-color: var(--color-gray-100);
  color: var(--color-primary);
  border-color: var(--color-gray-400);
}

.page-item.active .page-link {
  background-color: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
  font-weight: 600;
}

.page-item.disabled .page-link {
  color: var(--color-gray-400);
  pointer-events: none;
  cursor: not-allowed;
  background-color: var(--color-gray-50);
}

/* ============================================
   HEATMAP
   ============================================ */
#horasHeatmap {
  padding: 0;
}

#horasHeatmap > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
  padding: 20px;
}

@media (max-width: 768px) {
  #horasHeatmap > div {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  .nav-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .nav-link {
    white-space: nowrap;
    max-width: none;
  }
}
