/**
 * Estilos de Componentes - TUKO Shopify App
 * Estilos para componentes reutilizables (cards, botones, inputs, etc.)
 */

/* Selector de período */
.tuko-period-selector {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tuko-period-selector-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tuko-period-selector-right {
  margin-left: auto;
}

.tuko-period-selector-label {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

.tuko-period-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tuko-period-button {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 400;
  color: #6b7280;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.tuko-period-button:hover {
  background-color: #e5e7eb;
}

.tuko-period-button.active {
  font-weight: 600;
  color: #ffffff;
  background-color: #3D50F2;
  border-color: #3D50F2;
}

.tuko-time-remaining {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

/* Grid de tarjetas KPI */
.tuko-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.tuko-kpi-card {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  border: 1px solid #f3f4f6;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tuko-kpi-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.tuko-kpi-content {
  flex: 1;
}

.tuko-kpi-label {
  margin: 0;
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.tuko-kpi-value {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 700;
  color: #111827;
}

/* Card genérica */
.tuko-card {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  border: 1px solid #f3f4f6;
  padding: 2rem;
  margin-bottom: 2rem;
}

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

.tuko-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tuko-card-title h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
}

.tuko-card-subtitle {
  margin: 0;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #6b7280;
}

/* Inputs y selects */
.tuko-input {
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: #111827;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tuko-input:focus {
  border-color: #3D50F2;
  box-shadow: 0 0 0 3px rgba(61, 80, 242, 0.1);
}

.tuko-input:disabled,
.tuko-input[readonly] {
  background-color: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
}

/* Slider para hitos */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  outline: none;
  transition: background 0.2s ease;
}

input[type="range"]:hover {
  background: #d1d5db;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3D50F2;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #2d3fd8;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3D50F2;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  background: #2d3fd8;
}

/* Tabla */
.tuko-table-container {
  overflow-x: auto;
}

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

.tuko-table thead tr {
  border-bottom: 1px solid #e5e7eb;
}

.tuko-table th {
  padding: 0.75rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
}

.tuko-table td {
  padding: 1rem 0.75rem;
  font-size: 0.875rem;
  color: #111827;
  vertical-align: middle;
}

.tuko-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
}

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

/* Posición destacada (Top 5) */
.tuko-position-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 600;
}

.tuko-position-badge.first {
  background-color: #F59E0B;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.4);
  font-weight: 700;
}

.tuko-position-badge.second {
  background-color: #9ca3af;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(156, 163, 175, 0.3);
}

.tuko-position-badge.third {
  background-color: #CD7F32;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(205, 127, 50, 0.4);
}

.tuko-position-badge.other {
  background-color: #f3f4f6;
  color: #6b7280;
}

/* Fila destacada (Top 5) */
.tuko-table tbody tr.highlight-first {
  background-color: #fef3c7;
}

.tuko-table tbody tr.highlight-second {
  background-color: #e5e7eb;
}

.tuko-table tbody tr.highlight-third {
  background-color: #E8B896;
}

/* Badge de estado */
.tuko-status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.tuko-status-badge.active {
  background-color: #dbeafe;
  color: #1e40af;
}

.tuko-status-badge.completed {
  background-color: #d1fae5;
  color: #065f46;
}

.tuko-status-badge.cancelled {
  background-color: #fee2e2;
  color: #991b1b;
}

.tuko-status-badge.closed {
  background-color: #fef3c7;
  color: #92400e;
}

.tuko-status-badge.failed {
  background-color: #fee2e2; /* Rojo muy claro */
  color: #991b1b; /* Rojo oscuro */
}

/* Controles de grupos recientes */
.tuko-groups-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.tuko-groups-controls .tuko-groups-limit {
  margin-left: auto;
}

.tuko-groups-limit {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background-color: #f9fafb;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
}

.tuko-groups-limit-label {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
}

.tuko-groups-limit-buttons {
  display: flex;
  gap: 0.25rem;
}

.tuko-limit-button {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  background-color: #ffffff;
  color: #6b7280;
}

.tuko-limit-button:hover {
  background-color: #f3f4f6;
  color: #111827;
}

.tuko-limit-button.active {
  background-color: #3D50F2;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(61, 80, 242, 0.2);
}

/* Selector de ordenamiento */
.tuko-sort-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.tuko-sort-selector label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
}

.tuko-sort-selector select {
  padding: 0.5rem 2.5rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tuko-sort-selector select:focus {
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Loading y empty states */
.tuko-loading, .tuko-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #6b7280;
  font-size: 0.875rem;
}

/* Sistema de notificaciones (igual que WooCommerce) */
.tuko-notification {
  position: fixed;
  top: 3.5rem;
  right: 2rem;
  z-index: 10000;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: #ffffff;
  min-width: 250px;
  max-width: 400px;
  animation: slideInRight 0.3s ease-out;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.tuko-notification-success {
  background-color: #10b981;
}

.tuko-notification-error {
  background-color: #ef4444;
}

.tuko-notification-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tuko-notification-message {
  flex: 1;
}

.tuko-notification-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.tuko-notification-close:hover {
  opacity: 1;
}

.tuko-notification.fade-out {
  opacity: 0;
  transform: translateX(100%);
}

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

