/**
 * ============================================================================
 * CHILECHOCADOS - COMPONENTES REUTILIZABLES
 * ============================================================================
 * 
 * Components Library v1.0
 * Fecha: Octubre 2025
 * Diseñado por: ToroDigital - UX/UI Team
 * 
 * Este archivo contiene todos los componentes UI reutilizables
 * Requiere: design-system.css
 * 
 * Componentes incluidos:
 * 1. Botones (5 variantes)
 * 2. Cards (3 tipos)
 * 3. Forms (inputs, selects, textareas, checkboxes, radios)
 * 4. Badges y Tags
 * 5. Alerts (4 tipos)
 * 6. Modals
 * 7. Tooltips
 * 8. Breadcrumbs
 * 9. Pagination
 * 10. Loading States
 * 11. Avatars
 * 12. Dividers
 * 
 * ============================================================================
 */


/* ============================================================================
 * 1. BOTONES
 * ============================================================================
 * Variantes: primary, secondary, outline, ghost, danger
 * Tamaños: sm, default, lg
 * Estados: hover, active, disabled, loading
 */

/* --- Base Button --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--cc-space-2);
  height: var(--cc-button-height);
  padding: 0 var(--cc-button-padding-x);
  font-family: var(--cc-font-primary);
  font-size: var(--cc-text-base);
  font-weight: var(--cc-font-semibold);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  border: var(--cc-border-2) solid transparent;
  border-radius: var(--cc-radius-lg);
  cursor: pointer;
  transition: var(--cc-transition);
  user-select: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.btn:focus-visible {
  outline: 2px solid var(--cc-primary);
  outline-offset: 2px;
}

/* --- Primary Button --- */
.btn-primary {
  background-color: var(--cc-primary);
  color: var(--cc-white) !important;
  border-color: var(--cc-primary);
}

.btn-primary *,
.btn-primary span,
.btn-primary svg {
  color: var(--cc-white) !important;
  fill: currentColor;
}

.btn-primary:hover {
  background-color: var(--cc-primary-dark);
  border-color: var(--cc-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--cc-shadow-md);
}

.btn-primary:active {
  background-color: var(--cc-primary-darker);
  transform: translateY(0);
  box-shadow: var(--cc-shadow-sm);
}

/* --- Secondary Button --- */
.btn-secondary {
  background-color: var(--cc-secondary);
  color: var(--cc-gray-900);
  border-color: var(--cc-secondary);
}

.btn-secondary:hover {
  background-color: var(--cc-secondary-dark);
  border-color: var(--cc-secondary-dark);
  transform: translateY(-1px);
  box-shadow: var(--cc-shadow-md);
}

.btn-secondary:active {
  background-color: var(--cc-secondary-darker);
  transform: translateY(0);
}

/* --- Outline Button --- */
.btn-outline {
  background-color: transparent;
  color: var(--cc-primary);
  border-color: var(--cc-primary);
}

.btn-outline:hover {
  background-color: var(--cc-primary);
  color: var(--cc-white);
  box-shadow: var(--cc-shadow);
}

.btn-outline:active {
  background-color: var(--cc-primary-dark);
  border-color: var(--cc-primary-dark);
}

/* --- Ghost Button --- */
.btn-ghost {
  background-color: transparent;
  color: var(--cc-text-primary);
  border-color: transparent;
}

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

.btn-ghost:active {
  background-color: var(--cc-gray-200);
}

/* --- Danger Button --- */
.btn-danger {
  background-color: var(--cc-danger);
  color: var(--cc-white);
  border-color: var(--cc-danger);
}

.btn-danger:hover {
  background-color: var(--cc-danger-dark);
  border-color: var(--cc-danger-dark);
  transform: translateY(-1px);
  box-shadow: var(--cc-shadow-md);
}

.btn-danger:active {
  background-color: #B91C1C;
  transform: translateY(0);
}

