/**
 * Single Utbildningar Template Styles
 */

.single-utbildningar {
  background: var(--background-color);
}

/* Single Utbildning Hero Section */
.single-utbildning-hero {
  position: relative;
  height: 600px;
  min-height: 500px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--spacing-3xl);
  overflow: hidden;
  margin: 0;
}

.single-utbildning-hero .hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #132938;
  background: linear-gradient(
    90deg,
    rgba(19, 41, 56, 1) 0%,
    rgba(255, 255, 255, 0) 96%
  );

  z-index: 1;
}

.single-utbildning-hero .hero-content-container {
  position: relative;
  z-index: 2;
  text-align: center;
  width: 100%;
}

.single-utbildning-hero .hero-content {
  gap: var(--spacing-md);
  color: var(--text-white);
  max-width: 800px;
  margin: 0 auto;
}

.single-utbildning-hero .hero-subtitle-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.single-utbildning-hero .hero-breadcrumb {
  color: var(--text-white);

  font-size: var(--font-size-sm);
  opacity: 0.9;
}

.single-utbildning-hero .hero-breadcrumb a {
  color: var(--primary-color);
  text-decoration: none;
  opacity: 0.8;
}

.single-utbildning-hero .hero-breadcrumb a:hover {
  opacity: 1;
}

.single-utbildning-hero .hero-title {
  font-size: var(--h1-lg-size);
  color: var(--text-white);
  margin: 0;
  line-height: 1.2;
}

.single-utbildning-hero .hero-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-xl);
  line-height: 1.5;
  color: var(--text-white);
  margin: 0;
  margin-top: 1rem;
  opacity: 0.9;
  font-weight: 400;
}

@media (max-width: 767px) {
  .single-utbildning-hero .hero-subtitle {
    font-size: var(--font-size-md);
  }
}

.instructor-section {
  margin-top: 4rem;
  overflow-x: auto;
  width: 100%;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) transparent;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.instructor-section::-webkit-scrollbar {
  height: 8px;
}

.instructor-section::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.instructor-section::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

.course-content {
  background: linear-gradient(
    180deg,
    rgba(248, 248, 240, 1) 70%,
    rgba(255, 255, 255, 1) 70%
  );
}
/* Layout */
.course-layout {
  display: grid;
  grid-template-columns: 70% 30%;
  gap: var(--spacing-8xl);
  align-items: start;
}

/* Sidebar */
.course-sidebar {
  position: sticky;
  top: var(--spacing-2xl);
  z-index: 10;
  right: 3rem;
}

