/* ============================================================================
   STORE TRACK DETAIL PAGE STYLES
   styles-store-tracks.css
   ============================================================================ */

/* ============================================================================
   CSS VARIABLES (set via inline style in template for dynamic track color)
   --track-primary, --track-secondary, --track-light are set inline
   ============================================================================ */

:root {
  --store-success: #10b981;
  --store-warning: #f59e0b;
  --store-bg: #F8FAFC;
}

body {
  background-color: var(--store-bg);
}

.track-detail-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ============================================================================
   BREADCRUMB
   ============================================================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #64748b;
}

.breadcrumb a {
  color: var(--track-primary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ============================================================================
   LAYOUT
   ============================================================================ */

.track-detail-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  align-items: start;
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */

.track-main {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.track-header {
  background: linear-gradient(135deg, var(--track-primary) 0%, var(--track-secondary) 100%);
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
}

.track-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -10%;
  width: 70%;
  height: 200%;
  background: rgba(255, 255, 255, 0.05);
  transform: rotate(35deg);
}

.track-header h1 {
  color: white;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
}

.track-header-desc {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.125rem;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.track-body {
  padding: 2rem 2.5rem;
}

.content-section {
  margin-bottom: 2rem;
}

.content-section:last-child {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  direction: rtl;
  justify-content: flex-start;
}

.section-indicator {
  width: 4px;
  height: 24px;
  background: var(--track-primary);
  border-radius: 2px;
  flex-shrink: 0;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  text-align: right;
}

.section-content {
  color: #475569;
  line-height: 1.7;
  font-size: 1rem;
  display: block;
}

.section-content ul {
  padding-right: 1.5rem;
  margin: 0.5rem 0;
}

.section-content li {
  margin-bottom: 0.5rem;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */

.track-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ============================================================================
   PURCHASE PANEL
   ============================================================================ */

.purchase-panel {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border: 2px solid #e2e8f0;
  position: relative;
  overflow: hidden;
}

.purchase-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--track-primary) 0%, var(--track-secondary) 100%);
}

.purchase-panel-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 1.5rem;
  text-align: center;
}

.price-display {
  text-align: center;
  margin-bottom: 1.5rem;
}

.price-current {
  font-size: 3rem;
  font-weight: 700;
  color: var(--track-primary);
  line-height: 1;
}

.price-original {
  font-size: 1.5rem;
  color: #9ca3af;
  text-decoration: line-through;
  margin-left: 0.5rem;
}

.price-free {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--store-success);
}

.sale-badge-large {
  display: inline-block;
  background: #ef4444;
  color: white;
  padding: 0.375rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.access-period {
  color: #64748b;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.purchase-btn {
  display: block;
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--track-primary) 0%, var(--track-secondary) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  text-decoration: none;
}

.purchase-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
  color: white;
  text-decoration: none;
}

.purchase-btn.success {
  background: linear-gradient(135deg, var(--store-success) 0%, #059669 100%);
}

.purchase-btn.success:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.purchase-btn.disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.purchase-btn.disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ============================================================================
   ACCESS STATUS
   ============================================================================ */

.access-status {
  text-align: center;
  margin-bottom: 1.5rem;
}

.access-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
}

.access-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.access-title.success {
  color: var(--store-success);
}

.access-title.warning {
  color: var(--store-warning);
}

.access-subtitle {
  color: #64748b;
  font-size: 0.9375rem;
}

/* ============================================================================
   STATS PANEL
   ============================================================================ */

.stats-panel {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border: 2px solid #e2e8f0;
  position: relative;
  overflow: hidden;
}

.stats-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #06b6d4 0%, #0891b2 100%);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.8125rem;
  color: #64748b;
  font-weight: 500;
}

/* ============================================================================
   COMING SOON
   ============================================================================ */

.coming-soon-panel {
  text-align: center;
}

.coming-soon-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.coming-soon-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--store-warning);
  margin-bottom: 0.5rem;
}

.coming-soon-date {
  color: #64748b;
  font-size: 1rem;
}

/* ============================================================================
   COUPON SECTION
   ============================================================================ */

.coupon-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.coupon-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.coupon-input-group {
  display: flex;
  gap: 0.5rem;
}

.coupon-input {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.coupon-input:focus {
  outline: none;
  border-color: var(--track-primary);
}

.coupon-btn {
  padding: 0.75rem 1.25rem;
  background: var(--track-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.coupon-btn:hover {
  background: var(--track-secondary);
}

.coupon-feedback {
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.coupon-feedback.success {
  color: var(--store-success);
}

.coupon-feedback.error {
  color: #ef4444;
}

/* ============================================================================
   BACK LINK
   ============================================================================ */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--track-primary);
  text-decoration: none;
  font-weight: 500;
  margin-top: 1rem;
}

.back-link:hover {
  text-decoration: underline;
}

/* ============================================================================
   TRACK CONTENT PREVIEW - FULL WIDTH
   ============================================================================ */

.track-content-full {
  margin-top: 2rem;
  direction: rtl;
  text-align: right;
}

.track-content-full .content-section {
  margin-bottom: 1.5rem;
}

/* ============================================================================
   MULTIPLE SECTIONS VIEW - SECTION CARDS GRID (Preview Mode)
   ============================================================================ */

.sections-grid.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.section-card-modern.preview-mode {
  background: white;
  border: 2px solid #4299e1;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  opacity: 0.85;
  position: relative;
  overflow: hidden;
  direction: rtl;
  text-align: right;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.section-card-modern.preview-mode::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #4299e1 0%, #3182ce 100%);
}

.section-card-modern.preview-mode .section-card-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
  flex-direction: row-reverse;
}

.section-card-modern.preview-mode .section-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
  color: white;
  flex-shrink: 0;
}

