/**
 * Theme Block Styles - New Blocks
 *
 * Styles for hero-simple, malgrupper-v2, moduler, hvordan, and prosjektinfo blocks.
 *
 * @package Astra-Child
 */

/* ===================
   CONTAINER UTILITY
   Matches Astra's .ast-container: content-width + 40px padding
   =================== */

.container-astra {
    max-width: calc(var(--container-width, 1280px) + 40px);
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* ===================
   FULL WIDTH BLOCKS
   =================== */

.hero-simple-block,
.malgrupper-v2-block,
.moduler-block,
.hvordan-block,
.prosjektinfo-block,
.kontakt-block {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    position: relative;
}

/* Editor-specific: Reset full-width in editor */
.block-editor-block-list__layout .hero-simple-block,
.block-editor-block-list__layout .malgrupper-v2-block,
.block-editor-block-list__layout .moduler-block,
.block-editor-block-list__layout .hvordan-block,
.block-editor-block-list__layout .prosjektinfo-block,
.block-editor-block-list__layout .kontakt-block {
    margin-top: 0;
    margin-bottom: 0;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
}

/* ===================
   SECTION BADGES
   =================== */

.section-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
}

/* Emerald variant */
.section-badge--emerald {
    background-color: #d1fae5; /* emerald-100 */
    color: #047857; /* emerald-700 */
}

/* Blue variant */
.section-badge--blue {
    background-color: #dbeafe; /* blue-100 */
    color: #1d4ed8; /* blue-700 */
}

/* Purple variant */
.section-badge--purple {
    background-color: #ede9fe; /* purple-100 */
    color: #6d28d9; /* purple-700 */
}

/* Slate variant */
.section-badge--slate {
    background-color: #e2e8f0; /* slate-200 */
    color: #475569; /* slate-600 */
}

/* Amber variant */
.section-badge--amber {
    background-color: #fef3c7; /* amber-100 */
    color: #b45309; /* amber-700 */
}

/* ===================
   HERO SIMPLE BLOCK
   =================== */

.hero-simple-gradient-bg {
    background: linear-gradient(
        to bottom,
        #ecfdf5,  /* emerald-50 */
        #f8fafc   /* slate-50 */
    );
}

.hero-simple-container {
    display: block !important;
}

/* ===================
   MÅLGRUPPER V2 BLOCK
   =================== */

.malgrupper-v2-container {
    display: block !important;
}

.malgruppe-card {
    display: block !important;
}

/* ===================
   MODULER BLOCK
   =================== */

.moduler-container {
    display: block !important;
}

/* Module cards - remove all link styling */
a.modul-card,
a.modul-card:hover,
a.modul-card:focus,
a.modul-card:visited {
    text-decoration: none !important;
    cursor: pointer;
}

a.modul-card *,
a.modul-card:hover *,
a.modul-card:focus * {
    text-decoration: none !important;
}

.modul-card {
    display: block !important;
}

/* Subtle left border accent on hover */
.modul-card--blue:hover {
    border-left: 3px solid #3b82f6; /* blue-500 */
}

.modul-card--emerald:hover {
    border-left: 3px solid #10b981; /* emerald-500 */
}