.course-info-card {
  background: white;
  border-radius: 5px;
  padding: var(--spacing-2xl);
  box-shadow: var(--box-shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
  margin-top: 8rem;
}
.course-info-card h3 {
  font-size: var(--text-3xl);
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
  color: var(--text-blue);
}

.info-item {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: var(--spacing-sm) 0;
}

.info-item:last-of-type {
  border-bottom: none;
}

.info-label {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  color: var(--text-blue);
}

.info-value {
  font-weight: 400;
  color: var(--text-blue);
  text-align: right;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

.info-value small {
  font-weight: 400;
  font-size: var(--text-xs);
  display: block;
  margin-top: 0;
  color: var(--text-blue);
}

.info-icon {
  font-size: 18px;
  width: 25px;
  color: var(--primary-color);
}

.price-item {
  border-top: 1px solid var(--color-border);
  padding-top: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  margin-top: 1rem;
}

.price-item .info-value {
  font-size: var(--text-2xl);
  color: var(--text-blue);
  font-weight: 700;
}

.course-cta {
  margin-top: var(--spacing-xl);
}

.course-cta .button {
  width: 100% !important;
  max-width: none;
}

/* Main Content */
.course-main {
  max-width: none;
  margin-bottom: var(--spacing-6xl);
}

.course-section h2 {
  font-size: var(--h3-lg-size);

  margin-bottom: var(--spacing-xl);
  color: var(--text-blue);
}

.course-text {
  font-size: var(--font-size-md);
  line-height: 1.7;
  color: var(--text-color);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.course-text p {
  margin-bottom: var(--spacing-md);
}

.course-text ul,
.course-text ol,
.info-content ul,
.info-content ol {
  margin-left: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

/* More Information Grid */

.more-info-section h2 {
  text-align: center;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: var(--spacing-xl);
}

.info-block {
  background: white;
  padding: var(--spacing-4xl);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.info-block h3 {
  font-size: var(--text-2xl);
  color: var(--text-blue);
  margin-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--spacing-md);
}

.info-content {
  font-size: var(--font-size-sm);
  line-height: 1.6;
  color: var(--text-color-muted);
}

/* Instructor Section */

.course-section-content {
  background: white;
  box-shadow: var(--box-shadow);
  border-radius: 10px;
  gap: var(--spacing-4xl);
  border: 1px solid var(--color-border);
  padding: var(--spacing-4xl);
  h2 {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--spacing-lg);
  }
}

.instructor-card {
  display: flex;
  flex-direction: row;
  white-space: normal;
  vertical-align: top;
  gap: var(--spacing-2xl);
  width: 100%;
  min-width: auto;
}

.instructor-image {
  flex: 0 0 40%;
  max-width: 50%;
}

.instructor-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 8px;
}

.instructor-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  justify-content: center;
}

.instructor-name {
  font-size: var(--h4-lg-size);
  color: var(--text-blue);
  margin-bottom: var(--spacing-xs);
}

.instructor-title {
  font-size: var(--font-size-md);
  color: var(--primary-color);
  margin-bottom: var(--spacing-md);
}

.instructor-description {
  line-height: 1.6;
  color: var(--text-color-muted);
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

/* Schedule Table */
.schedule-table {
  overflow: hidden;
  box-shadow: var(--box-shadow);
}

.schedule-table tbody {
  font-size: var(--text-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.schedule-table table {
  width: 100%;
  border-collapse: collapse;
}

.schedule-table td {
  padding: var(--spacing-md) 0;
  vertical-align: middle;
  color: var(--text-blue);
  white-space: nowrap;
  .button {
    width: auto;
  }
  &:has(.no-schedule-text) {
    white-space: normal;
    text-wrap: balance;
  }
}

.schedule-table tr {
  background: white;
  border-left: 3px solid var(--primary-color);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  box-shadow: var(--box-shadow);
  display: flex;
  justify-content: space-between;
  border-radius: 5px;
  align-items: center;
  padding-inline: var(--spacing-xl);
  padding-block: var(--spacing-lg);

  &:has(.no-schedule-text) {
    gap: var(--spacing-lg);
    .button {
      width: 160px;
    }
  }
}

.schedule-table tr:last-child td {
  border-bottom: none;
}

.td-price {
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--text-blue);
  gap: var(--spacing-xs);
  align-items: flex-end;
  span {
    font-weight: 400;
    font-size: var(--text-xs);
    margin-top: 0;
    color: #777777;
  }
}

.status-badge {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: 20px;
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-available {
  background: #d4edda;
  color: #155724;
}

.status-few_left {
  background: #fff3cd;
  color: #856404;
}

.status-full {
  background: #f8d7da;
  color: #721c24;
}

.schedule-book-btn {
  font-size: var(--font-size-sm);
  padding: var(--spacing-xs) var(--spacing-md);
}

/* Schedule Table Icons */
.schedule-icon {
  margin-right: var(--spacing-xs);
  color: var(--primary-color);
  font-size: var(--font-size-sm);
  width: 14px;
  text-align: center;
}

.literature-section {
  text-align: center;
}

/* FAQ Section */
.course-faq-section {
  margin-top: var(--spacing-4xl);
}
.course-faq-wrapper {
  display: flex;
  gap: var(--spacing-2xl);
  & > * {
    flex: 1;
  }
}
.course-faq {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}
.course-faq-toggle {
  display: flex;
  justify-content: space-between;
  gap: var(--spacing-2xl);
  box-shadow: var(--box-shadow);
  padding: var(--spacing-xl);
  border-radius: 12px;
  background-color: var(--color-green-light);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.125);
  width: 100%;
  h2,
  h3,
  h4 {
    font-size: var(--text-lg);
    margin: 0;
    text-align: left;
  }

  .fa-minus {
    display: none;
  }
  &:has(+ .course-faq-answer[aria-hidden="false"]) {
    .fa-plus {
      display: none;
    }
    .fa-minus {
      display: inline-block;
    }
  }
}

.course-faq-answer {
  font-size: var(--font-size-sm);
  line-height: 1.6;
  color: var(--text-color-muted);
  height: auto;
  overflow: hidden;
  transition: height 0.3s ease;
  padding-inline: var(--spacing-md);
  margin-top: var(--spacing-sm);
  &[aria-hidden="true"] {
    height: 0;
    overflow: hidden;
  }
}

/* Responsive Design */
@media (max-width: 1023px) {
  .course-layout {
    gap: var(--spacing-2xl);
    grid-template-columns: 1fr;
  }

  .course-section-content {
    flex-direction: column;
  }

  .course-sidebar {
    order: -1;
    position: static;
  }

  .single-utbildning-hero .hero-title {
    font-size: var(--h1-sm-size);
  }

  .instructor-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .instructor-image {
    justify-self: center;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .schedule-table {
    overflow-x: auto;
  }

  .schedule-table table {
    min-width: 600px;
  }

  .course-info-card {
    margin-top: 2rem;
  }
  .course-faq-wrapper {
    flex-direction: column;
  }
}

@media (max-width: 767px) {
  .single-utbildning-hero {
    height: 50vh;
    min-height: 400px;
  }

  .single-utbildning-hero .hero-title {
    font-size: var(--h2-sm-size);
  }

  .single-utbildning-hero .hero-subtitle {
    font-size: var(--font-size-md);
  }

  .course-info-card {
    padding: var(--spacing-lg);
  }

  .course-section-content {
    padding: 1rem;
  }

  .info-block {
    padding: var(--spacing-lg);
    font-size: var(--text-2xl);
  }

  .instructor-card {
    padding: var(--spacing-lg);
  }

  .schedule-table th,
  .schedule-table td {
    padding: var(--spacing-sm);
  }
}

/* Mobile responsive - Stack table content vertically */
@media (max-width: 767px) {
  .schedule-table tr {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: var(--spacing-lg);
    gap: var(--spacing-sm);
    min-width: auto;
  }

  .schedule-table td {
    padding: var(--spacing-xs) 0;
    margin: 0;
    width: 100%;
    display: flex;

    align-items: center;
  }

  .td-price {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: var(--spacing-sm);
    margin-top: var(--spacing-sm);
  }

  .schedule-book-btn {
    width: 100%;
    text-align: center;
    margin-top: var(--spacing-sm);
  }

  .schedule-table {
    overflow-x: visible;
  }

  .schedule-table table {
    min-width: auto;
  }
}

/* Course Registration Modal */
.course-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.course-modal.active {
  opacity: 1;
  visibility: visible;
}

.course-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.course-modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  max-width: 1000px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.course-modal.active .course-modal-content {
  transform: translateY(0);
}

.course-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 2rem 1rem;
  border-bottom: 1px solid #eee;
}

.course-modal-header h3 {
  margin: 0;
  color: var(--text-blue);
  font-size: 1.5rem;
}

.course-modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.course-modal-close:hover {
  background: #f5f5f5;
  color: #333;
}

.course-modal-body {
  padding: 2rem;
}

.selected-course-info {
  background: var(--color-green-light);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.selected-course-info h4 {
  margin: 0 0 1rem 0;
  color: var(--text-blue);
  font-size: 1.1rem;
}

.course-details p {
  margin: 0.5rem 0;
  color: var(--text-blue);
}

.course-details strong {
  font-weight: 600;
}

.course-registration-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.course-registration-form .form-group {
  margin-bottom: 1.5rem;
}

.course-registration-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-blue);
}

.course-registration-form input,
.course-registration-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e1e5e9;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.course-registration-form input:focus,
.course-registration-form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.course-registration-form input:invalid,
.course-registration-form textarea:invalid {
  border-color: #dc3545;
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  line-height: 1.4;
  font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.checkbox-label a {
  color: var(--primary-color);
  text-decoration: underline;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.form-actions .btn {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.form-actions .btn-secondary {
  background: #6c757d;
  color: white;
}

.form-actions .btn-secondary:hover {
  background: #5a6268;
}

.form-actions .btn-primary {
  background: var(--primary-color);
  color: white;
}

.form-actions .btn-primary:hover {
  background: var(--secondary-color);
}

/* Success/Error Messages */
.form-message {
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-weight: 500;
}

.form-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.form-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .course-modal-content {
    width: 95%;
    margin: 1rem;
  }

  .course-modal-header,
  .course-modal-body {
    padding: 1.5rem;
  }

  .course-registration-form .form-row {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }
}

/* Radio button styling */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.radio-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-blue);
  position: relative;
  padding-left: 30px;
  font-weight: 500;
}

.radio-title {
  padding: 0;
}

.radio-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.radio-checkmark {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 18px;
  width: 18px;
  background-color: #fff;
  border: 2px solid #ddd;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.radio-label:hover input ~ .radio-checkmark {
  border-color: var(--primary-color);
}

.radio-label input:checked ~ .radio-checkmark {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.radio-checkmark:after {
  content: "";
  position: absolute;
  display: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
}

.radio-label input:checked ~ .radio-checkmark:after {
  display: block;
}

/* Instructor section overflow fixes */
.instructor-section {
  overflow-x: auto;
  width: 100%;
}

.instructor-card {
  min-width: 0; /* Allows flex items to shrink below content size */
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.instructor-info {
  min-width: 0;
  flex: 1;
}

.instructor-description {
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

/* Ensure course content section doesn't overflow */
.course-section-content {
  overflow-x: auto;
  width: 100%;
}

.course-text {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Mobile specific fixes */
@media (max-width: 768px) {
  .instructor-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .instructor-image {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
  }
}

/* Discount Code Section */
.discount-code-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}

.discount-code-wrapper input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.discount-code-wrapper input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.discount-code-wrapper .btn {
  white-space: nowrap;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.discount-message {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
}

.discount-message.error {
  background: #fee2e2;
  color: #dc2626;
}

.discount-message.success {
  background: #dcfce7;
  color: #16a34a;
}

.discount-applied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
  border: 1px solid #86efac;
  border-radius: 8px;
}

.discount-applied .discount-info {
  color: #166534;
  font-weight: 600;
  font-size: 0.95rem;
}

.discount-applied .remove-discount {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.discount-applied .remove-discount:hover {
  background: rgba(220, 38, 38, 0.1);
}

/* Price Summary Section */
.price-summary {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.price-summary .price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.95rem;
  color: #64748b;
}

.price-summary .price-row:not(:last-child) {
  border-bottom: 1px solid #e2e8f0;
}

.price-summary .discount-row {
  color: #16a34a;
}

.price-summary .discount-row span:last-child {
  font-weight: 600;
}

.price-summary .total-row {
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  border-bottom: none !important;
}

.price-summary .total-row span {
  font-size: 1.1rem;
  color: var(--text-blue);
}

.price-summary .total-row strong {
  font-size: 1.1rem;
  color: var(--text-blue);
}

.schedule-section {
  background-color: var(--color-green-light);
  box-shadow: var(--box-shadow);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border);
  scroll-margin: 10rem;
  margin-top: var(--spacing-6xl);
  @media (max-width: 767px) {
    padding: 2rem 1rem;
  }
}