/* --- Button Sizes --- */
.btn-sm {
  height: var(--cc-button-height-sm);
  padding: 0 var(--cc-button-padding-x-sm);
  font-size: var(--cc-text-sm);
}

.btn-lg {
  height: var(--cc-button-height-lg);
  padding: 0 var(--cc-button-padding-x-lg);
  font-size: var(--cc-text-lg);
}

/* --- Button States --- */
.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid var(--cc-white);
  border-radius: 50%;
  border-top-color: transparent;
  animation: btn-spin 0.6s linear infinite;
}

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

/* --- Button Icons --- */
.btn-icon {
  width: var(--cc-button-height);
  padding: 0;
}

.btn-icon.btn-sm {
  width: var(--cc-button-height-sm);
}

.btn-icon.btn-lg {
  width: var(--cc-button-height-lg);
}

/* --- Button Group --- */
.btn-group {
  display: inline-flex;
  gap: var(--cc-space-2);
}

.btn-group-attached {
  display: inline-flex;
}

.btn-group-attached .btn {
  border-radius: 0;
  margin-left: -1px;
}

.btn-group-attached .btn:first-child {
  border-radius: var(--cc-radius-lg) 0 0 var(--cc-radius-lg);
  margin-left: 0;
}

.btn-group-attached .btn:last-child {
  border-radius: 0 var(--cc-radius-lg) var(--cc-radius-lg) 0;
}


/* ============================================================================
 * 2. CARDS
 * ============================================================================
 * Tipos: product, category, message
 */

/* --- Base Card --- */
.card {
  background-color: var(--cc-bg-surface);
  border: var(--cc-border-1) solid var(--cc-border-light);
  border-radius: var(--cc-radius-xl);
  box-shadow: var(--cc-shadow-sm);
  overflow: hidden;
  transition: var(--cc-transition);
}

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

/* --- Card Header --- */
.card-header {
  padding: var(--cc-space-4) var(--cc-space-6);
  border-bottom: var(--cc-border-1) solid var(--cc-border-light);
}

.card-title {
  font-size: var(--cc-text-xl);
  font-weight: var(--cc-font-semibold);
  color: var(--cc-text-primary);
  margin: 0;
}

.card-subtitle {
  font-size: var(--cc-text-sm);
  color: var(--cc-text-secondary);
  margin-top: var(--cc-space-1);
}

/* --- Card Body --- */
.card-body {
  padding: var(--cc-space-6);
}

/* --- Card Footer --- */
.card-footer {
  padding: var(--cc-space-4) var(--cc-space-6);
  border-top: var(--cc-border-1) solid var(--cc-border-light);
  background-color: var(--cc-bg-muted);
}

/* --- Product Card --- */
.card-product {
  position: relative;
}

.card-product-image {
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 Aspect Ratio */
  overflow: hidden;
  background-color: var(--cc-gray-100);
}

.card-product-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-product-badge {
  position: absolute;
  top: var(--cc-space-3);
  right: var(--cc-space-3);
  z-index: 1;
}

.card-product-content {
  padding: var(--cc-space-4);
}

