/* ==========================================================================
   EcoMadeira - Página de Cursos (Ajuste Falso-Encaixe Busca Figma)
   ========================================================================== */

.courses-canvas {
    position: relative;
    width: 100%;
    margin: 0 auto;
    overflow-x: clip;
}

/* ---------- Hero Banner (Padronizado conforme Treinamentos / Figma) ---------- */
.courses-hero-wrapper {
    position: relative;
    width: min(calc(100% - 32px), 1880px);
    margin: 18px auto 0;
    z-index: 1;
}

.courses-hero {
    position: relative;
    width: 100%;
    height: clamp(480px, 52vw, 860px);
    border-radius: 40px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(60px, 8vw, 120px) clamp(30px, 5vw, 80px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* Máscara orgânica apenas para desktop */
@media (min-width: 1101px) {
    @supports ((-webkit-mask-image: url("")) or (mask-image: url(""))) {
        .courses-hero {
            -webkit-mask-image: url("../img/treinamentos/union_hero_mask.c1dcce9c7221.svg");
            mask-image: url("../img/treinamentos/union_hero_mask.c1dcce9c7221.svg");
            -webkit-mask-size: 100% 100%;
            mask-size: 100% 100%;
            -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
            border-radius: 0;
            box-shadow: none;
        }
    }
}

.courses-hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
    z-index: 0;
}

.courses-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.45) 45%, rgba(0, 0, 0, 0.15) 100%);
    z-index: 1;
}

.courses-hero-content {
    position: relative;
    z-index: 2;
    max-width: 720px;
    margin-top: -20px;
}