.section-card-modern.preview-mode .section-card-info {
  flex: 1;
}

.section-card-modern.preview-mode .section-card-info h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
  min-height: 3.1em;
}

.section-card-modern.preview-mode .section-card-meta {
  font-size: 0.875rem;
  color: #64748b;
}

.section-card-modern.preview-mode .section-steps-list {
  padding: 0;
  margin: 0;
  flex: 1;
}

.section-card-modern.preview-mode .section-step-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px dashed #e2e8f0;
  cursor: default;
  flex-direction: row-reverse;
}

.section-card-modern.preview-mode .section-step-item:last-child {
  border-bottom: none;
}

.section-card-modern.preview-mode .section-step-checkbox {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  background: #f1f5f9;
  flex-shrink: 0;
}

.section-card-modern.preview-mode .section-step-text {
  font-size: 0.9rem;
  color: #475569;
  flex: 1;
  text-align: right;
}

.section-card-modern.preview-mode .section-step-time {
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
}

.preview-step {
  pointer-events: none;
}

/* ============================================================================
   SINGLE SECTION VIEW - STEP CARDS GRID (Preview Mode)
   ============================================================================ */

.steps-grid.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  align-items: stretch;
}

.step-card.preview-mode {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  opacity: 0.9;
  display: flex;
  flex-direction: column;
  direction: rtl;
  text-align: right;
  transition: all 0.3s ease;
}

.step-card.preview-mode:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.step-card.preview-mode .step-visual {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  position: relative;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}

.step-card.preview-mode .step-visual.locked {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  color: #94a3b8;
}

.step-card.preview-mode .step-visual.image {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  cursor: pointer;
  padding: 0;
  height: auto;
  min-height: 120px;
  max-height: 200px;
}

.step-card.preview-mode .step-visual.image:hover {
  opacity: 0.9;
}

.step-card.preview-mode .step-image-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.step-card.preview-mode .step-image-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  color: #64748b;
}

.step-card.preview-mode .step-number-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 2;
}

.step-card.preview-mode .step-status-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  z-index: 2;
}

.step-card.preview-mode .step-status-badge.locked {
  background: #f1f5f9;
  color: #64748b;
}

.step-card.preview-mode .step-card-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.step-card.preview-mode .step-card-variable {
  flex: 1;
}

.step-card.preview-mode .step-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.step-card.preview-mode .step-card-fixed {
  margin-top: auto;
}

.step-card.preview-mode .step-card-desc {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.step-card.preview-mode .step-card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 1rem;
}

.step-card.preview-mode .step-card-action {
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.step-card.preview-mode .step-card-btn {
  width: 100%;
  padding: 0.625rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: default;
}

.step-card.preview-mode .step-card-btn.locked {
  background: #f1f5f9;
  color: #94a3b8;
}

.step-card.preview-mode .step-card-btn.primary {
  background: var(--track-primary);
  color: white;
  cursor: pointer;
}

.step-card.preview-mode .step-card-btn.primary:hover {
  opacity: 0.9;
}

/* Image Step specific in preview */
.step-card.preview-mode.image-step {
  border-color: #93c5fd;
}

.step-card.preview-mode.image-step .step-visual {
  cursor: pointer;
}

/* Special Activity Step (page_type_id = 10) - Assessment/Test */
.step-card.preview-mode.special-activity {
  border-color: var(--track-primary);
  border-width: 3px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--track-primary);
}

.step-card.preview-mode.special-activity .step-visual {
  background: linear-gradient(135deg, var(--track-light) 0%, #e2e8f0 100%);
}

.step-card.preview-mode.special-activity .step-status-badge.locked {
  background: var(--track-light);
  color: var(--track-primary);
  border: 1px solid var(--track-primary);
}

/* ============================================================================
   IMAGE VIEWER MODAL
   ============================================================================ */

.image-viewer-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.image-viewer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.image-viewer-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 1;
}

.image-viewer-img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-viewer-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
}

.image-viewer-close:hover {
  color: #e2e8f0;
}

.image-viewer-caption {
  color: white;
  text-align: center;
  margin-top: 1rem;
  font-size: 1rem;
}

/* ============================================================================
   WHAT IS TRACK BUTTON
   ============================================================================ */

.what-is-track-btn {
  width: 100%;
  background: var(--track-light);
  color: var(--track-primary);
  padding: 0.875rem 1.5rem;
  border: 2px solid var(--track-primary);
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.what-is-track-btn:hover {
  background: var(--track-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   LOADING SKELETON
   ============================================================================ */

.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 968px) {
  .track-detail-layout {
    grid-template-columns: 1fr;
  }

  .track-sidebar {
    order: -1;
  }

  .track-header h1 {
    font-size: 1.5rem;
  }

  .track-header {
    padding: 2rem;
  }

  .track-body {
    padding: 1.5rem 2rem;
  }
}

@media (max-width: 768px) {
  .sections-grid.preview-grid {
    grid-template-columns: 1fr;
  }

  .steps-grid.preview-grid {
    grid-template-columns: 1fr;
  }
}