/* OnlyCatalog Cards - Styles v2.0 */

/* CSS переменные для удобной кастомизации */
:root {
  --oc-radius: 22px;
  --oc-shadow-soft: 0 10px 26px rgba(15,23,42,0.06);
  --oc-shadow-hover: 0 18px 40px rgba(15,23,42,0.14);
  --oc-accent: #00aff0;
  --oc-accent-hover: #0091ea;
  --oc-accent-soft: #E4F3FF;
  --oc-text: #0F172A;
  --oc-muted: #6B7280;
  --oc-border-soft: rgba(148,163,253,0.06);
  --oc-live: #981B3C;
  --oc-live-dark: #7C102E;
  --oc-success: #22C55E;
}

/* ==================== GRID LAYOUT ==================== */

.occ-grid-wrap {
  position: relative;
}

.occ-grid {
  display: grid;
  grid-template-columns: repeat(var(--oc-cols, 4), minmax(0, 1fr));
  gap: var(--oc-gap, 20px);
  animation: fadeIn 0.5s ease;
}

/* Responsive Grid */
@media (max-width: 1200px) {
  .occ-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .occ-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .occ-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== CARD STYLES ==================== */

.occ-card {
  background: #ffffff;
  border-radius: var(--oc-radius);
  overflow: hidden;
  box-shadow: var(--oc-shadow-soft);
  border: 1px solid var(--oc-border-soft);
  display: flex;
  flex-direction: column;
  min-height: 380px;
  transition: all .22s cubic-bezier(.22, .61, .36, 1);
  animation: cardAppear 0.4s ease;
  animation-fill-mode: both;
}

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

/* Stagger animation for cards */
.occ-card:nth-child(1) { animation-delay: 0.05s; }
.occ-card:nth-child(2) { animation-delay: 0.1s; }
.occ-card:nth-child(3) { animation-delay: 0.15s; }
.occ-card:nth-child(4) { animation-delay: 0.2s; }
.occ-card:nth-child(5) { animation-delay: 0.25s; }
.occ-card:nth-child(6) { animation-delay: 0.3s; }
.occ-card:nth-child(7) { animation-delay: 0.35s; }
.occ-card:nth-child(8) { animation-delay: 0.4s; }
.occ-card:nth-child(9) { animation-delay: 0.45s; }
.occ-card:nth-child(10) { animation-delay: 0.5s; }
.occ-card:nth-child(11) { animation-delay: 0.55s; }
.occ-card:nth-child(12) { animation-delay: 0.6s; }

/* Cards loaded via AJAX - no delay */
.occ-card.loaded {
  animation: fadeInUp 0.3s ease;
}

/* ==================== THUMBNAIL ==================== */

.occ-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.occ-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}

.occ-card:hover .occ-thumb img {
  transform: scale(1.08);
}

.occ-no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 500;
}

/* Verified Badge */
.occ-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  z-index: 1;
}

.occ-badge--verified {
  background: rgba(37, 99, 235, 0.9);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* ==================== CARD BODY ==================== */

.occ-body {
  padding: 12px 14px 14px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  flex: 1 !important;
}

/* Title Row */
.occ-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.occ-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--oc-text);
  flex: 1;
  line-height: 1.3;
}

/* Labels */
.occ-label-wrap {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-shrink: 0;
}

.occ-label {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.occ-label--free {
  background: #E6F9EE;
  color: #16A34A;
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.08);
}

.occ-label--price {
  background: var(--oc-accent-soft);
  color: var(--oc-accent);
  box-shadow: 0 0 0 1px rgba(0, 175, 240, 0.1);
}

/* Meta info */
.occ-meta {
  font-size: 13px;
  color: var(--oc-muted);
}

.occ-user {
  font-weight: 500;
}

/* Description */
.occ-desc {
  margin: 2px 0 0 !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
  color: var(--oc-muted) !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  min-height: 0 !important;
  max-height: 36px !important;
}

/* ==================== BUTTONS ==================== */

