/* ✅ 전체 페이지 배경색을 홈 화면과 동일하게 변경 */
body {
    background-color: #f7faff;
    margin: 0; /* 🔹 불필요한 여백 제거 */
    padding: 0; /* 🔹 불필요한 여백 제거 */
}

.convert-container {
    max-width: 600px;
    margin: 50px auto;
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
}

/* ✅ 네비게이션 바 스타일 추가 */
.navbar {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: #e3f2fd;
    border-bottom: 2px solid #b0d4f1;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
}

/* 🔹 "다파변"과 "홈"을 왼쪽 정렬 */
.nav-left {
    display: flex;
    align-items: center;
    gap: 20px; /* 🔹 제목과 홈 간격 */
}

/* 🔹 "다파변"은 크기 키우기 */
.logo {
    font-size: 28px;
    font-weight: bold;
    color: #007bff;
    text-decoration: none;
}

/* 🔹 "홈" 스타일 */
.nav-home {
    font-size: 18px;
    font-weight: bold;
    color: #004080;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.3s ease;
}

/* 🔹 "홈" 호버 효과 */
.nav-home:hover {
    background: #cce7ff;
}

/* 클릭 가능한 요소의 커서 변경 */
button, .file-drag-area {
    cursor: pointer;
}

/* 업로드 박스 스타일 개선 */
.upload-box {
    border: 2px dashed #b0d4f1;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
    transition: 0.3s ease;
}

.upload-box:hover {
    border-color: #007bff;
}

/* 드롭다운 버튼 */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    padding: 10px;
    font-size: 16px;
    border: 2px solid #007bff;
    border-radius: 5px;
    cursor: pointer;
    background-color: white;
    width: 120px;
    text-align: center;
}

/* ✅ 기본적으로 드롭다운을 숨김 */
.dropdown-content {
    display: none; /* ✅ 기본적으로 숨김 */
    position: absolute;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden; /* ✅ 가로 스크롤 제거 */
    width: 400px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    padding: 10px;
}

/* ✅ 선택된 경우에만 표시되도록 변경 */
.dropdown.active .dropdown-content {
    display: flex;
}

/* ✅ 선택 부분과 파일 업로드 박스 간 간격 조정 */
.select-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px; /* 🔹 버튼 간 간격 */
    margin-bottom: 25px; /* 🔥 파일 업로드 박스와 간격 조정 (기존보다 더 벌리기) */
}

/* ✅ "~를 ~로" 정렬 문제 해결 */
.select-container span {
    display: inline-block;
    margin: 0 5px; /* ✅ 간격 조정 */
    font-size: 16px;
    font-weight: bold;
}

/* ✅ 드롭다운 내부 정렬을 가로로 배치 */
.dropdown-wrapper {
    display: flex;
    align-items: flex-start; /* ✅ 주제와 파일 목록의 정렬을 위로 맞춤 */
    width: 100%;
    min-height: 250px; /* ✅ 최소 높이 설정 */
}

/* ✅ 드롭다운 내부 버튼 스타일 */
.format-option {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    background: #007bff !important;
    color: white !important;  /* 🔥 기본 텍스트 색상을 명확하게 설정 */
    text-align: center;
    font-size: 14px;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ✅ 마우스를 올려도 글씨가 선명하게 보이도록 유지 */
.format-option:hover {
    background: #0056b3 !important;  /* 🔥 강제로 배경 변경 */
    color: #ffffff !important;  /* 🔥 강제로 흰색 유지 */
}

/* ✅ 선택된 옵션이 강조되도록 */
.format-option:active,
.format-option:focus {
    background: #004080 !important;
    color: #ffffff !important;
}

/* ✅ 카테고리 스타일 */
.format-category h4 {
    font-size: 16px;
    color: #007bff;
    margin-bottom: 5px;
    text-align: left;
    grid-column: span 3;  /* ✅ 3열을 가로지르게 설정 */
}

.file-drag-area {
    cursor: pointer;
}

.file-select-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.file-select-btn:hover {
    background: #0056b3;
}

.convert-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.convert-btn:hover {
    background: #218838;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    padding: 10px;
    font-size: 16px;
    border: 2px solid #007bff;
    border-radius: 5px;
    cursor: pointer;
    background-color: white;
    width: 100px;
    text-align: center;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    max-height: 200px;
    overflow-y: auto;
    width: 150px;
}

.format-category h4 {
    font-size: 14px;
    color: #007bff;
    margin: 5px;
}

.format-option {
    display: block;
    width: 100%;
    padding: 8px;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
}

.format-option:hover {
    background: #007bff;
    color: white;
}

/* ✅ 드롭다운 내부를 가로로 정렬 */
.dropdown-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    width: 400px;  /* ✅ 너비 조정 */
    min-height: 250px; /* ✅ 최소 높이 설정 */
}

