/* 기본 스타일 초기화 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 테마별 색상 변수 정의 */
:root {
    --bg-color: #0a0a1a;
    --text-color: #e0e0e0;
    --title-color: #ffffff;
    --net-color: #00aaff;
    --net-color-rgb: 0, 170, 255;
    --search-bg-color: rgba(10, 10, 30, 0.8);
    --icon-bg-color: #10102a;
    --footer-text-color: #777;
    --modal-bg-color: #1e1e2f;
    --input-bg-color: #2a2a3a;
    --btn-secondary-color: #444;
}

[data-theme="light"] {
    --bg-color: #f0f2f5;
    --text-color: #333333;
    --title-color: #000000;
    --net-color: #7ED321;
    --net-color-rgb: 126, 211, 33;
    --search-bg-color: #ffffff;
    --icon-bg-color: #ffffff;
    --footer-text-color: #555;
    --modal-bg-color: #ffffff;
    --input-bg-color: #e9e9e9;
    --btn-secondary-color: #ccc;
}

/* --- 기본 레이아웃 --- */
body {
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 40px 20px;
    transition: background-color 0.3s, color 0.3s;
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--title-color);
    margin-bottom: 25px;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--net-color), 0 0 20px var(--net-color), 0 0 30px var(--net-color);
    transition: color 0.3s, text-shadow 0.3s;
}