.courses-hero-title {
    font-family: var(--font-heading);
    font-size: clamp(48px, 6.2vw, 96px);
    font-weight: 400;
    color: var(--color-text-light, #FFFFFF);
    margin-bottom: 16px;
    text-transform: uppercase;
    line-height: 1.05;
    letter-spacing: 1px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.courses-hero-text {
    font-family: var(--font-body);
    font-size: clamp(18px, 1.8vw, 30px);
    font-weight: 700;
    color: var(--color-text-light, #FFFFFF);
    line-height: 1.35;
    margin: 0;
    max-width: 660px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* ---------- Barra de Pesquisa ---------- */
.courses-search {
    position: absolute;
    right: clamp(24px, 4.5vw, 90px);
    bottom: clamp(46px, 5.5vw, 88px);
    z-index: 3;
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 50px;
    width: min(calc(100% - 48px), 580px);
    height: clamp(56px, 4.8vw, 76px);
    padding: 6px 16px 6px 8px;
    box-shadow: 0 8px 24px rgba(11, 52, 19, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.6);
    gap: 12px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.courses-search:focus-within {
    box-shadow: 0 12px 30px rgba(11, 52, 19, 0.35), 0 0 0 3px rgba(48, 113, 70, 0.3);
    transform: translateY(-2px);
}

.courses-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(44px, 3.8vw, 60px);
    height: clamp(44px, 3.8vw, 60px);
    border: none;
    border-radius: 50%;
    background: var(--color-brand-green, #307146);
    color: #ffffff;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.courses-search-btn:hover {
    background-color: #255936;
    transform: scale(1.06);
}

.courses-search-btn svg {
    width: clamp(22px, 2.2vw, 34px);
    height: clamp(22px, 2.2vw, 34px);
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.courses-search-input {
    min-width: 0;
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 0 16px;
    font-family: var(--font-body);
    font-size: clamp(15px, 1.1vw, 18px);
    font-weight: 700;
    color: var(--color-text-dark, #280D07);
}

.courses-search-input::placeholder {
    font-family: var(--font-heading);
    font-size: clamp(16px, 1.2vw, 20px);
    color: rgba(0, 0, 0, 0.43);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.courses-grid-section {
    position: relative;
    width: 100%;
    max-width: 1920px;
    margin: clamp(40px, 4vw, 70px) auto 0;
    padding: clamp(40px, 4vw, 80px) 0 clamp(80px, 8vw, 150px);
    z-index: 1;
    overflow: clip;
}

.courses-grid-wave {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: right top;
    z-index: -1;
    pointer-events: none;
}

.courses-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 40px;
}

/* Encaixe contínuo com o rodapé sem gap branco */
.courses-canvas .footer {
    margin-top: 0;
}

/* ---------- Cards de Cursos ---------- */
.course-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 24px;
    overflow: hidden;
    min-width: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.course-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.14);
}

.course-card-image {
    display: block;
    width: 100%;
    height: 240px;
    overflow: hidden;
}

.course-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-card-body {
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
}

.course-card-title {
    width: 100%;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--color-primary-dark);
    text-transform: uppercase;
    margin-bottom: 14px;
    overflow-wrap: anywhere;
}

.course-card-text {
    width: 100%;
    font-size: 0.92rem;
    line-height: 1.55;
    color: #555555;
    margin-bottom: 28px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.course-card-btn {
    align-self: center;
    padding: 12px 32px;
    border-radius: var(--radius-pill);
    background: var(--color-brand-green);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: filter var(--transition-fast);
}

.course-card-btn:hover {
    filter: brightness(1.1);
}

.courses-empty {
    position: relative;
    z-index: 2;
    padding: 100px 0 140px;
    text-align: center;
    color: var(--color-text-dark);
    font-size: 1.2rem;
}

/* ---------- Responsividade ---------- */
@media (max-width: 1280px) {
    .courses-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
        gap: 28px;
        padding: 0 32px 100px;
    }
}

@media (max-width: 1100px) {
    .courses-hero-wrapper {
        width: 100%;
        margin-top: 0;
    }

    .courses-hero {
        position: relative;
        width: 100%;
        min-height: min(88svh, 680px);
        height: auto;
        max-height: none;
        margin: 0;
        border-radius: 0 0 28px 28px !important;
        overflow: hidden !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: clamp(90px, 20vw, 120px) clamp(22px, 5.5vw, 30px) clamp(44px, 10vw, 64px);
        -webkit-mask: none !important;
        mask: none !important;
        -webkit-mask-image: none !important;
        mask-image: none !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    }

    .courses-hero-bg {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center 30%;
        z-index: 0;
    }

    .courses-hero-overlay {
        position: absolute;
        inset: 0;
        background: linear-gradient(180deg,
            rgba(0, 0, 0, 0.35) 0%,
            rgba(0, 0, 0, 0.12) 35%,
            rgba(0, 0, 0, 0.55) 100%);
        z-index: 1;
    }

    .courses-hero-content {
        position: relative;
        z-index: 2;
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: clamp(14px, 3.5vw, 22px);
        margin: 0;
        padding: 0;
        max-width: 560px;
    }

    .courses-hero-title {
        font-family: var(--font-heading);
        font-weight: 400;
        font-size: clamp(48px, 13vw, 68px);
        line-height: 1.05;
        letter-spacing: 1px;
        text-align: left;
        text-shadow: 0 2px 20px rgba(0, 0, 0, 0.35);
        margin: 0;
    }

    .courses-hero-text {
        width: 100%;
        max-width: 540px;
        font-family: var(--font-body);
        font-weight: 600;
        font-size: clamp(16px, 4.2vw, 20px);
        line-height: 1.55;
        color: rgba(255, 255, 255, 0.92);
        text-align: left;
        margin-top: clamp(2px, 1vw, 6px);
        text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
    }

    .courses-search {
        position: static;
        margin-top: clamp(20px, 5vw, 32px);
        align-self: flex-start;
        min-width: 0;
        width: 100%;
        max-width: 360px;
        height: 56px;
        padding: 0 10px 0 16px;
        border-radius: 50px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
        display: flex;
        align-items: center;
        transform: none;
        right: auto;
        bottom: auto;
        z-index: 2;
    }

    .courses-search-btn {
        width: 42px;
        height: 42px;
        flex-shrink: 0;
    }

    .courses-search-btn svg {
        width: 22px;
        height: 22px;
    }

    .courses-grid-section {
        margin-top: clamp(16px, 4vw, 28px);
        margin-bottom: 0;
        padding: 0 0 clamp(50px, 8vw, 80px);
    }

    .courses-grid-wave {
        opacity: 0.65;
        object-position: right top;
    }

    .courses-grid {
        grid-template-columns: 1fr;
        padding: 0 16px;
    }

    .course-card-image {
        height: 200px;
    }

    .course-card-btn {
        width: 100%;
        text-align: center;
    }

    .courses-empty {
        padding: 48px 16px 80px;
        font-size: 1rem;
    }
}