.card-product-title {
  font-size: var(--cc-text-lg);
  font-weight: var(--cc-font-semibold);
  color: var(--cc-text-primary);
  margin-bottom: var(--cc-space-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-product-meta {
  display: flex;
  gap: var(--cc-space-4);
  font-size: var(--cc-text-sm);
  color: var(--cc-text-secondary);
  margin-bottom: var(--cc-space-3);
}

.card-product-price {
  font-size: var(--cc-text-2xl);
  font-weight: var(--cc-font-bold);
  color: var(--cc-primary);
}

.card-product-footer {
  display: flex;
  gap: var(--cc-space-2);
  padding: var(--cc-space-4);
  border-top: var(--cc-border-1) solid var(--cc-border-light);
}

/* --- Category Card --- */
.card-category {
  text-align: center;
  cursor: pointer;
}

.card-category:hover {
  border-color: var(--cc-primary);
}

.card-category-icon {
  width: 64px;
  height: 64px;
  margin: var(--cc-space-6) auto var(--cc-space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--cc-primary-pale);
  border-radius: var(--cc-radius-full);
  color: var(--cc-primary);
  font-size: var(--cc-text-3xl);
}

.card-category-title {
  font-size: var(--cc-text-lg);
  font-weight: var(--cc-font-semibold);
  margin-bottom: var(--cc-space-2);
}

.card-category-count {
  font-size: var(--cc-text-sm);
  color: var(--cc-text-secondary);
  margin-bottom: var(--cc-space-6);
}


/* ============================================================================
 * 3. FORMULARIOS
 * ============================================================================
 * Elementos: inputs, selects, textareas, checkboxes, radios, file uploads
 */

/* --- Form Group --- */
.form-group {
  margin-bottom: var(--cc-space-6);
}

.form-label {
  display: block;
  font-size: var(--cc-text-sm);
  font-weight: var(--cc-font-medium);
  color: var(--cc-text-primary);
  margin-bottom: var(--cc-space-2);
}

.form-label-required::after {
  content: "*";
  color: var(--cc-danger);
  margin-left: var(--cc-space-1);
}

.form-hint {
  display: block;
  font-size: var(--cc-text-xs);
  color: var(--cc-text-tertiary);
  margin-top: var(--cc-space-1);
}

.form-error {
  display: block;
  font-size: var(--cc-text-xs);
  color: var(--cc-danger);
  margin-top: var(--cc-space-1);
}

/* --- Input Base --- */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  height: var(--cc-input-height);
  padding: var(--cc-input-padding-y) var(--cc-input-padding-x);
  font-family: var(--cc-font-primary);
  font-size: var(--cc-text-base);
  color: var(--cc-text-primary);
  background-color: var(--cc-white);
  border: var(--cc-border-1) solid var(--cc-border-default);
  border-radius: var(--cc-radius-lg);
  transition: var(--cc-transition);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--cc-primary);
  box-shadow: 0 0 0 3px var(--cc-primary-pale);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: var(--cc-gray-100);
  color: var(--cc-text-disabled);
  cursor: not-allowed;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--cc-danger);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
  box-shadow: 0 0 0 3px var(--cc-danger-light);
}

/* --- Input Sizes --- */
.form-input-sm {
  height: var(--cc-input-height-sm);
  font-size: var(--cc-text-sm);
}

.form-input-lg {
  height: var(--cc-input-height-lg);
  font-size: var(--cc-text-lg);
}

/* --- Textarea --- */
.form-textarea {
  height: auto;
  min-height: 120px;
  resize: vertical;
  line-height: var(--cc-leading-normal);
}

/* --- Select --- */
.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23666' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right var(--cc-space-4) center;
  background-size: 16px 12px;
  padding-right: var(--cc-space-10);
}

/* --- Checkbox & Radio --- */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--cc-space-3);
  margin-bottom: var(--cc-space-3);
}

.form-check-input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: var(--cc-border-2) solid var(--cc-border-default);
  cursor: pointer;
  transition: var(--cc-transition);
  flex-shrink: 0;
}

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

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

