/**
 * Contest Plugin - Frontend Styles (Trendgo Theme)
 *
 * @package Contest Plugin
 * @version 1.0.2
 */

/* ==========================================
   CSS Variables
   ========================================== */
:root {
  --contest-primary: #dc3545;
  --contest-primary-dark: #c82333;
  --contest-secondary: #1a56db;
  --contest-dark: #1e293b;
  --contest-light: #f8fafc;
  --contest-gray: #64748b;
  --contest-border: #e2e8f0;
  --contest-success: #22c55e;
  --contest-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --contest-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --contest-radius: 16px;
  --contest-radius-sm: 8px;
}

/* ==========================================
   Contest Card - Main Container
   ========================================== */
.contest-card {
  background: #fff;
  border-radius: var(--contest-radius);
  overflow: hidden;
  box-shadow: var(--contest-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin-bottom: 24px;
}

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

/* ==========================================
   Contest Hero Image with Countdown
   ========================================== */
.contest-hero {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

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

.contest-hero-placeholder {
  width: 100%;
  height: 100%;
  background: var(--contest-secondary) !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contest-hero-placeholder i {
  font-size: 48px;
  color: #cbd5e1;
}

/* Navigation Arrows */
.contest-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.8);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
  z-index: 10;
}

.contest-nav-btn:hover {
  background: rgba(30, 41, 59, 1);
}

.contest-nav-btn.prev {
  left: 12px;
}

.contest-nav-btn.next {
  right: 12px;
}

/* ==========================================
   Countdown Timer
   ========================================== */
.contest-countdown {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.countdown-item {
  background: rgba(30, 41, 59, 0.9);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--contest-radius-sm);
  text-align: center;
  min-width: 50px;
}

.countdown-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.countdown-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
  margin-top: 4px;
}

/* ==========================================
   Contest Body
   ========================================== */
.contest-body {
  padding: 20px;
}

/* Title Row with Price */
.contest-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.contest-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--contest-secondary);
  margin: 0;
  flex: 1;
  padding-right: 12px;
}

.contest-title a {
  color: inherit;
  text-decoration: none;
}

.contest-title a:hover {
  text-decoration: underline;
}

