/* KAICE Slider Frontend Styles - 최적화된 구조 */

/* 테마 CSS 변수 사용 - 별도 폰트 로드 불필요 */

/* 배경 래퍼 - 페이지 전체 배경 */
.kaice-slider-background-wrapper {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    background-color: var(--theme-header-bg, #70A0AC);
    height: 600px; /* 고정 높이 */
    overflow: hidden;
    z-index: 1; /* 메뉴(z-index: 99999)보다 아래에 위치하도록 설정 */
}

/* 슬라이더 컨테이너 - 중심 컨테이너 */
.kaice-slider-container {
    position: relative;
    width: 100%;
    max-width: 1920px; /* 슬라이더 배경은 1920px 유지 */
    height: 100%; /* 부모(wrapper)의 높이 상속 */
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 콘텐츠 영역 제한을 위한 래퍼 */
.kaice-slider-container .swiper-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.kaice-slider-container .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center; /* 콘텐츠 중앙 정렬 */
}

/* 슬라이드 내부 콘텐츠를 1200px로 제한 */
.kaice-slider-slide .kaice-slider-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Swiper 래퍼 */
.kaice-slider-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Swiper 컨테이너 */
.kaice-slider-wrapper .swiper-container {
    width: 100%;
    height: 100%;
}

.kaice-slider-wrapper .swiper-wrapper {
    height: 100%;
}

/* 슬라이드 */
.kaice-slider-slide {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    background: #fff;
    color: #fff;
    overflow: hidden;
}

.kaice-slider-slide.has-image {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* 배경 오버레이 */
.kaice-slider-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../img/bg-scaled.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.83;
    z-index: 1;
}

/* 마크 이미지 */
.kaice-slider-slide .kaice-slider-mark {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 400px;
    height: 400px;
    background-image: url('../img/mark.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 50;
    opacity: 0.2;
    pointer-events: none;
}

/* 슬라이드 콘텐츠 */
.kaice-slider-content {
    position: relative;
    z-index: 100;
    text-align: left;
    padding: 2rem 2rem 2rem 4rem;
    max-width: 800px;
    margin: 0 auto; /* 중앙 정렬을 위해 추가 */
    width: 100%;
    box-sizing: border-box;
    /* 기본 상태: 보임 - JavaScript가 로드되지 않아도 콘텐츠가 보이도록 */
    transform: translateX(0);
    opacity: 1;
    transition: all 0.8s ease-in-out;
    transition-delay: 0s;
}

/* Swiper loop 모드로 인한 문제 해결: CSS 선택자 대신 JavaScript로만 제어 */
/* .js-loaded .kaice-slider-slide:not(.swiper-slide-active) .kaice-slider-content 규칙 제거 */

/* 활성 슬라이드 콘텐츠 */
.swiper-slide-active .kaice-slider-content {
    transform: translateX(0) !important;
    opacity: 1 !important;
    transition: all 0.8s ease-out !important;
    transition-delay: 0.2s !important;
}

.kaice-slider-title {
    font-family: var(--theme-font-normal, 'S-CoreDream-3', sans-serif);
    font-weight: 300;
    font-size: 0.938em;
    letter-spacing: 0.25em;
    margin-left: 0.25em;
    margin-bottom: 0.5em;
    color: var(--theme-text-color, #333);
}

.kaice-slider-subtitle {
    font-family: var(--theme-font-normal, 'S-CoreDream-3', sans-serif);
    font-size: var(--theme-font-size-hero);
    font-weight: 300;
    line-height: 1.25;
    margin: 0.5em 0;
    color: var(--theme-text-color, #333);
}

.kaice-slider-subtitle .kaice-slider-highlight {
    font-family: var(--theme-font-extend, 'S-CoreDream-5', sans-serif);
    font-weight: 500;
    color: var(--theme-main-color, #408090);
}

.kaice-slider-description {
    font-family: var(--theme-font-normal, 'S-CoreDream-3', sans-serif);
    font-size: var(--theme-font-size-heading);
    color: var(--theme-text-color, #333);
    margin-left: 0.063em;
    display: flex;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
}

/* 링크 호버 효과 */
a.kaice-slider-description:hover {
    color: var(--theme-main-color, #408090);
    text-decoration: none;
}

a.kaice-slider-description:hover::before {
    background-color: var(--theme-button-hover-bg, rgba(64, 128, 144, 0.9));
}

.kaice-slider-description::before {
    content: '\f061';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    background-color: var(--theme-main-color, #408090);
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 0.8em;
    flex-shrink: 0;
}



/* 속도 설정 */
.kaice-slider-container[data-speed="slow"] .swiper-slide {
    transition-duration: 1000ms !important;
}

.kaice-slider-container[data-speed="normal"] .swiper-slide {
    transition-duration: 600ms !important;
}

.kaice-slider-container[data-speed="fast"] .swiper-slide {
    transition-duration: 300ms !important;
}

.kaice-slider-container .swiper-container {
    --swiper-theme-color: #007aff;
    --swiper-navigation-size: 44px;
}

.kaice-slider-container .swiper-wrapper {
    transition-timing-function: ease-in-out;
}

/* 배경 그라디언트 */
@media (min-width: 1200px) {
    .kaice-slider-background-wrapper {
        background: linear-gradient(135deg, #bcc8d1 0%, #c8d4db 50%, #b8c6d0 100%);
    }
}

@media (min-width: 2560px) {
    .kaice-slider-background-wrapper {
        background: linear-gradient(to right, #bcc8d1 0%, #c8d4db 20%, #c4d0d7 40%, #c4d0d7 60%, #c8d4db 80%, #bcc8d1 100%);
    }
}

/* 1020px 이하에서 슬라이더 레이아웃 조정 */
@media (max-width: 1020px) {
    .kaice-slider-background-wrapper {
        height: 400px;
        overflow: visible;
    }
}

/* 1020px 이하에서만 보이는 하단 회원 폼 */
.kaice-slider-bottom-form {
    display: none; /* 기본적으로 숨김 */
    margin: 0; /* 기본 마진 제거 */
}

@media (max-width: 1020px) {
    .kaice-slider-bottom-form {
        display: block;
        position: relative;
        width: 100%;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
        width: 100vw; /* 전체 뷰포트 너비 */
        background: #ffffff;
        clear: both;
        padding: 0.1px 0; /* 아주 작은 패딩으로 공간 확보 */
        margin-bottom: 2rem;
        box-sizing: border-box;
    }
    
    .kaice-slider-bottom-form-content {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0;
        text-align: center;
        color: #333;
        font-family: 'Noto Sans KR', sans-serif;
        min-height: 1px; /* 최소 높이 보장 */
    }
    
    /* 콘텐츠가 있을 때만 패딩과 높이 적용 */
    .kaice-slider-bottom-form-content:not(:empty) {
        padding: 2rem;
        min-height: 100px;
    }
    
    .kaice-slider-bottom-form-content h3 {
        margin: 0 0 1.5rem 0;
        font-size: 1.5rem;
        font-weight: 600;
        color: var(--theme-main-color, #408090);
    }
    
    .kaice-slider-bottom-form-content .form-row {
        display: flex;
        gap: 1rem;
        max-width: 600px;
        margin: 0 auto;
        align-items: center;
    }
    
    .kaice-slider-bottom-form-content .form-input {
        flex: 1;
        padding: 0.875rem 1rem;
        border: 2px solid #e0e0e0;
        border-radius: 8px;
        font-size: 1rem;
        transition: border-color 0.3s ease;
        box-sizing: border-box;
    }
    
    .kaice-slider-bottom-form-content .form-input:focus {
        outline: none;
        border-color: var(--theme-main-color, #408090);
    }

    .kaice-slider-bottom-form-content .form-button {
        padding: 0.875rem 2rem;
        background: var(--theme-main-color, #408090);
        color: white;
        border: none;
        border-radius: var(--theme-button-radius, 4px);
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        transition: background-color 0.3s ease;
        white-space: nowrap;
    }

    .kaice-slider-bottom-form-content .form-button:hover {
        background: var(--theme-button-hover-bg, rgba(64, 128, 144, 0.9));
    }

}

/* 모바일에서 하단 폼 조정 */
@media (max-width: 768px) {
    .kaice-slider-bottom-form-content .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .kaice-slider-bottom-form-content .form-button {
        width: 100%;
        padding: 1rem;
    }
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .kaice-slider-background-wrapper {
        height: 250px; /* 모바일 고정 높이 */
    }
    
    .kaice-slider-content {
        padding: 1rem 1rem 1rem 2rem;
    }
    
    /* 모바일에서 배너 스타일로 글자 크기 대폭 축소 */
    .kaice-slider-title {
        font-size: 0.6em; /* 0.875em -> 0.6em */
        margin-bottom: 0.2em;
    }
    
    .kaice-slider-subtitle {
        font-size: 1.8em; /* 2.5em -> 1.8em */
        margin: 0.2em 0;
    }
    
    .kaice-slider-description {
        font-size: 1em; /* 1.4em -> 1em */
        margin-top: 0.3em;
    }
    
    .kaice-slider-description::before {
        width: 28px; /* 32px -> 28px */
        height: 28px;
        margin-right: 0.6rem;
        font-size: 0.65em; /* 0.7em -> 0.65em */
    }

    .kaice-slider-slide .kaice-slider-mark {
        width: 200px;
        height: 200px;
        bottom: 1rem;
        right: 1rem;
    }
}

@media (max-width: 480px) {
    .kaice-slider-background-wrapper {
        height: 220px; /* 작은 모바일 고정 높이 */
    }
    
    .kaice-slider-content {
        padding: 1rem;
    }
    
    /* 작은 모바일에서도 배너 스타일로 글자 크기 축소 */
    .kaice-slider-title {
        font-size: 0.55em; /* 0.8em -> 0.55em */
        margin-bottom: 0.2em;
    }
    
    .kaice-slider-subtitle {
        font-size: 1.6em; /* 2.2em -> 1.6em */
        margin: 0.2em 0;
    }
    
    .kaice-slider-description {
        font-size: 0.9em; /* 1.2em -> 0.9em */
        margin-top: 0.3em;
    }
    
    .kaice-slider-description::before {
        width: 24px; /* 28px -> 24px */
        height: 24px;
        margin-right: 0.5rem; /* 0.6rem -> 0.5rem */
        font-size: 0.6em;
    }

    .kaice-slider-slide .kaice-slider-mark {
        width: 80px;
        height: 80px;
    }
}

/* 회원 폼 영역 - 슬라이더 내부 우측에 고정 (데스크톱 전용) */
.kaice-slider-member-form-area {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: calc((100% - 1200px) / 2 + 2rem);
    width: 380px;
    z-index: 1002;
    pointer-events: auto;
}

/* 화면이 1240px보다 작을 때 회원 폼 위치 조정 */
@media (max-width: 1240px) {
    .kaice-slider-member-form-area {
        right: 2rem;
    }
}

/* 1020px 이하: 데스크톱 폼 숨김 */
@media (max-width: 1020px) {
    .kaice-slider-member-form-area {
        display: none;
    }
}

/* 모바일용 회원 폼 래퍼 - 슬라이더 바깥 하단에 위치 */
.kaice-slider-member-form-mobile-wrapper {
    display: none;
}

@media (max-width: 1020px) {
    .kaice-slider-member-form-mobile-wrapper {
        display: block;
        padding-top: 2rem;
    }

    .kaice-slider-member-form-mobile-wrapper .kaice-member-form-widget {
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .kaice-slider-member-form-mobile-wrapper {
        padding-top: 1.5rem;
    }
}

/* Loading state */
.kaice-slider-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 600px;
    min-height: 600px;
    background: var(--theme-item-bg, #f8f9fa);
    color: var(--theme-info-text, #6b7280);
}

.kaice-slider-loading:after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--theme-item-border, #ccc);
    border-top: 4px solid var(--theme-main-color, #408090);
    border-radius: 50%;
    animation: kaice-slider-spin 1s linear infinite;
}

@keyframes kaice-slider-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