.form-check-input:checked {
  background-color: var(--cc-primary);
  border-color: var(--cc-primary);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

.form-check-input[type="radio"]:checked {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3ccircle cx='10' cy='10' r='4' fill='%23fff'/%3e%3c/svg%3e");
}

.form-check-label {
  font-size: var(--cc-text-base);
  color: var(--cc-text-primary);
  cursor: pointer;
  user-select: none;
}

/* --- Input Group --- */
.input-group {
  display: flex;
  width: 100%;
}

.input-group .form-input {
  flex: 1;
  border-radius: 0;
}

.input-group .form-input:first-child {
  border-radius: var(--cc-radius-lg) 0 0 var(--cc-radius-lg);
}

.input-group .form-input:last-child {
  border-radius: 0 var(--cc-radius-lg) var(--cc-radius-lg) 0;
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: var(--cc-input-padding-y) var(--cc-input-padding-x);
  font-size: var(--cc-text-base);
  color: var(--cc-text-secondary);
  background-color: var(--cc-gray-100);
  border: var(--cc-border-1) solid var(--cc-border-default);
  white-space: nowrap;
}

.input-group .input-group-text:first-child {
  border-radius: var(--cc-radius-lg) 0 0 var(--cc-radius-lg);
  border-right: 0;
}

.input-group .input-group-text:last-child {
  border-radius: 0 var(--cc-radius-lg) var(--cc-radius-lg) 0;
  border-left: 0;
}

/* --- File Upload --- */
.form-file {
  position: relative;
}

.form-file-input {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.form-file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--cc-space-2);
  height: var(--cc-button-height);
  padding: 0 var(--cc-button-padding-x);
  font-size: var(--cc-text-base);
  font-weight: var(--cc-font-medium);
  color: var(--cc-text-primary);
  background-color: var(--cc-white);
  border: var(--cc-border-2) solid var(--cc-border-default);
  border-radius: var(--cc-radius-lg);
  cursor: pointer;
  transition: var(--cc-transition);
}

.form-file-label:hover {
  border-color: var(--cc-primary);
  color: var(--cc-primary);
}

.form-file-input:focus + .form-file-label {
  outline: 2px solid var(--cc-primary);
  outline-offset: 2px;
}


/* ============================================================================
 * 4. BADGES Y TAGS
 * ============================================================================
 */

/* --- Badge Base --- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--cc-space-1);
  height: 24px;
  padding: 0 var(--cc-space-3);
  font-size: var(--cc-text-xs);
  font-weight: var(--cc-font-semibold);
  line-height: 1;
  white-space: nowrap;
  border-radius: var(--cc-radius-full);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-primary {
  background-color: var(--cc-primary-pale);
  color: var(--cc-primary);
}

.badge-secondary {
  background-color: var(--cc-secondary-pale);
  color: var(--cc-secondary-darker);
}

.badge-success {
  background-color: var(--cc-success-light);
  color: var(--cc-success-dark);
}

.badge-warning {
  background-color: var(--cc-warning-light);
  color: var(--cc-warning-dark);
}

.badge-danger {
  background-color: var(--cc-danger-light);
  color: var(--cc-danger-dark);
}

.badge-info {
  background-color: var(--cc-info-light);
  color: var(--cc-info-dark);
}

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

/* --- Tag (Badge removible) --- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--cc-space-2);
  height: 32px;
  padding: 0 var(--cc-space-3);
  font-size: var(--cc-text-sm);
  font-weight: var(--cc-font-medium);
  background-color: var(--cc-gray-100);
  color: var(--cc-text-primary);
  border-radius: var(--cc-radius-lg);
  transition: var(--cc-transition);
}

.tag:hover {
  background-color: var(--cc-gray-200);
}

.tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--cc-radius-full);
  cursor: pointer;
  color: var(--cc-text-tertiary);
  transition: var(--cc-transition);
}

.tag-remove:hover {
  background-color: var(--cc-gray-300);
  color: var(--cc-text-primary);
}


/* ============================================================================
 * 5. ALERTS
 * ============================================================================
 */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--cc-space-3);
  padding: var(--cc-space-4);
  border-radius: var(--cc-radius-lg);
  border-left: 4px solid;
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-size: var(--cc-text-base);
  font-weight: var(--cc-font-semibold);
  margin-bottom: var(--cc-space-1);
}

.alert-message {
  font-size: var(--cc-text-sm);
  line-height: var(--cc-leading-relaxed);
}

.alert-close {
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: currentColor;
  opacity: 0.5;
  transition: var(--cc-transition);
}

.alert-close:hover {
  opacity: 1;
}

/* Alert Variants */
.alert-success {
  background-color: var(--cc-success-light);
  color: var(--cc-success-dark);
  border-color: var(--cc-success);
}

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

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

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