/* ✅ 주제 목록 스타일 (왼쪽) */
.category-list {
    width: 130px; /* ✅ 너비 조정 */
    padding: 5px;
    margin: 0;
    list-style-type: none;
    max-height: 220px;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ✅ 개별 항목 스타일 */
.category-item {
    list-style-type: none;
    padding: 4px 8px; /* ✅ 패딩 조정 */
    cursor: pointer;
    text-align: left;
    display: block; /* ✅ 한 줄에 하나씩 표시 */
    font-size: 12px; /* ✅ 글자 크기 줄이기 */
    line-height: 1.3; /* ✅ 줄 간격 조정 */
    white-space: nowrap; /* ✅ 긴 글씨도 한 줄 유지 */
    overflow: hidden;
    text-overflow: ellipsis; /* ✅ 너무 길면 ...으로 표시 */
    width: 100%;
}

/* ✅ 주제 선택 효과 */
.category-list li:hover,
.category-list li.active {
    background: #007bff;
    color: white;
    font-weight: bold;
}

/* ✅ 파일 목록 스타일 - 3개씩 표시 & 가로 스크롤 제거 */
#input-file-container, #output-file-container {
    display: grid;
    grid-template-columns: repeat(3, minmax(60px, 1fr)); /* ✅ 3개씩 배치 */
    gap: 5px; /* ✅ 간격 줄이기 */
    overflow-y: auto; /* ✅ 세로 스크롤 유지 */
    max-height: 250px;
    width: 100%; /* ✅ 가로 크기 고정 */
    overflow-x: hidden; /* ✅ 가로 스크롤 제거 */
}

/* ✅ 파일 버튼 스타일 */
.file-option {
    background: #007bff;
    color: white;
    padding: 8px; /* ✅ 내부 패딩 줄이기 */
    border-radius: 5px;
    font-size: 12px; /* ✅ 글자 크기 줄이기 */
    text-align: center;
    min-width: 60px; /* ✅ 최소 너비 조정 */
    max-width: 90px; /* ✅ 최대 너비 조정 */
    cursor: pointer;
    transition: background 0.3s ease;
}

/* ✅ 마우스 hover 시 강조 효과 */
.file-option:hover {
    background: #0056b3;
}

.download-btn {
    display: block;
    background: #007bff;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    margin-top: 15px;
    transition: background 0.3s ease;
}

.download-btn:hover {
    background: #0056b3;
}

@media screen and (max-width: 768px) {
  .dropdown-content {
    position: fixed !important;        /* ✅ position을 fixed로 해야 화면 기준으로 위치 잡힘 */
    top: 110px !important;             /* ✅ 버튼 아래쪽에 고정 */
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    padding: 12px !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    background: #fff !important;
    overflow-y: auto !important;
    max-height: 60vh !important;
    box-shadow: none !important;
  }

  .dropdown-wrapper {
    display: grid !important;
    grid-template-columns: 1fr 3fr; /* ✅ 카테고리 1, 목록 3 비율 */
    gap: 10px;
    align-items: start;
  }

  .category-list {
    font-size: 13px;
    padding: 6px;
    margin: 0;
    overflow-y: auto;
    max-height: 200px;
    word-break: keep-all;
  }

  .format-option {
    font-size: 12px !important;
    padding: 6px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #input-file-container,
  #output-file-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));  /* ✅ 더 작게 배치 */
    gap: 6px;
    width: 100%;
  }
}