.occ-btn-wrap {
  margin-top: auto !important;
  padding-top: 6px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 7px !important;
}

.occ-btn {
  display: block !important;
  width: 100% !important;
  padding: 11px 16px !important;
  border-radius: 14px !important;
  border: 0 !important;
  font-weight: 600 !important;
  font-size: 15px !important;
  text-align: center !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: all .22s cubic-bezier(.22, .61, .36, 1) !important;
  position: relative !important;
  overflow: hidden !important;
  line-height: 1.4 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* Primary Button */
.occ-btn--primary {
  background: var(--oc-accent) !important;
  color: #ffffff !important;
  box-shadow: 0 9px 22px rgba(0, 175, 240, 0.26) !important;
}

.occ-btn--primary:hover,
.occ-btn--primary:focus,
.occ-btn--primary:visited {
  background: var(--oc-accent-hover) !important;
  box-shadow: 0 14px 32px rgba(0, 145, 234, 0.32) !important;
  transform: translateY(-1px) !important;
  color: #ffffff !important;
}

.occ-btn--primary:active {
  background: var(--oc-accent-hover) !important;
  box-shadow: 0 5px 16px rgba(0, 145, 234, 0.25) !important;
  transform: translateY(0) !important;
  color: #ffffff !important;
}

/* Ripple effect on click */
.occ-btn--primary::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%);
  transform-origin: 50% 50%;
}

.occ-btn--primary:focus:not(:active)::after {
  animation: ripple 0.6s ease-out;
}

/* Live Button */
.occ-btn--live {
  padding: 9px 16px !important;
  font-size: 14px !important;
  background: var(--oc-live) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 20px rgba(152, 27, 60, 0.32) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.occ-btn--live:hover,
.occ-btn--live:focus,
.occ-btn--live:visited {
  background: var(--oc-live-dark) !important;
  box-shadow: 0 10px 24px rgba(124, 16, 46, 0.40) !important;
  transform: translateY(-1px) !important;
  color: #ffffff !important;
}

.occ-btn--live:active {
  background: var(--oc-live-dark) !important;
  box-shadow: 0 4px 14px rgba(124, 16, 46, 0.35) !important;
  transform: translateY(0) !important;
  color: #ffffff !important;
}

/* Live Dot Animation */
.occ-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--oc-success);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulse 1.4s infinite;
  flex-shrink: 0;
}

/* ==================== LOADER / SPINNER ==================== */

.occ-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 20px;
  min-height: 200px;
  transition: opacity 0.3s ease;
}

.occ-spinner {
  width: 70px;
  text-align: center;
}

.occ-spinner > div {
  width: 14px;
  height: 14px;
  background-color: var(--oc-accent);
  border-radius: 100%;
  display: inline-block;
  animation: sk-bouncedelay 1.4s infinite ease-in-out both;
  margin: 0 3px;
}

.occ-spinner .occ-bounce1 {
  animation-delay: -0.32s;
}

.occ-spinner .occ-bounce2 {
  animation-delay: -0.16s;
}

/* Loading skeleton for cards */
.occ-skeleton {
  animation: skeleton-loading 1s linear infinite alternate;
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  border-radius: var(--oc-radius);
  min-height: 380px;
}

/* Empty state */
.occ-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--oc-muted);
  font-size: 16px;
}

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

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

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

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

@keyframes sk-bouncedelay {
  0%, 80%, 100% { 
    transform: scale(0);
    opacity: 0.5;
  } 
  40% { 
    transform: scale(1.0);
    opacity: 1;
  }
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 1;
  }
  100% {
    transform: scale(40, 40);
    opacity: 0;
  }
}

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

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

/* Remove text decoration from all links in cards */
.occ-card a {
  text-decoration: none !important;
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Preload critical fonts if needed */
.occ-card * {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Performance optimization */
.occ-card img {
  /* will-change removed to fix hover animation freeze */
}

/* Accessibility */
.occ-btn:focus-visible {
  outline: 2px solid var(--oc-accent);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .occ-btn--live,
  .occ-loader {
    display: none !important;
  }
}