/* ============================================================================
 * 6. MODALS
 * ============================================================================
 */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--cc-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--cc-space-4);
  z-index: var(--cc-z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: var(--cc-transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: relative;
  width: 100%;
  max-width: var(--cc-container-md);
  max-height: 90vh;
  background-color: var(--cc-bg-surface);
  border-radius: var(--cc-radius-2xl);
  box-shadow: var(--cc-shadow-2xl);
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: var(--cc-transition);
  z-index: var(--cc-z-modal);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--cc-space-6);
  border-bottom: var(--cc-border-1) solid var(--cc-border-light);
}

.modal-title {
  font-size: var(--cc-text-2xl);
  font-weight: var(--cc-font-semibold);
  color: var(--cc-text-primary);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--cc-radius);
  cursor: pointer;
  color: var(--cc-text-tertiary);
  transition: var(--cc-transition);
}

.modal-close:hover {
  background-color: var(--cc-gray-100);
  color: var(--cc-text-primary);
}

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

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--cc-space-3);
  padding: var(--cc-space-6);
  border-top: var(--cc-border-1) solid var(--cc-border-light);
}


/* ============================================================================
 * 7. TOOLTIPS
 * ============================================================================
 */

.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip-content {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: var(--cc-space-2) var(--cc-space-3);
  font-size: var(--cc-text-xs);
  font-weight: var(--cc-font-medium);
  color: var(--cc-white);
  background-color: var(--cc-gray-900);
  border-radius: var(--cc-radius);
  white-space: nowrap;
  z-index: var(--cc-z-tooltip);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: var(--cc-transition);
}

.tooltip-content::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--cc-gray-900);
}

.tooltip:hover .tooltip-content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}


/* ============================================================================
 * 8. BREADCRUMBS
 * ============================================================================
 */

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--cc-space-2);
  padding: var(--cc-space-4) 0;
  font-size: var(--cc-text-sm);
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: var(--cc-space-2);
  color: var(--cc-text-secondary);
}

.breadcrumb-item a {
  color: var(--cc-text-secondary);
  text-decoration: none;
  transition: var(--cc-transition);
}

.breadcrumb-item a:hover {
  color: var(--cc-primary);
}

.breadcrumb-item.active {
  color: var(--cc-text-primary);
  font-weight: var(--cc-font-medium);
}

.breadcrumb-separator {
  color: var(--cc-text-tertiary);
}


/* ============================================================================
 * 9. PAGINATION
 * ============================================================================
 */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--cc-space-2);
  padding: var(--cc-space-6) 0;
}

.pagination-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--cc-space-3);
  font-size: var(--cc-text-sm);
  font-weight: var(--cc-font-medium);
  color: var(--cc-text-primary);
  background-color: transparent;
  border: var(--cc-border-1) solid var(--cc-border-default);
  border-radius: var(--cc-radius-lg);
  cursor: pointer;
  text-decoration: none;
  transition: var(--cc-transition);
}

.pagination-item:hover {
  background-color: var(--cc-gray-100);
  border-color: var(--cc-primary);
  color: var(--cc-primary);
}

.pagination-item.active {
  background-color: var(--cc-primary);
  border-color: var(--cc-primary);
  color: var(--cc-white);
}

.pagination-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}


/* ============================================================================
 * 10. LOADING STATES
 * ============================================================================
 */

/* Spinner */
.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--cc-gray-200);
  border-top-color: var(--cc-primary);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

.spinner-sm {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

.spinner-lg {
  width: 56px;
  height: 56px;
  border-width: 5px;
}

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

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--cc-gray-200) 25%,
    var(--cc-gray-100) 50%,
    var(--cc-gray-200) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--cc-radius);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 16px;
  margin-bottom: var(--cc-space-2);
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: var(--cc-space-4);
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--cc-radius-full);
}

.skeleton-image {
  width: 100%;
  padding-top: 75%;
  border-radius: var(--cc-radius-lg);
}


