/**
 * Custom LearnPress Single Course Page Styles
 * Professional Clean Layout
 * Supports Dark/Light Mode with CSS Variables
 * 
 * Based on modern course platform designs
 * Uses theme color variables for consistency
 */

/* ============================================
   HIDE OLD LEARNPRESS DEFAULT LAYOUT
   ============================================ */

/* Hide the old purple course header section completely */
.single-lp_course .course-meta-info,
.single-lp_course .course-summary-sidebar,
.single-lp_course #learn-press-course:not(.cofinex-course-layout),
.single-lp_course .learn-press-tabs:not(.cofinex-toc .learn-press-tabs),
.single-lp_course .course-summary:not(.cofinex-course-layout) {
  display: none !important;
}

/* Only show our custom layout */
.single-lp_course .cofinex-course-layout {
  display: grid !important;
}

/* ============================================
   COURSE BREADCRUMBS
   ============================================ */

.cofinex-course-breadcrumbs {
  background: var(--border-color);
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.cofinex-course-breadcrumbs .breadcrumb {
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 14px;
}

.cofinex-course-breadcrumbs .breadcrumb-item {
  color: var(--dark-variant-one);
}

.cofinex-course-breadcrumbs .breadcrumb-item a {
  color: var(--dark-variant-one);
  text-decoration: none;
  transition: color 0.3s ease;
}

.cofinex-course-breadcrumbs .breadcrumb-item a:hover {
  color: var(--brand-blue);
}

.cofinex-course-breadcrumbs .breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 600;
}

.cofinex-course-breadcrumbs .breadcrumb-item + .breadcrumb-item::before {
  content: ">";
  color: var(--dark-variant-one);
  padding: 0 8px;
}

/* ============================================
   MAIN LAYOUT STRUCTURE
   ============================================ */

.single-lp_course #main-content.site-main {
  background: var(--bg-primary);
  min-height: 60vh;
  padding: 0;
}

.course-summary.professional-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
  background: var(--bg-primary);
  font-family: var(--font-family);
}

.lp-course-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 60px;
  align-items: start;
}

/* ============================================
   COURSE BANNER WITH OVERLAPPING INSTRUCTOR
   ============================================ */

.lp-course-banner-wrapper {
  position: relative;
  margin-bottom: 60px;
}

.lp-course-banner {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-secondary);
}

.lp-course-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Default Banner Pattern */
.lp-default-banner {
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    var(--brand-blue) 0%,
    var(--brand-blue-teal) 50%,
    var(--brand-blue) 100%
  );
  position: relative;
  overflow: hidden;
}

.lp-banner-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(
      circle at 20% 50%,
      rgba(255, 255, 255, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(circle at 80% 50%, rgba(0, 0, 0, 0.1) 0%, transparent 50%);
}

/* Instructor Overlay (Bottom Left) */
.lp-instructor-overlay {
  position: absolute;
  bottom: -30px;
  left: 30px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 10;
}

.lp-instructor-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 4px solid var(--bg-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.lp-instructor-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lp-course-by-text {
  font-size: 15px;
  color: var(--text-secondary);
  background: var(--bg-primary);
  padding: 8px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.lp-course-by-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ============================================
   COURSE TITLE & DESCRIPTION
   ============================================ */

.lp-course-main-title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin: 0 0 24px 0;
  font-family: var(--font-family);
}

.lp-course-main-description {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 48px;
}

.lp-course-main-description p {
  margin-bottom: 16px;
}

.lp-course-main-description h2,
.lp-course-main-description h3,
.lp-course-main-description h4 {
  color: var(--text-primary);
  font-weight: 600;
  margin: 24px 0 12px 0;
}

.lp-course-main-description strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ============================================
   TABLE OF CONTENTS
   ============================================ */

.lp-course-toc-section {
  margin-bottom: 48px;
}

.lp-toc-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 20px 0;
}

.lp-course-curriculum-wrapper {
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

/* Curriculum Styling */
.learn-press-tabs,
.course-curriculum {
  background: transparent;
  border: none;
  padding: 0;
}

.course-curriculum .curriculum-sections {
  padding: 0;
}

.curriculum-sections .section {
  margin: 0;
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  background: transparent;
}

.curriculum-sections .section:last-child {
  border-bottom: none;
}

.curriculum-sections .section-header {
  padding: 20px 24px;
  background: transparent;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.curriculum-sections .section-header:hover {
  background: var(--bg-tertiary);
}

.curriculum-sections .section-content {
  padding: 0;
  background: var(--bg-primary);
}

.curriculum-sections .course-item {
  padding: 16px 24px 16px 48px;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 14px;
  transition: background 0.2s ease;
}

.curriculum-sections .course-item:hover {
  background: var(--bg-tertiary);
}

/* ============================================
   INFO SECTIONS (Assignment, Prerequisites, Materials)
   ============================================ */

.lp-info-sections {
  margin-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.lp-info-section-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
}

.lp-info-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px 0;
}

.lp-info-section-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

.lp-info-section-text p {
  margin-bottom: 8px;
}

.lp-info-section-text p:last-child {
  margin-bottom: 0;
}

/* ============================================
   SIDEBAR PROFESSIONAL
   ============================================ */

.lp-course-sidebar-professional {
  position: sticky;
  top: 100px;
}

/* Price at Top */
.lp-sidebar-price-top {
  margin-bottom: 16px;
}

.lp-price-amount-top {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-family);
  display: block;
}

.lp-price-original-top {
  font-size: 18px;
  color: var(--text-secondary);
  text-decoration: line-through;
  font-weight: 400;
  margin-left: 8px;
}

.lp-price-free-top {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-green);
  font-family: var(--font-family);
  display: block;
}

