/* ==========================================================================
   Grundläggande stilar och layout
   ========================================================================== */
body {
    font-family: sans-serif;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}
.container {
    max-width: 940px;
    margin: 2rem auto;
}
hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 1.5rem 0;
}

/* ==========================================================================
   Header och Footer
   ========================================================================== */
.site-header {
    text-align: center;
    margin-bottom: 2rem;
}
.header-logo {
    max-width: 300px;
    width: 100%;
    height: auto;
    margin-bottom: 0rem;
}
.header-divider {
    border: 0;
    border-top: 1px solid #e0e0e0;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}
.site-header h1 {
    margin: 0;
}
footer {
    text-align: center;
    padding: 2rem 0 1rem 0;
    font-size: 0.9rem;
    color: #888;
}

/* ==========================================================================
   Utbildningskort (Desktop)
   ========================================================================== */
.course-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}
.course-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem 2rem 1.5rem;
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}
.course-title.course-topic {
    background-color: #3a3a3a;
    padding: 1rem 2rem;
    margin: -1rem -2rem 1.5rem -2rem;
    border-bottom: 1px solid #d0e8fa;
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
}
.course-meta-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}
.course-meta {
    background-color: #b3ddff;
    color: #155724;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
}
.course-meta.course-meta-secondary {
    background-color: #e8e8e8;
    color: #333;
}
.course-description {
    font-size: 0.9rem;
    margin-top: 1rem;
}
/* Container för den enskilda kurssidan */
.single-course-container {
    max-width: 980px; /* Samma bredd som vanliga containern */
    margin: 2rem auto;
}

/* Stil för "Visa denna separat"-länken */
.permalink-container {
    text-align: right;
    margin-top: 1.5rem;
}
.permalink {
    font-size: 0.8rem;
    color: #555;
    text-decoration: none;
}
.permalink:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Anmälningssidan
   ========================================================================== */
.course-summary {
    background-color: #d3efff;
    padding: 0.5rem 1.5rem 1.5rem 1.5rem;
    border-radius: 8px;
    margin-top: 1.2rem;
    margin-bottom: 2rem;
    border-left: 5px solid #007bff;
}

.summary-divider {
    border: 0;
    border-top: 1px solid rgba(0, 123, 255, 0.2); /* En mjuk linje i samma färgton */
    margin: 1rem 0;
}
.summary-details p {
    margin: 0.5rem 0; /* Tajtare mellanrum mellan raderna */
    font-size: 0.9rem;
}
.summary-description {
    font-size: 0.9rem;
    margin-top: 0rem;
    padding-top: 0rem;
    border-top: 1px solid rgba(0, 123, 255, 0.2);
}

.course-summary h2 {
    margin-top: 5px;
    margin-bottom: -10px;
}
.form-group { margin-bottom: 0.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: bold; }
.form-group input[type="text"], .form-group input[type="email"], .form-group input[type="tel"] { width: 100%; padding: 0.7rem; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }

/* Specifik styling för webinar-formulär för att säkerställa korrekt grid-layout */
.webinar-form-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
    margin-bottom: 2rem;
}

.webinar-form-grid .form-group {
    width: 100%;
    margin-bottom: 1rem;
}

.webinar-form-grid .form-group input {
    width: 100% !important;
    box-sizing: border-box;
}
.form-group-checkbox { display: flex; align-items: center; gap: 0.5rem; }
.participant-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 1rem; align-items: end; }

/* Specifik styling för checkbox-kolumnen i participant-grid */
.participant-grid .form-group:last-child {
    align-self: start;
}
.participant-grid .contact-person-section {
    margin-top: 1.5rem; /* Justera för att matcha andra fält */
}
.participant-grid .form-group-checkbox {
    justify-content: flex-start;
    margin-bottom: 0.25rem;
}
.participant-entry { border: 1px solid #e0e0e0; padding: 1rem; margin-bottom: 1rem; border-radius: 5px; background-color: #fafafa; }
.participant-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.participant-header h4 { margin: 0; }
.remove-participant-btn { background-color: #dc3545; color: #fff; border: none; border-radius: 5px; padding: 0.2rem 0.8rem; font-size: 0.9rem; line-height: 1.4; cursor: pointer; transition: background-color 0.2s; }
.remove-participant-btn:hover {
    background-color: #c82333; /* Lite mörkare röd vid hover */
}

/* ==========================================================================
   Knappar och meddelanden
   ========================================================================== */

/* Gemensam grundstil för alla knappar */
.button,
.button-secondary {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    margin-top: 1rem;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.2s;
    vertical-align: middle;
}

/* Specifik färg för den primära (blå) knappen */
.button {
    background-color: #007bff;
    color: #fff;
}

/* Specifik färg för den sekundära (grå) knappen */
.button-secondary {
    background-color: #6c757d;
    color: #fff;
}

/* Hover-effekter */
.button:hover {
    background-color: #0056b3;
    color: #fff;
}
.button-secondary:hover {
    background-color: #5a6268;
}

/* Disabled-stilar */
.button:disabled, .button-secondary:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}
.button:disabled:hover, .button-secondary:disabled:hover {
    background-color: #6c757d;
}

/* Specialregler för länkar som ser ut som knappar */
a.button, a.button-secondary {
    color: #fff !important; /* Tvinga textfärgen att vara vit */
}
a.button:visited, a.button-secondary:visited {
    color: #fff !important; /* Tvinga textfärgen vit även för besökta länkar */
}

/* Justering för knapparna på anmälningssidan */
#registration-form .button {
    margin-left: 1rem;
}

