/* Hero Section (island-hero) */
#island-hero {
    width: 100%;
    height: 90vh; /* 조금 짧게 */
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('../../assets/img/bg1.png') center center; /* 메인 배경 재사용 */
    background-size: cover;
    position: relative;
    padding-top: 100px; /* 헤더 아래로 여유 공간 */
    color: var(--text-color);
}

#island-hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(247, 215, 148, 0.4);
}

#island-hero h2 {
    color: var(--secondary-color);
    margin-bottom: 60px;
    font-size: 1.5rem;
    font-weight: 400;
}

/*  자동 완성 활성화 시 스크롤 인디케이터 숨기기  */
.scroll-down-indicator.hide-by-autocomplete {
    opacity: 0; /* 강제로 투명하게 */
    visibility: hidden; /* 강제로 숨기기 */
    pointer-events: none; /* 클릭 이벤트 방지 */
}

#island-hero .form-control {
    /*  수정: 검색 아이콘을 위한 왼쪽 패딩 추가 및 배경색 투명하게  */
    padding-left: 50px; /* 아이콘 공간 확보 */
    padding-right: 20px; /* 기존 패딩 */
    background-color: transparent; /* 배경색 투명하게 만들어 search-input-wrapper 배경 보이게 */
    border: none; /* input 자체의 보더 제거 (래퍼가 보더 역할) */
    box-shadow: none; /* input 자체의 그림자 제거 */
    height: 50px;
    border-radius: 50px;
    color: var(--text-color);
    font-size: 1.1rem;
    width: 100%; /* 부모(search-input-wrapper) 너비 꽉 채우기 */
}

#island-hero .form-control::placeholder {
    color: var(--secondary-color);
}

/* focus 시 기존 .form-control 스타일 제거 (wrapper가 처리) */
#island-hero .form-control:focus {
    border-color: transparent;
    box-shadow: none;
    outline: none; /* 기본 outline 제거 */
}

.search-container {
    position: relative;
    max-width: 1500px; /*  수정: 검색창 전체 너비 확장 (예: 800px)  */
    width: 100%;
    /* margin-left: auto; margin-right: auto; flex 부모가 이미 중앙 정렬하므로 필요 없음 */
    /* text-align: center; 여기에도 필요 없음 (flex 부모가 중앙 정렬) */
}

.search-input-wrapper {
    position: relative;
    display: flex; /* 아이콘과 입력창을 한 줄에 정렬 */
    align-items: center; /* 세로 중앙 정렬 */
    border-radius: 50px; /* 입력창의 둥근 모서리 유지 */
    border: 2px solid var(--border-color); /* 초기 보더 */
    background-color: var(--background-dark); /* 배경색 */
    box-shadow: var(--shadow-mild); /* 그림자 */
    transition: all var(--transition-speed) ease; /* 부드러운 전환 */
    height: 50px; /* input과 동일한 높이 */
}

.search-input-wrapper:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(247, 215, 148, 0.15); /* 은은한 발광 효과 */
}

.search-input-wrapper.focused { /* JS에서 input focus 시 추가될 클래스 */
    border-color: var(--primary-color); /* 보더 강조 */
    box-shadow: 0 0 0 0.25rem rgba(247, 215, 148, 0.4), var(--shadow-strong); /* 더욱 강한 발광 및 그림자 */
    background-color: rgba(255, 255, 255, 0.05); /* 약간 밝은 배경 */
}

/*  새로 추가: 검색 아이콘 스타일  */
.search-input-icon {
    position: absolute; /* 래퍼 내부에서 절대 위치 */
    left: 20px; /* 왼쪽에서부터 위치 */
    color: var(--secondary-color); /* 아이콘 색상 */
    font-size: 1.1rem;
    pointer-events: none; /* 아이콘 클릭 방지 (input으로 이벤트 전달) */
    transition: color var(--transition-speed) ease;
}

/* 포커스 시 아이콘 색상 변경 */
.search-input-wrapper.focused .search-input-icon {
    color: var(--primary-color); /* 강조색 */
}

