/**
 * tienda-utilities.css — Animations, badges, tooltips, and utilities
 */

/* ====================================================================== */
/* ANIMATIONS */
/* ====================================================================== */

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

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

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

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

.tienda-animate-fadeInUp {
  animation: fadeInUp 0.5s ease-out;
}

.tienda-animate-slideInRight {
  animation: slideInRight 0.4s ease-out;
}

.tienda-animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.tienda-animate-spin {
  animation: spin 1s linear infinite;
}

.tienda-animate-bounceIn {
  animation: bounceIn 0.6s ease-out;
}

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

.tienda-badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.tienda-badge-new {
  background-color: #00d4ff;
  color: #000;
}

.tienda-badge-hot {
  background-color: #e74c3c;
  color: white;
}

.tienda-badge-discount {
  background-color: #2ecc71;
  color: white;
}

.tienda-badge-featured {
  background-color: #f39c12;
  color: #000;
}

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

.tienda-spinner {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(0, 212, 255, 0.3);
  border-top-color: #00d4ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.tienda-spinner-lg {
  width: 50px;
  height: 50px;
  border-width: 4px;
}

.tienda-loading-text {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--tienda-text-muted);
  font-size: 0.95rem;
}

/* ====================================================================== */
/* TOOLTIPS */
/* ====================================================================== */

[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  background-color: #1a1f26;
  color: #00d4ff;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
  margin-bottom: 8px;
  border: 1px solid #00d4ff;
  animation: fadeInUp 0.2s ease-out;
}

[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #1a1f26;
  pointer-events: none;
  z-index: 1001;
}

/* ====================================================================== */
/* FOCUS VISIBLE */
/* ====================================================================== */

.tienda-form-control:focus-visible,
.tienda-select:focus-visible,
.tienda-btn-primary:focus-visible,
.tienda-btn-agregar:focus-visible {
  outline: 2px solid #00d4ff;
  outline-offset: 2px;
}

a:focus-visible {
  outline: 2px solid #00d4ff;
  outline-offset: 2px;
  border-radius: 2px;
}

/* ====================================================================== */
/* SMOOTH SCROLLING */
/* ====================================================================== */

html {
  scroll-behavior: smooth;
}

/* ====================================================================== */
/* TRANSITIONS DEFAULT */
/* ====================================================================== */

* {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

button,
a,
input,
select {
  transition: all 0.2s ease;
}

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

.tienda-text-primary {
  color: #0d2c54;
}

.tienda-text-accent {
  color: #00d4ff;
}

.tienda-text-success {
  color: #2ecc71;
}

.tienda-text-danger {
  color: #e74c3c;
}

.tienda-text-warning {
  color: #f39c12;
}

.tienda-text-muted {
  color: var(--tienda-text-muted);
}

.tienda-text-light {
  color: var(--tienda-text-light);
}

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

.tienda-bg-primary {
  background-color: #0d2c54;
}

.tienda-bg-accent {
  background-color: #00d4ff;
}

.tienda-bg-card {
  background-color: var(--tienda-card-bg);
}

.tienda-bg-hover {
  background-color: var(--tienda-hover-bg);
}

.tienda-bg-dark {
  background-color: #0f1419;
}

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

.tienda-border {
  border: 1px solid var(--tienda-border);
}

.tienda-border-accent {
  border: 1px solid #00d4ff;
}

.tienda-border-top {
  border-top: 1px solid var(--tienda-border);
}

.tienda-border-bottom {
  border-bottom: 1px solid var(--tienda-border);
}

.tienda-rounded {
  border-radius: 6px;
}

.tienda-rounded-lg {
  border-radius: 8px;
}

.tienda-rounded-xl {
  border-radius: 12px;
}

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

.tienda-shadow-sm {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tienda-shadow-md {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tienda-shadow-lg {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.tienda-shadow-accent {
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

/* ====================================================================== */
/* DISPLAY & VISIBILITY */
/* ====================================================================== */

.tienda-display-flex {
  display: flex;
}

.tienda-display-grid {
  display: grid;
}

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

.tienda-gap-1 { gap: 0.5rem; }
.tienda-gap-2 { gap: 1rem; }
.tienda-gap-3 { gap: 1.5rem; }
.tienda-gap-4 { gap: 2rem; }

.tienda-flex-wrap {
  flex-wrap: wrap;
}

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

.tienda-flex-column {
  display: flex;
  flex-direction: column;
}

/* ====================================================================== */
/* OPACITY */
/* ====================================================================== */

.tienda-opacity-50 {
  opacity: 0.5;
}

.tienda-opacity-75 {
  opacity: 0.75;
}

.tienda-opacity-100 {
  opacity: 1;
}

/* ====================================================================== */
/* CURSOR */
/* ====================================================================== */

.tienda-cursor-pointer {
  cursor: pointer;
}

.tienda-cursor-default {
  cursor: default;
}

.tienda-cursor-not-allowed {
  cursor: not-allowed;
  opacity: 0.5;
}

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

@media (max-width: 1024px) {
  .tienda-hidden-tablet {
    display: none;
  }
}

@media (max-width: 640px) {
  .tienda-hidden-mobile {
    display: none;
  }

  .tienda-visible-mobile {
    display: block;
  }

  .tienda-stack-mobile {
    flex-direction: column;
  }
}

@media (min-width: 1025px) {
  .tienda-visible-mobile {
    display: none;
  }
}

/* ====================================================================== */
/* FORM ERROR STATES */
/* ====================================================================== */

.tienda-form-error {
  border-color: #e74c3c !important;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1) !important;
}

.tienda-form-error-message {
  color: #e74c3c;
  font-size: 0.85rem;
  margin-top: 0.25rem;
  display: block;
}

.tienda-form-success {
  border-color: #2ecc71 !important;
}

/* ====================================================================== */
/* DISABLED STATES */
/* ====================================================================== */

.tienda-btn-primary:disabled,
.tienda-btn-agregar:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.tienda-form-control:disabled,
.tienda-select:disabled {
  background-color: var(--tienda-border);
  cursor: not-allowed;
  opacity: 0.7;
}

/* ====================================================================== */
/* HOVER LIFT EFFECT */
/* ====================================================================== */

.tienda-hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tienda-hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

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

.tienda-skeleton {
  background: linear-gradient(
    90deg,
    var(--tienda-hover-bg) 25%,
    var(--tienda-border) 50%,
    var(--tienda-hover-bg) 75%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

.tienda-skeleton-text {
  height: 1rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.tienda-skeleton-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
}

/* ====================================================================== */
/* TRUNCATE TEXT */
/* ====================================================================== */

.tienda-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tienda-line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tienda-line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.tienda-scale-hover {
  transition: transform 0.3s ease;
}

.tienda-scale-hover:hover {
  transform: scale(1.05);
}

.tienda-rotate-hover {
  transition: transform 0.3s ease;
}

.tienda-rotate-hover:hover {
  transform: rotate(5deg);
}

/* ====================================================================== */
/* ACCESSIBILITY */
/* ====================================================================== */

.tienda-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Ensure links have underline on hover for accessibility */
a {
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
  .tienda-form-control,
  .tienda-select,
  button {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