/* Reviews Summary */
.lp-sidebar-reviews {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.lp-reviews-stars {
  display: flex;
  gap: 4px;
}

.lp-reviews-stars .review-stars-rated,
.lp-reviews-stars .star {
  color: var(--color-orange);
  font-size: 16px;
}

.lp-reviews-count-link {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: underline;
  cursor: pointer;
}

.lp-reviews-count-link:hover {
  color: var(--text-primary);
}

/* Metadata Box */
.lp-sidebar-metadata-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
}

.lp-meta-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.lp-meta-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.lp-meta-item:first-child {
  padding-top: 0;
}

.lp-meta-item-full {
  grid-template-columns: 24px 1fr;
}

.lp-meta-item-full .lp-meta-value {
  grid-column: 2 / 3;
  text-align: left;
}

.lp-meta-icon {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.lp-meta-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

.lp-meta-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
}

/* ============================================
   ACTION BUTTONS
   ============================================ */

.lp-sidebar-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lp-enroll-button-wrapper {
  width: 100%;
}

/* Enroll Button Styles */
.lp-enroll-button-wrapper .lp-button,
.lp-enroll-button-wrapper button[type="submit"],
.lp-enroll-button-wrapper .course-enroll-button,
#learn-press-course .lp-button.lp-button-enroll,
#learn-press-course .lp-button.lp-button-purchase {
  width: 100%;
  padding: 16px 24px;
  background: var(--text-primary) !important;
  color: var(--bg-primary) !important;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  border: 2px solid var(--text-primary) !important;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family);
  display: block;
}

.lp-enroll-button-wrapper .lp-button:hover,
#learn-press-course .lp-button.lp-button-enroll:hover,
#learn-press-course .lp-button.lp-button-purchase:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