/*  자동 완성 리스트 스타일 조정 (검색창 래퍼와 연결되도록)  */
.autocomplete-suggestions {
    position: absolute;
    top: 100%; /* 입력창 래퍼 바로 아래 */
    left: 0;
    right: 0;
    z-index: 1001;
    background-color: var(--card-bg-light);
    border-top: none; /* 윗부분 보더 제거 (검색창 래퍼와 이어지는 느낌) */
    border-radius: 0 0 15px 15px; /*  수정: 래퍼 모서리 둥글게와 맞춤  */
    box-shadow: var(--shadow-strong);
    overflow: hidden;
    max-height: 50vh; /* 최대 높이 확장 (더 많은 검색 결과 노출) */
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px); /* 살짝 위에서 나타나는 효과 미세 조정 */
    transition: all 0.2s ease-out;
}
.autocomplete-suggestions.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.autocomplete-suggestion-item {
    display: block; /*  수정: 섬 이름과 세부 정보를 별도 라인으로 표시  */
    padding: 10px 15px;
    cursor: pointer;
    color: var(--text-color);
    font-size: 1rem;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
}

.autocomplete-suggestion-item > span:first-child { /* 섬 이름 텍스트 */
    flex-grow: 1; /* 이름이 가능한 많은 공간 차지 */
    margin-right: 10px; /* 이름과 태그 사이 간격 */
    white-space: nowrap; /* 이름은 한 줄로 */
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-type-tag {
    display: inline-flex; /* 태그들이 옆으로 나란히 정렬되도록 */
    align-items: center;
    padding: 3px 8px;
    margin-left: 5px; /* 태그들 사이 간격 */
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap; /* 태그 내용도 한 줄로 */
    color: var(--background-dark); /* 기본 텍스트 색상 */
}

/*  각 매치 타입별 색상 설정  */
.match-type-name {
    background-color: var(--primary-color); /* 이름 일치 */
    color: var(--background-dark); /* 텍스트는 어둡게 */
}
.match-type-desc {
    background-color: #e8b84f; /* 설명 일치 (약간 어두운 황금색) */
    color: var(--text-color);
}
.match-type-npc {
    background-color: #60a4ee; /* NPC 이름 일치 (파란색) */
    color: var(--text-color);
}
.match-type-monster { /* 몬스터 태그 */
    background-color: #e67e88; /* 강렬한 빨간색 (위험 강조) */
    color: var(--text-color);
}
.match-type-fieldwave { 
    background-color: #5cffcb; /* 황금색 (경고 느낌) */
    color: var(--background-dark);
}
.match-type-raemhole { 
    background-color: #9976db; /* 보라색 (탐사 던전 느낌) */
    color: var(--text-color);
}
.match-type-raid { /* 레이드 태그 색상 */
    background-color: #e378af; /* 어두운 빨강 (강력한 레이드 느낌) */
    color: var(--text-color);
}
.match-type-other { 
    background-color: #6be488; /* 초록색 (기타 정보) */
    color: var(--text-color);
}

.autocomplete-suggestion-item:last-child {
    border-bottom: none; /* 마지막 항목은 구분선 없음 */
}

.island-main-text {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px; /* 세부 정보와의 간격 */
    display: block; /* 전체 너비 차지 */
}

.match-detail-line {
    font-size: 0.85rem;
    color: var(--secondary-color);
    line-height: 1.4;
    margin-top: 3px;
    word-break: keep-all;
    overflow-wrap: break-word;
    display: flex; /* 레이블과 텍스트 정렬 */
    align-items: flex-start; /* 레이블이 위에 고정 */
}

.detail-label {
    display: inline-block; /* 레이블이 고정된 너비를 갖도록 */
    padding: 2px 6px;
    margin-right: 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--background-dark); /* 기본 텍스트 색상 */
    flex-shrink: 0; /* 내용이 길어져도 레이블 너비가 줄어들지 않도록 */
    line-height: 1.2; /* 레이블 높이 조정 */
}

.autocomplete-suggestion-item:hover,
.autocomplete-suggestion-item.selected { /* 키보드 이동 시 선택된 항목 */
    background-color: rgba(247, 215, 148, 0.15);
    color: var(--primary-color);
}