/* Meddelanden */
.message { padding: 1rem; margin-bottom: 1rem; border-radius: 5px; border: 1px solid transparent; }
.message.success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.message.error { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }
.message.info { color: #0c5460; background-color: #ffcdcd; border-color: #bee5eb; }
.success-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; align-items: baseline; }

/* ==========================================================================
   Responsiv Media (Bilder & Video)
   ========================================================================== */
.course-description img { max-width: 100%; height: auto; display: block; }
.course-description a:has(> img) { display: inline-block; line-height: 0; }
.course-description p:has(> iframe) { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; margin: 1.5rem 0; }
.course-description iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

/* ==========================================================================
   MOBILVY (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
    /* Grundläggande layout för mobil */
    .container { padding: 0; margin-top: 0; }
    .site-header h1 { font-size: 1.4rem; }
    .course-list { gap: 0; }
    .participant-grid { grid-template-columns: 1fr; gap: 0; }

    .header-logo {
    max-width: 220px;
    width: 100%;
    height: auto;
    margin-top: 1rem;
    margin-bottom: 0rem;
}

    /* Utbildningskort */
    .course-card { border-radius: 0; border: none; border-bottom: 1px solid #f0f0f0; box-shadow: 0 5px 10px -5px rgba(0,0,0,0.1); padding: 0; margin-bottom: 1rem; }
    .course-card:last-child { margin-bottom: 0; }
    .course-card:hover { transform: none; box-shadow: 0 5px 10px -5px rgba(0,0,0,0.1); }

    /* Titel- och meta-rutorna */
    .course-title.course-topic,
    .course-meta { margin: 0; border-radius: 0; padding: 1rem; }
    .course-title.course-topic { font-size: 1.2rem; border-bottom: none; margin-bottom: 1rem; }
    .course-meta { font-size: 0.8rem; gap: 0.5rem; flex-direction: column; justify-content: flex-start; align-items: flex-start; border-bottom: 1px solid #c3e6cb; }
    .course-meta-group .course-meta:last-child { border-bottom: none; }
    
    /* Beskrivning och knapp justeras */
    .course-description,
    .course-card > a.button { margin-left: 1rem; margin-right: 1rem; }
    .course-description { margin-top: 1.5rem; }
    .course-card > a.button { margin-bottom: 1.5rem; }
    .button { margin-bottom: 15px; margin-left: 10px;
}
}

/* ==========================================================================
   Accordion / Kollapsbart innehåll
   ========================================================================== */

/* Knappen "Visa mer information" */
.toggle-details-btn {
    background: none;
    border: none;
    padding: 0.5rem 0;
    margin-top: 1rem;
    font-size: 0.9rem;
    font-weight: bold;
    color: #0056b3;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.toggle-details-btn .arrow {
    transition: transform 0.3s ease;
}

/* Den dolda containern */
.collapsible-content {
    max-height: 0; /* Dold som standard */
    overflow: hidden;
    transition: max-height 0.4s ease-in-out; /* Mjuk animation */
}

/* ----- AKTIVT TILLSTÅND (när kortet är öppet) ----- */

.course-card.active .collapsible-content {
    max-height: 2000px; /* Ett högt värde som är större än innehållet någonsin blir */
}

.course-card.active .toggle-details-btn .arrow {
    transform: rotate(90deg); /* Rotera pilen */
}
/* Styling för raden med kontaktperson och fakturamärkning */
.contact-person-row {
    display: block; /* Ändra till block för att elementen ska hamna under varandra */
}
.contact-person-row .invoice-ref-field {
    margin-top: 1rem; /* Lägg till lite luft ovanför fältet när det visas */
}
.contact-person-row .form-group-checkbox {
    margin-bottom: 0;
}
.contact-person-row .invoice-ref-field {
    flex-grow: 1; /* Fältet tar upp resten av platsen */
    margin-bottom: 0;
}
.company-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0rem 1.5rem; /* 0rem vertikalt, 1.5rem horisontellt */
}

/* Stilar för kontaktperson-sektion i deltagare-grid */
.participant-grid .contact-person-section { 
    grid-column: span 3; 
    margin-top: 0.5rem; 
    padding-top: 0.5rem; 
    border-top: 1px solid #e0e0e0; 
}
.contact-person-section .form-group-checkbox { 
    margin-bottom: 0.25rem; 
}
.contact-person-section .form-group-checkbox label { 
    font-size: 0.9rem; 
    color: #333; 
    font-weight: 500;
}
.contact-person-description { 
    margin: 0; 
    font-size: 0.8rem; 
    color: #666; 
    font-style: italic;
    margin-left: 1.5rem; /* Indenterar texten för att matcha checkbox */
}

/* Responsiv design för webinar-formulär */
@media (max-width: 768px) {
    .webinar-form-grid {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }
}
/*
 ==========================================================================
   Informationsmeddelande
   ========================================================================== */
.info-message {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    font-size: 1rem;
    line-height: 1.6;
}

.info-message h1,
.info-message h2,
.info-message h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.info-message h1:first-child,
.info-message h2:first-child,
.info-message h3:first-child {
    margin-top: 0;
}

.info-message p {
    margin-bottom: 1rem;
}

/* Respektera textjustering från TinyMCE */
.info-message p[style*="text-align"],
.info-message h1[style*="text-align"],
.info-message h2[style*="text-align"],
.info-message h3[style*="text-align"],
.info-message div[style*="text-align"] {
    /* Låt inline styles från TinyMCE gälla */
}

.info-message img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
}

.info-message ul,
.info-message ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

@media (max-width: 768px) {
    .info-message {
        padding: 1.5rem;
        border-radius: 0;
    }
}