.search-wrapper, .theme-wrapper {
    width: 100%;
    max-width: 800px; /* 검색창 최대 너비 조정 */
    margin-bottom: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.theme-wrapper {
    max-width: 1000px;
}

/* --- 검색창 --- */
.search-container {
    width: 100%;
}

.search-form {
    display: flex;
    width: 100%;
    border-radius: 50px;
    overflow: hidden;
    border: 2px solid var(--net-color);
    background-color: var(--search-bg-color);
    box-shadow: 0 0 15px rgba(var(--net-color-rgb), 0.5);
    transition: border 0.3s, background-color 0.3s, box-shadow 0.3s;
}
.search-input {
    flex-grow: 1; border: none; padding: 15px 25px; font-size: 16px;
    background-color: transparent; color: var(--text-color); transition: color 0.3s;
}
.search-input:focus { outline: none; }
.search-button {
    border: none; padding: 0 25px; background-color: var(--net-color);
    color: white; cursor: pointer; font-size: 16px; font-weight: bold; transition: background-color 0.3s;
}

/* --- 최근 검색어 --- */
.recent-searches-container {
    width: 100%; margin-top: 15px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.recent-search-item {
    background-color: rgba(var(--net-color-rgb), 0.1); border: 1px solid rgba(var(--net-color-rgb), 0.3);
    color: var(--net-color); padding: 5px 12px; border-radius: 20px; font-size: 13px; text-decoration: none;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
.recent-search-item:hover { background-color: rgba(var(--net-color-rgb), 0.3); color: var(--title-color); }

/* --- 바로가기 아이콘 --- */
.theme-container {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 40px; width: 100%;
}
.theme-item {
    display: flex; flex-direction: column; align-items: center;
    text-decoration: none; color: var(--text-color); transition: transform 0.3s ease;
    position: relative; /* 자식 요소(.shortcut-controls) 위치 기준 */
}
.theme-item:hover { transform: scale(1.05); }
.shortcut-link {
    text-decoration: none;
}
.icon-circle {
    width: 120px; height: 120px; border-radius: 50%; background-color: var(--icon-bg-color);
    display: flex; justify-content: center; align-items: center; margin-bottom: 15px;
    border: 2px solid var(--net-color);
    box-shadow: 0 0 10px var(--net-color), 0 0 20px var(--net-color), inset 0 0 15px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    overflow: hidden; /* 이미지가 원 밖으로 나가지 않도록 설정 */
}
.theme-item:hover .icon-circle {
    box-shadow: 0 0 15px var(--net-color), 0 0 30px var(--net-color), 0 0 45px var(--net-color), inset 0 0 20px rgba(0,0,0,0.5);
}
.icon-circle img {
    /* ▼▼▼ [수정된 부분] 이미지가 원형을 꽉 채우도록 변경 ▼▼▼ */
    width: 100%;       /* 원형 컨테이너의 너비에 맞춤 */
    /* height: 100%;      */
    object-fit: cover; /* 이미지를 잘라내더라도 비율을 유지하며 컨테이너를 채움 */
    border-radius: 50%; /* 이미지 자체도 원형으로 잘라줌 */
}
.theme-label { font-size: 1rem; font-weight: 500; color: var(--text-color); text-align: center;}


/* '추가하기' 버튼(+) 스타일 */
.add-shortcut-item .icon-circle {
    cursor: pointer;
    border-style: dashed;
    background-color: transparent;
}
.add-shortcut-item:hover .icon-circle {
    background-color: rgba(var(--net-color-rgb), 0.1);
}
.add-shortcut-item .icon-circle span {
    font-size: 4rem;
    font-weight: 200;
    color: var(--net-color);
    line-height: 1;
    padding-bottom: 15px;
    display: block;
}

/* ▼▼▼ 호버 시 나타나는 편집/삭제 버튼 스타일 ▼▼▼ */
.shortcut-controls {
    position: absolute;
    top: -5px;
    right: -5px;
    display: flex;
    gap: 5px;
    opacity: 0; /* 평소에는 투명하게 */
    visibility: hidden; /* 평소에는 숨김 */
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 10;
}
.theme-item:hover .shortcut-controls {
    opacity: 1; /* 호버 시 보이게 */
    visibility: visible;
}
.shortcut-control-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}
.shortcut-control-btn:hover {
    background-color: var(--net-color);
}
/* ▲▲▲ 호버 시 나타나는 편집/삭제 버튼 스타일 ▲▲▲ */


/* --- 푸터 --- */
.main-footer {
    width: 100%; text-align: center; padding: 20px 0; margin-top: 0 auto;
    color: var(--footer-text-color); font-size: 0.9rem; transition: color 0.3s;
}

/* --- 테마 스위치 --- */
.theme-switcher {
    position: fixed; bottom: 20px; right: 20px; display: flex; align-items: center;
    background-color: rgba(var(--net-color-rgb), 0.1); border: 1px solid rgba(var(--net-color-rgb), 0.3);
    border-radius: 20px; padding: 5px; cursor: pointer; z-index: 1001;
}
.switch-label { font-size: 1.2rem; margin: 0 5px; }
.switch-toggle {
    width: 40px; height: 20px; background-color: #555; border-radius: 10px;
    position: relative; transition: background-color 0.3s;
}
.switch-toggle::before {
    content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
    border-radius: 50%; background-color: white; transition: transform 0.3s;
}
[data-theme="light"] .switch-toggle { background-color: var(--net-color); }
[data-theme="light"] .switch-toggle::before { transform: translateX(20px); }

/* --- 라이트 모드 그림자 제거 --- */
[data-theme="light"] h1 { text-shadow: none; }
[data-theme="light"] .search-form,
[data-theme="light"] .icon-circle { box-shadow: none; }
[data-theme="light"] .theme-item:hover .icon-circle { box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
[data-theme="light"] .add-shortcut-item:hover .icon-circle {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* --- 바로가기 설정 모달 스타일 --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none; justify-content: center; align-items: center; z-index: 1000;
}
.modal-overlay.active {
    display: flex;
}
.modal-content {
    background-color: var(--modal-bg-color);
    padding: 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    color: var(--text-color);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h2 {
    color: var(--title-color);
}
.close-btn {
    background: none; border: none; font-size: 2rem;
    color: var(--text-color); cursor: pointer;
}
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 0.9rem; }
.form-group input {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid var(--btn-secondary-color);
    background-color: var(--input-bg-color);
    color: var(--text-color);
}
.form-actions { display: flex; gap: 10px; }
.modal-btn {
    flex-grow: 1; padding: 10px; border: none; border-radius: 5px;
    font-size: 1rem; cursor: pointer; transition: opacity 0.3s;
}
.modal-btn:hover { opacity: 0.9; }
.btn-save { background-color: var(--net-color); color: white; }
.btn-cancel { background-color: var(--btn-secondary-color); color: var(--title-color); }

/* 모달 내 바로가기 목록은 필요 없으므로 숨김 또는 제거 (여기서는 숨김 처리) */
#shortcut-list-container {
    display: none;
}