.highlight {
    background-color: rgba(247, 215, 148, 0.3); /* 연한 노란색 배경 */
    font-weight: 700;
    color: var(--primary-color); /* 글자색 강조 */
    padding: 0 2px;
    border-radius: 3px;
}

.autocomplete-suggestion-item:hover .match-type-tag {
    filter: brightness(1.2); /* 살짝 밝게 */
}

/* 호버 시, 섬 이름 텍스트만 색상 변경 */
.autocomplete-suggestion-item:hover .island-main-text {
    color: var(--primary-color);
}

/* 호버 시 세부 정보 색상 */
.autocomplete-suggestion-item:hover .match-detail-line {
    color: var(--text-color);
}
/* 호버 시 매치된 부분의 색상을 강조하기 위해 유지 */
.autocomplete-suggestion-item:hover .highlight {
    background-color: rgba(247, 215, 148, 0.5); /* 호버 시 강조색 좀 더 진하게 */
    color: var(--background-dark);
}

#island-hero .btn-primary {
    display: inline-flex;
    align-items: center;
    background-color: var(--primary-color);
    color: var(--background-dark);
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all var(--transition-speed) ease;
    box-shadow: var(--shadow-strong);
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 10px;
}

#island-hero .btn-primary:hover {
    background-color: var(--accent-glow);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(247, 215, 148, 0.6);
}

#island-hero .btn-primary i {
    margin-right: 8px;
}


/* Island Map Section */
.container-full {
    width: 100%;
    padding-right: 15px; /* 양쪽 패딩 */
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
    max-width: 1400px; /*  일반 .container보다 더 넓게 확장  */
}

/* Island Map Section - 중앙 정렬 재확인 */

#island-map-section p {
    text-align: center; /* 명시적으로 중앙 정렬 */
    margin-left: auto;   /* 블록 요소 중앙 정렬 (선택 사항이지만 안전장치) */
    margin-right: auto;  /* 블록 요소 중앙 정렬 (선택 사항이지만 안전장치) */
}

#island-map-section {
    background-color: var(--background-light);
    padding-bottom: 80px;
    border-bottom: 1px solid var(--border-color);
    display: flex; /* 부모를 flex 컨테이너로 만들어 내부 요소를 중앙 정렬 */
    justify-content: center; /* 수평 중앙 정렬 */
    /* section 자체의 padding-left/right를 0으로 설정하여 container-full이 최대 너비를 가질 수 있도록 */
    padding-left: 0;
    padding-right: 0;
}

.island-map-container {
    position: relative;
    display: block;
    width: 100%;
    max-width: 1000px; /*  지도 컨테이너 자체의 최대 너비를 더 크게 설정 (예: 1200px)  */
    margin: 40px auto; /* margin: auto;를 통한 중앙 정렬 유지 */
    border: 2px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-strong);
    overflow: hidden;
}

/* Mobile Responsiveness for Wider Container */
@media (max-width: 1400px) { /* container-full의 max-width에 맞춰 조정 */
    .container-full {
        max-width: 1200px; /* 더 작은 화면에서는 max-width 줄임 */
    }
}
@media (max-width: 1200px) {
    .container-full {
        max-width: 960px;
    }
    .island-map-container {
        max-width: 900px; /* 지도 크기를 화면 크기에 맞게 조절 */
    }
}
@media (max-width: 992px) {
    .container-full {
        max-width: 720px;
    }
    .island-map-container {
        max-width: 680px;
    }
    .search-container {
        max-width: 600px; /* 중간 화면에서는 너비 줄임 */
    }
}
@media (max-width: 768px) {
    .container-full {
        max-width: 540px;
    }
    .island-map-container {
        max-width: 500px;
    }
    #island-map-section {
        padding-left: 15px; /* 모바일에서는 섹션에 다시 패딩 부여 */
        padding-right: 15px;
    }
    .search-container {
        max-width: 90%; /* 모바일에서는 화면 너비에 맞게 조절 */
    }
    #island-hero .form-control {
        font-size: 1rem;
        padding-left: 45px; /* 아이콘 패딩 조정 */
    }
    .search-input-icon {
        left: 15px; /* 아이콘 위치 조정 */
    }
}