.contest-price {
  background: var(--contest-primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--contest-radius-sm);
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

/* ==========================================
   Contest Stats Row
   ========================================== */
.contest-stats {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 20px;
}

.contest-stat {
  flex: 1;
  padding: 20px 15px;
  text-align: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.contest-stat:last-child {
  border-right: none;
}

.stat-icon {
  font-size: 24px;
  color: #3b82f6;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #3b82f6;
}

/* ==========================================
   Progress Bar
   ========================================== */
.contest-progress-container {
  margin-bottom: 20px;
}

.contest-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.contest-progress-sold {
  font-size: 13px;
  color: var(--contest-gray);
}

.contest-progress-available {
  font-size: 13px;
  font-weight: 600;
  color: var(--contest-primary);
}

.contest-progress-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.contest-progress-fill {
  height: 100%;
  background: var(--contest-primary);
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* ==========================================
   Ticket Selector
   ========================================== */
.contest-tickets {
  margin-bottom: 20px;
}

.ticket-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.ticket-option {
  flex: 1;
  min-width: 80px;
  max-width: 140px;
  padding: 16px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.ticket-option:hover {
  border-color: #1e3a8a;
  box-shadow: 0 4px 8px rgba(30, 58, 138, 0.15);
  transform: translateY(-2px);
}

.ticket-option.active {
  border-color: #1e3a8a;
  background: #1e3a8a;
  color: #fff;
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.ticket-option .ticket-count {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #1e3a8a;
}

.ticket-option.active .ticket-count {
  color: #fff;
}

.ticket-option .ticket-label {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.8;
  text-transform: capitalize;
}

.ticket-option .ticket-price {
  font-size: 14px;
  font-weight: 700;
  margin-top: 8px;
  color: #dc2626;
}

.ticket-option.active .ticket-price {
  color: #fef3c7;
}

.ticket-option .ticket-discount {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #fbbf24;
  color: #78350f;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

/* ==========================================
   Action Button
   ========================================== */
.contest-action {
  width: 100%;
}

.btn-contest-enter {
  display: block;
  width: 100%;
  padding: 14px 24px;
  background: var(--contest-primary);
  color: #fff;
  border: none;
  border-radius: var(--contest-radius-sm);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-contest-enter:hover {
  background: var(--contest-primary-dark);
  color: #fff;
  text-decoration: none;
}

.btn-contest-enter i {
  margin-right: 8px;
}

.btn-contest-view {
  display: block;
  width: 100%;
  padding: 14px 24px;
  background: var(--contest-secondary);
  color: #fff;
  border: none;
  border-radius: var(--contest-radius-sm);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-contest-view:hover {
  background: #1e40af;
  color: #fff;
  text-decoration: none;
}

/* ==========================================
   Contest Status Badges
   ========================================== */
.contest-status {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
}

.badge-contest {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-contest-active {
  background: var(--contest-primary);
  color: #fff;
}

.badge-contest-ended {
  background: var(--contest-gray);
  color: #fff;
}

.badge-contest-upcoming {
  background: #f59e0b;
  color: #fff;
}

/* ==========================================
   Contest Grid Layout
   ========================================== */
.contest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

@media (max-width: 768px) {
  .contest-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ==========================================
   Contest Page Header
   ========================================== */
.contest-page-header {
  background: var(--contest-secondary) !important;
  color: #fff !important;
  padding: 40px 24px;
  border-radius: var(--contest-radius);
  margin-bottom: 24px;
  text-align: center;
}

.contest-page-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
}

.contest-page-header p {
  font-size: 16px;
  opacity: 0.9;
  margin: 0;
}

/* ==========================================
   Empty State
   ========================================== */
.contest-empty {
  text-align: center;
  padding: 60px 24px;
  background: #fff;
  border-radius: var(--contest-radius);
  box-shadow: var(--contest-shadow);
}

.contest-empty-icon {
  font-size: 64px;
  color: #d1d5db;
  margin-bottom: 16px;
}

.contest-empty-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--contest-dark);
  margin-bottom: 8px;
}

.contest-empty-text {
  font-size: 14px;
  color: var(--contest-gray);
  margin-bottom: 24px;
}

/* ==========================================
   Contest Detail Page
   ========================================== */
.contest-detail {
  background: #fff;
  border-radius: var(--contest-radius);
  overflow: hidden;
  box-shadow: var(--contest-shadow);
}

.contest-detail-hero {
  min-height: 300px;
  position: relative;
  overflow: hidden;
}

/* When slider is present, let it control the height */
.contest-detail-hero .contest-image-slider {
  height: 400px;
}

.contest-detail-hero > img {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.contest-detail-body {
  padding: 24px;
}

.contest-detail-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--contest-dark);
  margin-bottom: 16px;
}

.contest-detail-description {
  font-size: 15px;
  color: var(--contest-gray);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ==========================================
   Responsive Adjustments
   ========================================== */
@media (max-width: 576px) {
  .contest-hero {
    height: 160px;
  }

  .countdown-item {
    padding: 6px 8px;
    min-width: 40px;
  }

  .countdown-value {
    font-size: 16px;
  }

  .countdown-label {
    font-size: 8px;
  }

  .contest-body {
    padding: 16px;
  }

  .contest-title {
    font-size: 16px;
  }

  .contest-price {
    font-size: 14px;
    padding: 6px 12px;
  }

  .contest-stat {
    padding: 8px 4px;
  }

  .stat-value {
    font-size: 12px;
  }

  .stat-label {
    font-size: 9px;
  }

  .ticket-option {
    min-width: 70px;
    max-width: none;
    padding: 12px 8px;
    font-size: 14px;
  }

  .ticket-option .ticket-count {
    font-size: 16px;
  }

  .ticket-option .ticket-price {
    font-size: 12px;
  }

  .ticket-option .ticket-discount {
    font-size: 9px;
    padding: 2px 6px;
  }
}

/* ==========================================
   Animation Classes
   ========================================== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.contest-live-indicator {
  animation: pulse 2s ease-in-out infinite;
}

/* ==========================================
   My Contests Table Enhancement
   ========================================== */
.my-contests-table {
  border-radius: var(--contest-radius);
  overflow: hidden;
}

.my-contests-table th {
  background: var(--contest-light);
  font-weight: 600;
  color: var(--contest-dark);
  border: none;
  padding: 14px 16px;
}

.my-contests-table td {
  padding: 14px 16px;
  vertical-align: middle;
  border-color: var(--contest-border);
}

.my-contests-table tr:hover {
  background: var(--contest-light);
}

/* ==========================================
   Image Slider
   ========================================== */
.contest-image-slider {
  position: relative;
  width: 100%;
  height: 400px;
  overflow: hidden;
  background: #000;
}

.contest-image-slider .slider-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.contest-image-slider .slider-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
  z-index: 1;
}

.contest-image-slider .slider-slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

.contest-image-slider .slider-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Navigation Arrows */
.contest-image-slider .slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  font-size: 18px;
}

.contest-image-slider .slider-nav:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-50%) scale(1.05);
}

.contest-image-slider .slider-prev {
  left: 20px;
}

.contest-image-slider .slider-next {
  right: 20px;
}

/* Dots Navigation */
.contest-image-slider .slider-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
}

.contest-image-slider .slider-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.contest-image-slider .slider-dot:hover {
  background: rgba(255, 255, 255, 0.8);
}

.contest-image-slider .slider-dot.active {
  background: #fff;
  border-color: var(--contest-primary);
  transform: scale(1.2);
}

/* Slider responsive */
@media (max-width: 768px) {
  .contest-image-slider {
    height: 250px;
  }
  
  .slider-nav {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
  
  .slider-prev {
    left: 10px;
  }
  
  .slider-next {
    right: 10px;
  }
  
  .slider-dots {
    bottom: 10px;
  }
  
  .slider-dot {
    width: 8px;
    height: 8px;
  }
}
