/**
 * Programfag Catalog - Minimal styling
 * Enkel, ren design som er lett å tilpasse
 */

/* === Fargepalett (fra Bergen Private Gymnas) === */
:root {
  --primary-color: #1F4739;        /* Mørkegrønn (hovedfarge) */
  --primary-hover: #163529;        /* Mørkere grønn for hover */
  --secondary-color: #E8F5A3;      /* Lys lime/grønn */
  --text-dark: #000000;            /* Mørk tekst */
  --text-medium: #737373;          /* Medium grå tekst */
  --border-light: #e7e7e7;         /* Lys grå border */
  --background-light: #FAFAFA;     /* Lys bakgrunn */
}

/* === Container === */
#programfag-catalog {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
}

/* Sørg for at alle elementer bruker border-box */
#programfag-catalog *,
#programfag-catalog *::before,
#programfag-catalog *::after {
  box-sizing: border-box;
}

/* === Header og søk === */
.programfag-header {
  margin-bottom: 30px;
}

.programfag-header h2 {
  margin: 0 0 20px 0;
  font-size: 2rem;
  color: #333;
}

.programfag-search {
  width: 100%;
  max-width: 500px;
  padding: 12px 20px;
  font-size: 16px;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  transition: all 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.programfag-search:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 4px 8px rgba(31, 71, 57, 0.15);
}

/* === Grid layout === */
.programfag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* === Fagkort === */
.programfag-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  outline: none;
}

.programfag-card:hover,
.programfag-card:focus {
  box-shadow: 0 8px 20px rgba(31, 71, 57, 0.15);
  transform: translateY(-4px);
  border-color: var(--primary-color);
  background: linear-gradient(to bottom, white 0%, rgba(232, 245, 163, 0.05) 100%);
}

.programfag-card:focus {
  outline: 3px solid var(--secondary-color);
  outline-offset: 2px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
  gap: 10px;
}

.card-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #333;
  flex: 1;
}

.fagkode {
  background: var(--secondary-color);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--primary-color);
  white-space: nowrap;
  font-weight: 700;
}

.card-body p {
  margin: 0 0 15px 0;
  color: #666;
  line-height: 1.6;
  font-size: 0.95rem;
}

.btn-details {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 2px 6px rgba(31, 71, 57, 0.3);
}

.btn-details:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(31, 71, 57, 0.4);
}

/* === Modal === */
.programfag-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px 20px 20px;
  overflow-y: auto;
}

.modal-content {
  background: white;
  border-radius: 20px;
  padding: 40px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden; /* Forhindre horisontal scrolling */
  position: relative;
  animation: modalSlideIn 0.3s ease;
  box-shadow: 0 10px 40px rgba(31, 71, 57, 0.2);
  border: 2px solid var(--secondary-color);
  box-sizing: border-box;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #999;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s;
}

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

.modal-content h2 {
  margin: 0 0 10px 0;
  font-size: 2rem;
  color: #333;
}

.fagkode-large {
  display: inline-block;
  background: var(--secondary-color);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 20px;
}

/* === Fagbilde === */
.fag-bilde {
  margin: 20px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.fag-bilde img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 400px;
  object-fit: cover;
}

/* === Vimeo video === */
.vimeo-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  margin: 20px 0;
  border-radius: 8px;
}

.vimeo-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* === Modal body === */
.modal-body {
  margin-top: 20px;
  width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.om-faget {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #555;
  margin-bottom: 30px;
}

.modal-body h3 {
  font-size: 1.5rem;
  margin: 30px 0 15px 0;
  color: #333;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 10px;
}

.modal-body h4 {
  font-size: 1.2rem;
  margin: 20px 0 10px 0;
  color: var(--primary-color);
}

.modal-body ul {
  list-style: none;
  padding: 0;
}

.modal-body ul li {
  padding: 10px 0 10px 25px;
  position: relative;
  line-height: 1.6;
  color: #555;
}

.modal-body ul li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
}

.kjerneelement {
  margin-bottom: 20px;
  padding: 20px;
  background: white;
  border-radius: 12px;
  border-left: 5px solid var(--primary-color);
  box-shadow: 0 3px 10px rgba(31, 71, 57, 0.12);
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.kjerneelement:hover {
  box-shadow: 0 5px 16px rgba(31, 71, 57, 0.18);
  transform: translateX(4px);
}

.kjerneelement p {
  margin: 5px 0 0 0;
  color: #666;
  line-height: 1.6;
}

.btn-lareplan {
  display: inline-block;
  margin-top: 30px;
  padding: 14px 28px;
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 3px 8px rgba(31, 71, 57, 0.3);
}

.btn-lareplan:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(31, 71, 57, 0.4);
}

/* === Loading og error states === */
.loading,
.error {
  text-align: center;
  padding: 40px;
  font-size: 1.1rem;
  color: #666;
}

.error {
  color: #d32f2f;
}

/* === Ingen resultater melding === */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  background: white;
  border-radius: 16px;
  margin-top: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.no-results p {
  margin: 0 0 10px 0;
  font-size: 1.1rem;
}

.no-results strong {
  color: var(--primary-color);
}

/* === Responsiv design === */
@media (max-width: 768px) {
  .programfag-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: 30px 20px;
  }

  .modal-content h2 {
    font-size: 1.5rem;
  }

  .programfag-header h2 {
    font-size: 1.5rem;
  }

  .programfag-search {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  #programfag-catalog {
    padding: 15px;
  }

  .card-header {
    flex-direction: column;
    align-items: start;
  }

  .fagkode {
    margin-top: 5px;
  }

  .programfag-card {
    padding: 15px;
  }

  .card-body p {
    font-size: 0.9rem;
  }

  .programfag-header h2 {
    font-size: 1.3rem;
  }

  .programfag-modal {
    padding: 20px 10px;
  }

  .modal-content {
    padding: 20px 15px;
    margin: 0;
    width: 100%;
    border-width: 1px;
  }

  .modal-content h2 {
    font-size: 1.4rem;
    padding-right: 30px;
  }

  .modal-body {
    margin-left: 0;
    margin-right: 0;
  }

  .modal-body h3 {
    font-size: 1.3rem;
  }

  .kjerneelement {
    padding: 12px;
    margin-bottom: 12px;
    margin-left: 0;
    margin-right: 0;
    border-left-width: 3px;
  }

  .kjerneelement h4 {
    font-size: 1.05rem;
  }

  .kjerneelement p {
    font-size: 0.9rem;
  }

  .modal-body ul li {
    padding-right: 5px;
    font-size: 0.9rem;
  }

  .om-faget {
    font-size: 1rem;
  }

  .btn-lareplan {
    padding: 12px 20px;
    font-size: 0.9rem;
  }
}