.island-background-map {
    width: 100%;
    height: auto;
    justify-content: center;
    display: block; /* 이미지 아래 여백 제거 */
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.island-icons-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* 개별 섬 아이콘 스타일 */
.island-icon-wrapper {
    position: absolute;
    width: 76px; /* 아이콘 크기 (32px + 패딩) */
    height: 76px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    /*background-color: rgba(0, 0, 0, 0.129);
    border: 2px solid rgba(247, 215, 148, 0.5);
    box-shadow: 0 0 10px rgba(247, 215, 148, 0.3), 0 0 20px rgba(0, 0, 0, 0.5);*/
    transition: all var(--transition-speed) ease;
    z-index: 11;
}

.island-icon-wrapper:hover {
    transform: scale(1.3) translateY(-5px); /* 호버 시 확대 및 살짝 위로 */
    /*background-color: rgba(247, 215, 148, 0.7);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px var(--primary-color), 0 0 30px rgba(0, 0, 0, 0.8); */
    z-index: 12; /* 다른 아이콘 위로 오게 */
}

.island-icon-wrapper img {
    width: 110px;
    height: 110px;
    /*border-radius: 50%;*/
    object-fit: cover;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* 섬 정보 툴팁 스타일 */
.island-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.508);
    color: var(--text-color);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    box-shadow: var(--shadow-strong);
    z-index: 1000; /* 항상 최상단에 보이도록 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none; /* 툴팁이 마우스 이벤트를 가로채지 않도록 */
    min-width: 250px;
    max-width: 300px; 
    width: max-content;
    width: auto; 
    display: block;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.island-icon-wrapper:hover .island-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* 호버 시에만 이벤트 활성화 */
}

.island-tooltip h4 {
    margin-top: 0;
    margin-bottom: 5px;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
}
.island-tooltip p {
    margin-bottom: 0;
    font-size: 0.9rem;
    color: var(--secondary-color);
    overflow: hidden;
    text-overflow: ellipsis; /* 너무 길면 ...으로 자름 */
    display: -webkit-box;
    line-clamp: none;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    word-wrap: break-word; /*  추가: 긴 단어도 자동 줄바꿈  */
    word-break: normal;    /*  추가: 단어 중간에서 줄바꿈되는 현상 방지  */
    text-align: left !important;
}

/* 툴팁 위치 조정 (JavaScript에서 동적으로 클래스 추가 예정) */
.island-tooltip.top { 
    transform: translate(-50%, calc(-10% - 8px)); /* 수평 중앙 + 툴팁 높이만큼 위로, 아이콘과 8px 여유 */
    bottom: calc(100% + 3px); /* 아이콘 래퍼 바닥에서 3px 위로 */
    left: 50%; 
}
.island-tooltip.bottom { 
    transform: translate(-50%, 8px); /* 수평 중앙 + 아이콘과 8px 여유 */
    top: calc(100% + 3px); /* 아이콘 래퍼 위쪽에서 3px 아래로 */
    left: 50%; 
}
.island-tooltip.left { 
    transform: translate(calc(-5% - 8px), -50%); /* 수직 중앙 + 툴팁 너비만큼 왼쪽으로, 아이콘과 8px 여유 */
    right: calc(100% + 3px); /* 아이콘 래퍼 오른쪽에서 3px 왼쪽으로 */
    top: 50%; 
}
.island-tooltip.right { 
    transform: translate(8px, -50%); /* 수직 중앙 + 아이콘과 8px 여유 */
    left: calc(100% + 20px); /* 아이콘 래퍼 왼쪽에서 3px 오른쪽으로 */
    top: 50%; 
}

/*  툴팁 내 새로운 요소 스타일  */
.island-tooltip .tooltip-divider {
    border: 0;
    border-top: 1px dashed rgba(255, 255, 255, 0.1); /* 은은한 점선 구분선 */
    margin: 10px 0; /* 위아래 여백 */
}

.island-tooltip .tooltip-requirements {
    list-style: none; /* 리스트 점 제거 */
    padding: 0;
    margin: 0;
}

.island-tooltip .tooltip-requirements li {
    font-size: 0.85rem; /* 요구사항 텍스트 크기 약간 작게 */
    color: var(--secondary-color);
    line-height: 1.4;
    margin-bottom: 3px; /* 항목 간 간격 */
}