/* ============================================================================
 * 11. AVATARS
 * ============================================================================
 */

.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--cc-radius-full);
  background-color: var(--cc-gray-200);
  color: var(--cc-text-primary);
  font-weight: var(--cc-font-semibold);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: var(--cc-text-sm);
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: var(--cc-text-xl);
}

.avatar-xl {
  width: 96px;
  height: 96px;
  font-size: var(--cc-text-3xl);
}

.avatar-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border: 2px solid var(--cc-white);
  border-radius: var(--cc-radius-full);
  background-color: var(--cc-gray-400);
}

.avatar-status.online {
  background-color: var(--cc-success);
}

.avatar-status.away {
  background-color: var(--cc-warning);
}

.avatar-status.busy {
  background-color: var(--cc-danger);
}


/* ============================================================================
 * 12. DIVIDERS
 * ============================================================================
 */

.divider {
  height: var(--cc-border-1);
  background-color: var(--cc-border-light);
  border: none;
  margin: var(--cc-space-6) 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: var(--cc-space-4);
  margin: var(--cc-space-6) 0;
  font-size: var(--cc-text-sm);
  color: var(--cc-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.divider-text::before,
.divider-text::after {
  content: "";
  flex: 1;
  height: var(--cc-border-1);
  background-color: var(--cc-border-light);
}


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

@media (max-width: 768px) {
  .btn-group {
    flex-direction: column;
    width: 100%;
  }
  
  .btn-group .btn {
    width: 100%;
  }
  
  .modal {
    max-width: 100%;
    border-radius: var(--cc-radius-xl) var(--cc-radius-xl) 0 0;
  }
  
  .pagination {
    gap: var(--cc-space-1);
  }
  
  .pagination-item {
    min-width: 36px;
    height: 36px;
    font-size: var(--cc-text-xs);
  }
}


/* ============================================================================
 * FIN DE COMPONENTES
 * ============================================================================
 */

/* ============================================================================
 * DARK MODE - COMPONENTES
 * ============================================================================ */

/* Botones en Dark Mode */
:root[data-theme="dark"] .btn-primary {
  background-color: var(--cc-primary);
  color: var(--cc-white);
  border-color: var(--cc-primary);
}

:root[data-theme="dark"] .btn-primary:hover {
  background-color: var(--cc-primary-dark);
  border-color: var(--cc-primary-dark);
}

:root[data-theme="dark"] .btn-secondary {
  background-color: #374151;
  color: #F3F4F6;
  border-color: #374151;
}

:root[data-theme="dark"] .btn-secondary:hover {
  background-color: #4B5563;
  border-color: #4B5563;
}

:root[data-theme="dark"] .btn-outline {
  background-color: transparent;
  color: #F3F4F6;
  border-color: #6B7280;
}

:root[data-theme="dark"] .btn-outline:hover {
  background-color: #374151;
  border-color: #9CA3AF;
  color: #FFFFFF;
}

:root[data-theme="dark"] .btn-ghost {
  background-color: transparent;
  color: #F3F4F6;
}

:root[data-theme="dark"] .btn-ghost:hover {
  background-color: #374151;
}

/* Cards en Dark Mode */
:root[data-theme="dark"] .card {
  background-color: #1F2937;
  border-color: #374151;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

:root[data-theme="dark"] .card:hover {
  border-color: #4B5563;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* Forms en Dark Mode */
:root[data-theme="dark"] .input,
:root[data-theme="dark"] .select,
:root[data-theme="dark"] .textarea,
:root[data-theme="dark"] .form-input,
:root[data-theme="dark"] .form-select,
:root[data-theme="dark"] .form-textarea {
  background-color: #374151;
  border-color: #4B5563;
  color: #F3F4F6;
}

:root[data-theme="dark"] .input:focus,
:root[data-theme="dark"] .select:focus,
:root[data-theme="dark"] .textarea:focus,
:root[data-theme="dark"] .form-input:focus,
:root[data-theme="dark"] .form-select:focus,
:root[data-theme="dark"] .form-textarea:focus {
  border-color: var(--cc-primary);
  background-color: #374151;
  box-shadow: 0 0 0 3px rgba(240, 80, 69, 0.1);
}

:root[data-theme="dark"] .input::placeholder,
:root[data-theme="dark"] .textarea::placeholder,
:root[data-theme="dark"] .form-input::placeholder,
:root[data-theme="dark"] .form-textarea::placeholder {
  color: #9CA3AF;
}

:root[data-theme="dark"] .label {
  color: #D1D5DB;
}

:root[data-theme="dark"] .select option,
:root[data-theme="dark"] .form-select option {
  background: #374151;
  color: #F3F4F6;
}

/* Radio buttons y checkboxes en Dark Mode */
:root[data-theme="dark"] .radio-label,
:root[data-theme="dark"] .checkbox-label {
  color: #F3F4F6 !important;
  background-color: #374151 !important;
  border-color: #4B5563 !important;
}

:root[data-theme="dark"] .radio-label:hover,
:root[data-theme="dark"] .checkbox-label:hover {
  background-color: #4B5563 !important;
  border-color: #6B7280 !important;
}

:root[data-theme="dark"] .radio-input:checked + .radio-label,
:root[data-theme="dark"] .checkbox-input:checked + .checkbox-label {
  background-color: var(--cc-primary) !important;
  border-color: var(--cc-primary) !important;
  color: var(--cc-white) !important;
}

/* Badges en Dark Mode */
:root[data-theme="dark"] .badge {
  background-color: #374151;
  color: #D1D5DB;
}

:root[data-theme="dark"] .badge-success {
  background-color: rgba(16, 185, 129, 0.2);
  color: #6EE7B7;
}

:root[data-theme="dark"] .badge-warning {
  background-color: rgba(245, 158, 11, 0.2);
  color: #FCD34D;
}

:root[data-theme="dark"] .badge-danger {
  background-color: rgba(239, 68, 68, 0.2);
  color: #FCA5A5;
}

:root[data-theme="dark"] .badge-info {
  background-color: rgba(59, 130, 246, 0.2);
  color: #93C5FD;
}

/* Alerts en Dark Mode */
:root[data-theme="dark"] .alert {
  background-color: #1F2937;
  border-color: #374151;
  color: #D1D5DB;
}

:root[data-theme="dark"] .alert-success {
  background-color: rgba(16, 185, 129, 0.15);
  border-color: #10B981;
  color: #6EE7B7;
}

:root[data-theme="dark"] .alert-warning {
  background-color: rgba(245, 158, 11, 0.15);
  border-color: #F59E0B;
  color: #FCD34D;
}

:root[data-theme="dark"] .alert-danger {
  background-color: rgba(239, 68, 68, 0.15);
  border-color: #EF4444;
  color: #FCA5A5;
}

:root[data-theme="dark"] .alert-info {
  background-color: rgba(59, 130, 246, 0.15);
  border-color: #3B82F6;
  color: #93C5FD;
}

/* Modal en Dark Mode */
:root[data-theme="dark"] .modal {
  background-color: #1F2937;
  border-color: #374151;
}

:root[data-theme="dark"] .modal-header {
  border-bottom-color: #374151;
}

:root[data-theme="dark"] .modal-title {
  color: #F3F4F6;
}

:root[data-theme="dark"] .modal-close {
  color: #9CA3AF;
}

:root[data-theme="dark"] .modal-close:hover {
  background-color: #374151;
  color: #F3F4F6;
}

/* Dividers en Dark Mode */
:root[data-theme="dark"] .divider {
  background-color: #374151;
}

:root[data-theme="dark"] .divider-text {
  color: #9CA3AF;
}

:root[data-theme="dark"] .divider-text::before,
:root[data-theme="dark"] .divider-text::after {
  background-color: #374151;
}