/* Card text colors - ensure they override link defaults */
.modul-card .text-blue-500 { color: #3b82f6 !important; }
.modul-card .text-slate-500 { color: #64748b !important; }
.modul-card .text-slate-800 { color: #1e293b !important; }
.modul-card .text-emerald-500 { color: #10b981 !important; }

/* ===================
   HVORDAN BLOCK
   =================== */

.hvordan-container {
    display: block !important;
}

.hvordan-step {
    position: relative;
}

/* Connector line between steps on desktop */
@media (min-width: 768px) {
    .hvordan-step:not(:last-child)::after {
        content: '';
        position: absolute;
        top: 32px; /* Half of circle height */
        left: calc(50% + 40px); /* Start after the circle */
        width: calc(100% - 80px); /* Span to next circle */
        height: 2px;
        background: linear-gradient(to right, #e2e8f0, #e2e8f0);
        z-index: 0;
    }
}

/* ===================
   KONTAKT BLOCK
   =================== */

.kontakt-container {
    display: block !important;
}

.kontakt-card {
    display: block !important;
}

/* Remove link underlines in kontakt block */
a.kontakt-link,
a.kontakt-link:hover,
a.kontakt-link:focus,
a.kontakt-link:visited {
    text-decoration: none !important;
}

/* ===================
   PROSJEKTINFO BLOCK
   =================== */

.prosjektinfo-container {
    display: block !important;
}

.prosjektinfo-card {
    display: block !important;
}

/* Style InnerBlocks content */
.prosjektinfo-content p {
    color: #475569; /* slate-600 */
    font-size: 1.125rem;
    line-height: 1.75;
    margin-bottom: 1rem;
}

.prosjektinfo-content p:last-child {
    margin-bottom: 0;
}

.prosjektinfo-content h2,
.prosjektinfo-content h3 {
    color: #1e293b; /* slate-800 */
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.prosjektinfo-content h2:first-child,
.prosjektinfo-content h3:first-child {
    margin-top: 0;
}

.prosjektinfo-content ul,
.prosjektinfo-content ol {
    color: #475569;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.prosjektinfo-content li {
    margin-bottom: 0.5rem;
}

/* Note box */
.prosjektinfo-note {
    display: flex !important;
}

/* ===================
   REDUCED MOTION
   =================== */

@media (prefers-reduced-motion: reduce) {
    .malgruppe-card,
    .modul-card,
    .hvordan-step,
    .kontakt-link {
        transition: none;
    }
}

/* ===================
   SINGLE KURSMODUL TEMPLATE
   =================== */

/* Override Astra container for kursmodul pages - only content area, not header */
.single-kursmodul .site-content > .ast-container {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.single-kursmodul .site-content {
    padding-top: 0 !important;
}

/* Base layout */
.kursmodul-page {
    position: relative;
    width: 100%;
}

/* ---- HERO ---- */
.kursmodul-hero {
    width: 100%;
    padding: 2.5rem 1.5rem 3.5rem;
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .kursmodul-hero {
        padding: 3rem 2rem 4.5rem;
    }
}

.kursmodul-hero--slate {
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%); /* blue-50 to blue-100 */
}

.kursmodul-hero--emerald {
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
}

.kursmodul-hero__inner {
    max-width: calc(var(--container-width, 1280px) + 40px);
    margin: 0 auto;
    padding: 0 20px;
}

/* Back link */
.kursmodul-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    margin-bottom: 2rem;
    padding: 0.5rem 1rem 0.5rem 0.75rem;
    background: rgba(255,255,255,0.8);
    border-radius: 100px;
    border: 1px solid rgba(148,163,184,0.2);
    transition: all 0.2s;
}

.kursmodul-back:hover {
    color: #10b981;
    background: #fff;
    transform: translateX(-3px);
}

/* Hero content */
.kursmodul-hero__content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Emoji icon */
.kursmodul-emoji {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

@media (min-width: 768px) {
    .kursmodul-emoji {
        width: 88px;
        height: 88px;
        font-size: 2.75rem;
        border-radius: 22px;
    }
}

.kursmodul-emoji--slate {
    background: linear-gradient(135deg, #fff 0%, #eff6ff 100%); /* white to blue-50 */
    border: 1px solid #93c5fd; /* blue-300 */
}

.kursmodul-emoji--emerald {
    background: linear-gradient(135deg, #fff 0%, #ecfdf5 100%);
    border: 1px solid #a7f3d0;
}

/* Badges */
.kursmodul-badges {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.kursmodul-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.4375rem 0.875rem;
    border-radius: 100px;
}

.kursmodul-badge--slate {
    background: #2563eb; /* blue-600 */
    color: #fff;
}

.kursmodul-badge--emerald {
    background: #059669;
    color: #fff;
}

.kursmodul-del {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: 100px;
}

.kursmodul-del--slate {
    background: rgba(37,99,235,0.12); /* blue-600 with opacity */
    color: #1d4ed8; /* blue-700 */
}

.kursmodul-del--emerald {
    background: rgba(16,185,129,0.15);
    color: #047857;
}

/* Title */
.kursmodul-title {
    font-size: 1.875rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0.25rem 0 0;
}

@media (min-width: 768px) {
    .kursmodul-title {
        font-size: 2.5rem;
    }
}

@media (min-width: 1024px) {
    .kursmodul-title {
        font-size: 3rem;
    }
}

/* Description */
.kursmodul-desc {
    font-size: 1.0625rem;
    line-height: 1.6;
    color: #475569;
    margin: 0;
    max-width: 600px;
}

@media (min-width: 768px) {
    .kursmodul-desc {
        font-size: 1.1875rem;
    }
}

/* Provider */
.kursmodul-provider {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0.5rem 0 0;
}

.kursmodul-provider__label {
    font-weight: 600;
    color: #475569;
}

/* ---- CONTENT SECTION ---- */
.kursmodul-content-wrap {
    width: 100%;
    padding: 0 0 3rem;
    margin-top: -1.5rem;
    background: #f8fafc;
}

@media (min-width: 768px) {
    .kursmodul-content-wrap {
        padding: 0 0 4rem;
        margin-top: -2rem;
    }
}

.kursmodul-content-inner {
    max-width: calc(var(--container-width, 1280px) + 40px);
    margin: 0 auto;
    padding: 0 20px;
}

/* Article */
.kursmodul-article {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.02);
    border: 1px solid #e2e8f0;
    min-height: 200px;
}

@media (min-width: 768px) {
    .kursmodul-article {
        padding: 2.5rem 3rem;
        border-radius: 20px;
    }
}

/* Article typography */
.kursmodul-article {
    color: #475569;
    font-size: 1rem;
    line-height: 1.75;
}

.kursmodul-article h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: #1e293b;
    margin: 2rem 0 0.75rem;
    padding-bottom: 0.625rem;
    border-bottom: 2px solid #e2e8f0;
}

.kursmodul-article h2:first-child {
    margin-top: 0;
}

.kursmodul-article h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #334155;
    margin: 1.5rem 0 0.5rem;
}

.kursmodul-article p {
    margin-bottom: 1rem;
}

.kursmodul-article ul,
.kursmodul-article ol {
    margin: 1rem 0;
    padding-left: 1.25rem;
}

.kursmodul-article li {
    margin-bottom: 0.5rem;
}

.kursmodul-article li::marker {
    color: #10b981;
}

.kursmodul-article a {
    color: #059669;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.kursmodul-article a:hover {
    color: #047857;
}

/* Empty state */
.kursmodul-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #94a3b8;
}

/* Sidebar */
.kursmodul-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    order: 1;
}

@media (min-width: 768px) {
    .kursmodul-sidebar {
        order: 2;
        position: sticky;
        top: 1.5rem;
        height: fit-content;
    }
}

/* Info box */
.kursmodul-info-box {
    background: #fff;
    border-radius: 14px;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
}

.kursmodul-info-box h3 {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin: 0 0 0.875rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid #e2e8f0;
}

.kursmodul-info-box ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.kursmodul-info-box li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.8125rem;
}

.kursmodul-info-box li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.kursmodul-info-box span {
    color: #64748b;
}

.kursmodul-info-box strong {
    color: #1e293b;
    font-weight: 600;
}

/* Progress box */
.kursmodul-progress-box {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 14px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.kursmodul-progress-box--emerald {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
}

.kursmodul-progress-num {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
}

.kursmodul-progress-text {
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.75);
}

/* ---- NAVIGATION ---- */
.kursmodul-nav {
    width: 100%;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 2.5rem 0;
}

@media (min-width: 768px) {
    .kursmodul-nav {
        padding: 3rem 0;
    }
}

.kursmodul-nav__inner {
    max-width: calc(var(--container-width, 1280px) + 40px);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.kursmodul-nav__grid {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}

@media (min-width: 640px) {
    .kursmodul-nav__grid {
        gap: 1.5rem;
    }
}

/* Nav card */
.kursmodul-nav-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    text-decoration: none;
    transition: all 0.2s;
}

.kursmodul-nav-card__icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.kursmodul-nav-card__content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.kursmodul-nav-card:hover {
    background: #fff;
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16,185,129,0.1);
    transform: translateY(-2px);
}

.kursmodul-nav-card--next {
    flex-direction: row-reverse;
    text-align: right;
}

.kursmodul-nav-card--next .kursmodul-nav-card__content {
    align-items: flex-end;
}

.kursmodul-nav-card--empty {
    background: transparent;
    border: 1px dashed #e2e8f0;
    pointer-events: none;
}

.kursmodul-nav-card__dir {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #10b981;
}

.kursmodul-nav-card__title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 640px) {
    .kursmodul-nav-card__title {
        font-size: 1.0625rem;
    }
}

/* All modules link */
.kursmodul-all-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    padding: 0.625rem 1.25rem;
    background: #f1f5f9;
    border-radius: 100px;
    transition: all 0.2s;
}

.kursmodul-all-link:hover {
    color: #10b981;
    background: #ecfdf5;
}

/* ---- REDUCED MOTION ---- */
@media (prefers-reduced-motion: reduce) {
    .kursmodul-back,
    .kursmodul-nav-card,
    .kursmodul-all-link {
        transition: none;
    }
}