.island-tooltip .tooltip-requirements li strong {
    color: var(--primary-color); /* 제목 부분 강조색 */
    font-weight: 500;
}
.island-tooltip .tooltip-requirements li:last-child {
    margin-bottom: 0; /* 마지막 항목 아래 여백 제거 */
}

/* 모바일 반응형에서 툴팁 텍스트 크기 미세 조정 (선택 사항) */
@media (max-width: 768px) {
    .island-tooltip .tooltip-requirements li {
        font-size: 0.8rem;
    }
}


/* Island List Section */
#island-list-section {
    padding-top: 50px;
    padding-bottom: 100px;
    background-color: var(--background-dark);
}

#island-list-cards {
    margin-top: 40px;
    display: grid; /* Grid로 카드 배치 */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* 반응형 그리드 */
    gap: 30px; /* 카드 간 간격 */
    justify-content: center;
}

.island-card {
    background-color: var(--card-bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-mild);
    padding: 25px;
    text-align: center;
    transition: all var(--transition-speed) ease;
    text-decoration: none; /* 링크 스타일 제거 */
    color: inherit; /* 부모 색상 상속 */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* 내용 상하 정렬 */
    min-height: 250px; /* 최소 높이 지정 */
}

.island-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(247, 215, 148, 0.2);
    border-color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.05);
}

.island-card h4 {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.3;
}

.island-card .icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px auto;
    border-radius: 50%;
    background-color: rgba(247, 215, 148, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid var(--primary-color);
}

.island-card .icon img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.island-card p {
    font-size: 1rem;
    color: var(--secondary-color);
    line-height: 1.6;
    overflow: hidden; /* 넘치는 텍스트 숨기기 */
    text-overflow: ellipsis; /* 넘치는 텍스트 ... 처리 */
    display: -webkit-box;
    line-clamp: none;
    -webkit-line-clamp: 3; /* 최대 3줄 */
    -webkit-box-orient: vertical;
}

/* Requirements & Special Entry */
.island-card .requirements {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-top: 15px;
    border-top: 1px dashed rgba(255,255,255,0.1);
    padding-top: 10px;
}
.island-card .requirements strong {
    color: var(--primary-color);
}

/* Mobile Responsiveness */
@media (max-width: 992px) {
    #island-hero h1 {
        font-size: 2.8rem;
    }
    #island-hero h2 {
        font-size: 1.3rem;
    }
    #island-hero .btn-primary {
        margin-top: 20px;
        margin-left: 0; /* 버튼이 줄바꿈 되면서 중앙 정렬 */
    }
    .island-map-container {
        width: 95%; /* 모바일에서 너비 조정 */
    }
    .island-icon-wrapper {
        width: 40px;
        height: 40px;
    }
    .island-icon-wrapper img {
        width: 28px;
        height: 28px;
    }
    .island-tooltip {
        font-size: 0.8rem;
        padding: 8px 12px;
        max-width: 200px;
    }
    .island-tooltip h4 {
        font-size: 1rem;
    }
}
@media (max-width: 768px) {
    #island-hero {
        padding-top: 80px;
        height: auto; /* 내용에 따라 높이 조절 */
        min-height: 50vh;
    }
    #island-hero h1 {
        font-size: 2.2rem;
    }
    #island-hero h2 {
        font-size: 1.1rem;
    }
    #island-hero .form-control {
        margin-bottom: 10px; /* 모바일에서 버튼과 간격 */
    }
    .section-title {
        font-size: 2rem;
    }
    .island-map-container {
        margin: 20px auto;
    }
    #island-list-cards {
        gap: 20px;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    .island-card {
        padding: 20px;
        min-height: 220px;
    }
    .island-card h4 {
        font-size: 1.5rem;
    }
    .island-card .icon {
        width: 50px;
        height: 50px;
    }
    .island-card .icon img {
        width: 38px;
        height: 38px;
    }
}

/* Utilities (나중에 필요하면 style.css로 옮길 수 있음) */
.ml-2 { margin-left: 0.5rem !important; } /* Bootstrap 스타일 모방 */
.mr-2 { margin-right: 0.5rem !important; }