/* Gift Button */
.lp-gift-button {
  width: 100%;
  padding: 16px 24px;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  border: 2px solid var(--text-primary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.lp-gift-button:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.lp-gift-button svg {
  width: 18px;
  height: 18px;
}

/* ============================================
   COURSE REVIEWS
   ============================================ */

.lp-course-reviews-full {
  margin-top: 48px;
  padding: 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.lp-course-reviews-full h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 24px 0;
}

.lp-course-reviews-full .course-review {
  margin-bottom: 24px;
  padding: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1200px) {
  .lp-course-container {
    grid-template-columns: 1fr 360px;
    gap: 50px;
  }

  .lp-course-main-title {
    font-size: 32px;
  }
}

@media (max-width: 1024px) {
  .lp-course-container {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .lp-course-sidebar-professional {
    position: static;
    max-width: 500px;
    margin: 0 auto;
  }

  .lp-course-main-title {
    font-size: 30px;
  }
}

@media (max-width: 768px) {
  .course-summary.professional-layout {
    padding: 30px 15px;
  }

  .lp-course-banner-wrapper {
    margin-bottom: 70px;
  }

  .lp-instructor-overlay {
    flex-direction: column;
    align-items: flex-start;
    left: 20px;
    bottom: -60px;
  }

  .lp-course-by-text {
    font-size: 14px;
  }

  .lp-course-main-title {
    font-size: 26px;
  }

  .lp-course-main-description {
    font-size: 15px;
  }

  .lp-sidebar-metadata-box {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .lp-course-main-title {
    font-size: 22px;
  }

  .lp-instructor-avatar-large {
    width: 60px;
    height: 60px;
  }

  .lp-price-amount-top {
    font-size: 28px;
  }

  .lp-sidebar-action-buttons {
    gap: 10px;
  }

  .lp-enroll-button-wrapper .lp-button,
  .lp-gift-button {
    padding: 14px 20px;
    font-size: 14px;
  }
}

/* ============================================
   LEARNPRESS TABS OVERRIDE
   ============================================ */

.learn-press-tabs .course-nav {
  display: none;
}

.learn-press-tabs .course-tab-panel {
  display: block !important;
}

.learn-press-tabs .course-tab-panel-content {
  padding: 0;
}

/* ============================================
   DARK/LIGHT MODE ADJUSTMENTS
   ============================================ */

/* Dark mode specific */
[data-theme="dark"] .lp-course-banner {
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .lp-sidebar-metadata-box,
[data-theme="dark"] .lp-course-curriculum-wrapper,
[data-theme="dark"] .lp-info-section-card,
[data-theme="dark"] .lp-course-reviews-full {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Light mode specific */
[data-theme="light"] .lp-sidebar-metadata-box,
[data-theme="light"] .lp-course-curriculum-wrapper,
[data-theme="light"] .lp-info-section-card,
[data-theme="light"] .lp-course-reviews-full {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ============================================
   ADDITIONAL POLISH
   ============================================ */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection colors */
::selection {
  background: var(--brand-blue);
  color: var(--bg-primary);
}

::-moz-selection {
  background: var(--brand-blue);
  color: var(--bg-primary);
}

/* Focus states for accessibility */
button:focus,
a:focus {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

/* Loading states */
.lp-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ============================================
   CUSTOM COURSE LAYOUT STYLES (from inline)
   ============================================ */

/* Enrollment Success/Error Messages */
.cofinex-enrollment-message {
  max-width: 1400px;
  margin: 20px auto;
  padding: 16px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
}

.cofinex-enrollment-message.cofinex-success {
  background: rgba(26, 178, 12, 0.15);
  border: 1px solid var(--color-green, #1ab20c);
  color: var(--color-green, #1ab20c);
}

.cofinex-enrollment-message.cofinex-error {
  background: rgba(234, 55, 55, 0.15);
  border: 1px solid var(--color-red, #ea3737);
  color: var(--color-red, #ea3737);
}

/* Main Course Layout */
.cofinex-course-layout {
  max-width: 1400px;
  margin: 40px auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 50px;
  font-family: var(--font-family, Arial, sans-serif);
  position: relative;
}
.cofinex-course-layout::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%3E%3Ccircle%20cx='5'%20cy='5'%20r='2'%20fill='%2315e5e8'%20opacity='0.25'/%3E%3C/svg%3E");
  opacity: 0.6;
  background-repeat: repeat;
  pointer-events: none;
}

.cofinex-main-content {
  background: var(--bg-primary, #141418);
}

/* Banner */
.cofinex-banner {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(
    135deg,
    var(--brand-blue, #15e5e8),
    var(--brand-blue-teal, #1847b5)
  );
  border-radius: 16px;
  margin-bottom: 60px;
  position: relative;
}

.cofinex-instructor-overlay {
  position: absolute;
  bottom: -30px;
  left: 30px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-primary, #141418);
  padding: 8px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cofinex-instructor-overlay img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
}

.cofinex-instructor-overlay span {
  color: var(--text-secondary, #81818c);
}

.cofinex-instructor-overlay strong {
  color: var(--text-primary, #fff);
}

/* Title & Description */
.cofinex-title {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary, #fff);
  margin: 0 0 24px 0;
  text-align: center;
}

.cofinex-description {
  color: var(--text-secondary, #81818c);
  line-height: 1.7;
  margin-bottom: 40px;
}

/* Table of Contents Box */
.cofinex-toc {
  background: var(--bg-secondary, #181821);
  border: 1px solid var(--border-color, #2a2a33);
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 40px;
}

.cofinex-toc h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary, #81818c);
  margin: 0 0 24px 0;
}

.cofinex-curriculum-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Curriculum Sections */
.curriculum-section-item {
  background: var(--bg-primary, #141418);
  border: 1px solid var(--border-color, #2a2a33);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.curriculum-section-item:hover {
  border-color: var(--brand-blue, #15e5e8);
}

.curriculum-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.curriculum-section-header:hover {
  background: var(--bg-secondary, #181821);
}

.section-title-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.section-number {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-blue, #15e5e8);
  color: var(--text-primary, #fff);
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #fff);
  margin: 0;
}

.section-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-secondary, #81818c);
}

.item-count {
  font-size: 14px;
}

.toggle-icon {
  transition: transform 0.3s ease;
}

.curriculum-section-item.expanded .toggle-icon {
  transform: rotate(180deg);
}

.curriculum-section-desc {
  padding: 0 24px 16px 72px;
  color: var(--text-secondary, #81818c);
  font-size: 14px;
  line-height: 1.6;
}

.curriculum-items-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--border-color, #2a2a33);
  display: none;
}

.curriculum-section-item.expanded .curriculum-items-list {
  display: block;
}

.curriculum-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 16px 72px;
  border-bottom: 1px solid var(--border-color, #2a2a33);
  color: var(--text-secondary, #81818c);
  font-size: 15px;
  transition: all 0.3s ease;
}

.curriculum-item:last-child {
  border-bottom: none;
}

.curriculum-item:hover {
  background: var(--bg-secondary, #181821);
  color: var(--text-primary, #fff);
  padding-left: 80px;
}

.curriculum-item i {
  color: var(--brand-blue, #15e5e8);
  font-size: 16px;
}

/* Sidebar */
.cofinex-sidebar {
  position: sticky;
  top: 100px;
}

.cofinex-price {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary, #fff);
  margin-bottom: 24px;
  font-family: var(--font-family);
}

.cofinex-price.free {
  color: var(--color-green, #1ab20c);
}

.cofinex-meta-box {
  background: var(--bg-secondary, #181821);
  border: 1px solid var(--border-color, #2a2a33);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.cofinex-meta-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color, #2a2a33);
  align-items: center;
}

.cofinex-meta-item:last-child {
  border-bottom: none;
}

.cofinex-meta-icon {
  width: 20px;
  height: 20px;
  color: var(--text-secondary, #81818c);
}

.cofinex-meta-label {
  font-size: 14px;
  color: var(--text-secondary, #81818c);
}

.cofinex-meta-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #fff);
}

/* Start Learning Button */
.cofinex-start-learning-btn {
  width: 100%;
  padding: 18px 32px;
  background: linear-gradient(
    135deg,
    var(--brand-blue),
    var(--brand-blue-teal)
  );
  color: var(--text-primary, #fff);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(21, 229, 232, 0.3);
  margin-bottom: 16px;
}

.cofinex-start-learning-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(21, 229, 232, 0.5);
}

.cofinex-start-learning-btn i {
  font-size: 14px;
}

/* Share Button */
.cofinex-share-button {
  width: 100%;
  padding: 16px 24px;
  background: transparent;
  color: var(--text-primary, #fff);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  border: 2px solid var(--border-color, #2a2a33);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  margin-top: 12px;
}

.cofinex-share-button:hover {
  border-color: var(--brand-blue, #15e5e8);
  color: var(--brand-blue, #15e5e8);
  background: rgba(21, 229, 232, 0.05);
}

/* Responsive for custom layout */
@media (max-width: 1024px) {
  .cofinex-course-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .cofinex-sidebar {
    position: static;
  }
}
