* { padding: 0; margin: 0; box-sizing: border-box; }
a { text-decoration: none; color: black; }
body, button, input, textarea { font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif; }

/* --- 공통 유틸리티 --- */
.u-hidden { display: none !important; }
.hidden { display: none !important; }
.u-flex { display: flex !important; }
.u-flex-between { display: flex; justify-content: space-between; align-items: center; }
.u-margin-r-15 { margin-right: 15px; }

/* --- 기본 레이아웃 --- */
.container { width: 100%; display: flex; flex-direction: row; min-height: 100vh; }
.sidebar { width: 260px; height: 100vh; position: sticky; top: 0; overflow-y: auto; border-right: 1px solid #eee; padding: 20px; display: flex; flex-direction: column; background-color: #fff; z-index: 10; }
.main-content { flex: 1; min-width: 0; padding: 30px 40px; display: flex; flex-direction: column; max-width: 1100px; margin: 0 auto; box-sizing: border-box; }

/* --- 로딩 화면 (PWA 최적화) --- */
.full-screen-loader {
    display: flex; 
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(255, 255, 255, 0.4);
    z-index: 999999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
}
.loader-icon { font-size: 50px; color: #0984e3; margin-bottom: 15px; }
.loader-text { font-size: 16px; font-weight: bold; color: #333; }

/* --- 사이드바 요소 --- */
.sidebar-title { font-size: 18px; font-weight: 900; margin-bottom: 0; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.trash-icon { cursor: pointer; color: #888; transition: color 0.2s; font-size: 16px; }
.trash-icon:hover { color: #ff7675; }

/* --- 년/월 아코디언 목록 --- */
.year-section { display: block; width: 100%; margin-bottom: 5px; list-style: none; }
.year-section i { color: #f39c12; margin-right: 8px; }
.year-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: bold; padding: 8px 0; cursor:pointer;}
.year-title i.fa-chevron-right { font-size: 12px; color: #ccc; transition: transform 0.3s ease; }
.year-title.active i.fa-chevron-right { transform: rotate(90deg); }
#month-list { flex: 1; overflow-y: auto; margin-bottom: 20px; list-style: none; padding: 0; }
.sidebar-month-list { padding-left: 25px; list-style: none; margin: 0; }
.sidebar-month-item { display: flex; align-items: center; cursor: pointer; padding: 5px 0; color: #777; transition: color 0.2s; }
.sidebar-month-item:hover { font-weight: bold; color: black; }
.sidebar-month-item.active { color: #e74c3c; font-weight: bold; }

/* --- 미니 달력 --- */
#calendar-container { width: 100%; padding: 10px; border-top: 1px solid #eee; font-size: 11px; }
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.calendar-header i { font-size: 14px; color: #636e72; cursor: pointer; }
#calendar-header button { background: none; border: none; cursor: pointer; color: #888; padding: 5px; }
#calendar-header button:hover { color: #333; }
#monthDisplay { font-size: 16px; font-weight: 800; color: #2d3436; cursor: pointer; letter-spacing: -0.5px; padding: 0 5px; }
#monthDisplay:hover { color: #ff7675; }
#calendar-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
#calendar-table th, #calendar-table td { padding: 4px 0; text-align: center; }
#calendar-table th { color: #999; font-weight: normal; font-size: 10px; }
#calendar-table td span { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: 0 auto; border-radius: 50%; transition: background 0.2s; cursor: pointer;}
#calendar-table td span:hover:not(.calendar-today-marker) { background-color: #eee; }
.calendar-today-marker { background: #e74c3c !important; color: white !important; font-weight: bold; border-radius: 50%; padding: 2px 6px; display: inline-block; box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3); }

/* --- 메인 콘텐츠 (메모 목록) --- */
header > h1 { font-weight: 900; }
header > a { border: 1px solid black; padding: 8px 10px; border-radius: 8px; }
ul { margin-top: 30px; list-style: none; padding: 0; }
.memo-container > li { margin-bottom: 30px; padding: 20px; background-color: #fff; border-radius: 15px; border-bottom: 1px solid #eee; transition: transform 0.2s ease; box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
.memo-container > li:hover { transform: scale(1.01); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
ul > li > .list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
ul > li > .list-header > a { min-width: 0; flex: 1; }
ul > li > .list-header > a > h1 { font-size: 25px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
ul > li > .list-header > .btn-group { display: flex; flex-shrink: 0; }
ul > li > .list-header > div > span { font-size: 14px; color: #555; cursor: pointer; margin-left: 10px; white-space: nowrap; }
ul > li > .list-header > div > span:hover { color: black; font-weight: bold; text-decoration: underline; }

.description { font-size: 15px; margin: 14px; }
.createdAt { text-align: right; font-size: 13px; color: #777; margin-top: 10px; }
.has-memo { background-color: rgba(255, 212, 59, 0.4); border-radius: 6px; padding: 2px 6px; }

/* 📌 핀 버튼 및 컨트롤 바 */
.memo-control-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 0 10px; flex-wrap: wrap; gap: 10px; }
.pin-toggle-wrapper { display: flex; justify-content: flex-end; align-items: center; }
.pin-toggle-label { cursor: pointer; font-size: 14px; display: flex; align-items: center; color: #333; font-weight: bold; }
.pin-toggle-label input { margin-right: 8px; transform: scale(1.2); }

.pin-btn { background: #f8fafc; color: #475569; padding: 6px 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 0.85em; font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); margin-right: 5px; }
.pin-btn:hover { background: #ffffff; color: #3b82f6; border-color: #bfdbfe; transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }

/* --- 메인 헤더 레이아웃 --- */
.main-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.header-actions { display: flex; gap: 15px; align-items: center; }

/* --- 프로필 드롭다운 --- */
.header-profile { position: relative; cursor: pointer; user-select: none; margin: 0; }
.profile-arrow { font-size: 0.6em; margin-left: 8px; vertical-align: middle; transition: 0.3s; opacity: 0.5; }
.header-profile:hover .profile-arrow { opacity: 1; }
.header-profile.active .profile-arrow { transform: rotate(180deg); }
.profile-dropdown { position: absolute; top: 120%; left: 0; background: white; border: 1px solid #eee; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); width: 220px; padding: 10px; z-index: 1000; }
.profile-list { padding: 0; margin: 0; list-style: none; }
.profile-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; border-radius: 10px; transition: 0.2s; cursor: pointer; }
.profile-item:hover { background-color: #fdf5f7; }
.profile-item.active { background-color: #fdf5f7; color: #f8c2d1; }
.profile-name { font-weight: bold; font-size: 15px; }
.profile-actions { display: flex; gap: 12px; align-items: center; }
.profile-move-btn, .profile-edit-btn { color: #aaa; font-size: 12px; cursor: pointer; transition: color 0.2s; }
.profile-move-btn:hover, .profile-edit-btn:hover { color: #f8c2d1; }
.profile-delete-btn { color: #aaa; font-size: 14px; cursor: pointer; transition: color 0.2s; }
.profile-delete-btn:hover { color: #ff7675; }
.profile-add-btn { width: 100%; margin-top: 10px; padding: 10px; border: 1px dashed #f8c2d1; background: #fff; color: #f8c2d1; border-radius: 10px; font-weight: bold; cursor: pointer; transition: 0.2s; }

/* --- 기타 버튼 및 검색 --- */
.bulk-delete-btn { background-color: #ff7675; color: white; border: none; padding: 10px 15px; border-radius: 20px; cursor: pointer; font-weight: bold; font-size: 14px; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.search-wrapper { position: relative; }
.search-wrapper input { padding: 10px 40px 10px 15px; border-radius: 25px; border: 1px solid #e0e0e0; outline: none; width: 220px; }
.search-wrapper i { position: absolute; right: 15px; top: 12px; color: #aaa; cursor: pointer; }

/* --- 공통 모달 스타일 --- */
.modal { 
    display: none; 
    position: fixed; 
    z-index: 10000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.5); 
    backdrop-filter: blur(5px); /* ✨ 뒤 배경 블러 처리 추가 */
    align-items: center; 
    justify-content: center; 
}
.modal-content {
    background-color: white;
    width: 400px;
    max-width: 90%;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    box-sizing: border-box;
}
.modal-content-wrap {
    height: auto;      
    max-height: 80vh;  
    width: 380px;      /* 🔥 450px -> 380px로 줄여서 가로로 너무 길지 않게 다듬었습니다. */
    background-color: white;
    padding: 25px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}
.modal-header-box { flex-shrink: 0; border-bottom: 1px solid #eee; padding-bottom: 15px; margin-bottom: 8px; }
.modal-info-text { font-size: 11px; color: #888; margin-bottom: 12px; line-height: 1.4; }

.modal-search-bar {
    width: 100%;
    position: relative;
    margin-top: 10px;
}

.modal-search-bar input {
    width: 100%;
    padding: 10px 40px 10px 15px; /* 오른쪽 공간 확보 */
    border-radius: 20px;
    border: 1px solid #eee;
    outline: none;
}

.modal-search-bar i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%); /* 정확히 가운데 정렬 */
    color: #aaa;
    cursor: pointer;
}
.close-btn { font-size: 24px; font-weight: bold; color: #999; cursor: pointer; line-height: 1; transition: 0.2s; }
.close-btn:hover { color: #333; }

.account-modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 420px;
    max-height: 85vh; 
    overflow-y: auto; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    /* 화면 정가운데 배치 */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}
.account-section { margin-top: 20px; text-align: left; }
.account-section h3 { font-size: 15px; margin-bottom: 10px; color: #333; }
.account-section p { font-size: 12px; color: #888; margin-bottom: 10px; line-height: 1.4; }
.account-input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 8px; box-sizing: border-box; }
.danger-zone { background: #fff0f0; padding: 15px; border-radius: 10px; margin-top: 25px; text-align: left; }
.danger-zone h3 { color: #d63031; font-size: 15px; margin-top: 0; margin-bottom: 5px; }
.danger-zone p { font-size: 12px; color: #d63031; margin-bottom: 10px; }
.btn-account-blue { width: 100%; padding: 10px; background: #0984e3; color: white; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; }
.btn-account-red { width: 100%; padding: 10px; background: #d63031; color: white; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; }
.btn-account-close { width: 100%; padding: 12px; margin-top: 20px; background: #eee; color: #555; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; }

/* --- 휴지통 전용 --- */
#trashModal.modal {
    display: none;
    align-items: center; /* 수직 중앙 */
    justify-content: center; /* 수평 중앙 */
}
.trash-scroll-area { 
    flex: 1; 
    overflow-y: auto !important; 
    overflow-x: hidden; 
    padding-right: 10px; 
    min-height: 0; 
    max-height: 60vh; /* 🔥 리스트 공간의 높이도 함께 제한하여 깔끔하게 줄어들게 합니다 */
}
.trash-scroll-area::-webkit-scrollbar { width: 8px; display: block; }
.trash-scroll-area::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.trash-scroll-area::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }
.trash-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid #eee; transition: background 0.2s; width: 100%; }
.trash-item:hover { background-color: #f9f9f9; }
.trash-item-info strong { display: flex; flex-direction: column; gap: 2px; font-size: 16px; margin-bottom: 4px; }
.trash-btn-group { display: flex; gap: 10px; }
.delete-perm-btn { background-color: #ff7675; color: white; border: none; padding: 8px 15px; border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: bold; }
.delete-perm-btn:hover { background-color: #d63031; transform: translateY(-2px); }
.restore-btn { background-color: #55efc4; color: #2d3436; border: none; padding: 8px 15px; border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: bold; }
.restore-btn:hover { background-color: #00b894; transform: translateY(-2px); }
.empty-trash-btn { background-color: #ff7675; color: white; border: none; padding: 6px 14px; border-radius: 15px; cursor: pointer; font-size: 13px; font-weight: bold; white-space: nowrap; }
.empty-trash-btn:hover { background-color: #d63031; }

/* --- 대형 캘린더 피커 모달 --- */
.picker-box { background: white; padding: 40px; border-radius: 20px; width: 500px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.picker-year-dropdown { padding: 10px 20px; font-size: 20px; font-weight: bold; border-radius: 10px; border: 1px solid #ddd; cursor: pointer; outline: none; }
.picker-month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 10px; }
.picker-month-btn { padding: 25px 10px; font-size: 18px; font-weight: bold; border: 1px solid #f0f0f0; background: #fafafa; border-radius: 15px; cursor: pointer; color: #555; }
.picker-month-btn:hover { background: #f8c2d1; color: white; border-color: #f8c2d1; transform: scale(1.05); }
.picker-month-btn.active { background: #f1a7bb; color: white; border-color: #f1a7bb; }
.picker-close-btn { width: 100%; margin-top: 30px; padding: 15px; border: none; background: #eee; border-radius: 12px; cursor: pointer; font-size: 16px; font-weight: bold; color: #666; }

/* --- 모바일 최적화 --- */
@media screen and (max-width: 768px) {
    .container { flex-direction: column !important; height: auto !important; }
    .sidebar { width: 100% !important; height: auto !important; position: static !important; border-right: none; border-bottom: 1px solid #eee; padding: 15px; }
    .main-content { width: 100% !important; padding: 20px 15px !important; }
    .main-content header { flex-direction: column; align-items: flex-start !important; gap: 15px; }
    .main-content header > div { width: 100%; flex-direction: column; gap: 10px; }
    .search-wrapper, .search-wrapper input { width: 100% !important; box-sizing: border-box; }
    .picker-box { padding: 25px !important; width: 90% !important; }
    .picker-month-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 10px !important; }
    .delete-perm-btn, .restore-btn { padding: 6px 10px; font-size: 12px; white-space:nowrap; }
    .memo-control-bar { display: flex; flex-direction: row !important; justify-content: space-between !important; align-items: center; padding: 0; }
    .sort-select-wrapper, .pin-toggle-wrapper { width: auto !important; }
    .sort-select { width: auto !important; padding: 6px 8px !important; font-size: 13px !important; }
    .pin-toggle-label { width: auto !important; font-size: 13px !important; padding: 6px 10px !important; }
    .pin-toggle-label input { transform: scale(1.1) !important; }
}
.modal-content {
        width: 90% !important;
        padding: 20px !important;
    }

.calendar-header-center { display: flex; align-items: center; justify-content: center; gap: 8px; }
.today-btn { 
    margin-left: 8px; /* 글씨에서 오른쪽으로 살짝 띄우기 */
    padding: 4px 12px; /* 버튼을 살짝 도톰하고 누르기 편하게 */
    font-size: 11px; 
    border: none; /* 딱딱한 선 제거 */
    background: #f1f3f5; /* 부드러운 배경색 */
    border-radius: 12px; /* 요즘 유행하는 둥근 알약 모양 */
    cursor: pointer; 
    font-weight: 800; 
    color: #495057; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* 은은한 그림자 효과 */
    transition: all 0.2s ease; /* 마우스 올릴 때 부드러운 효과 */
}

/* 마우스 올렸을 때 살짝 떠오르는 효과 */
.today-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.08);
}
.picker-year-wrapper { margin-bottom: 30px; }

.help-btn-floating {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: #f8c2d1; /* 분홍색 테마 유지 */
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    z-index: 9000;
}
.help-btn-floating:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
    background-color: #f1a7bb;
}
.help-modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    
    /* 🔥 높이 제한 및 스크롤 기능 유지 */
    max-height: 85vh;
    overflow-y: auto;

    /* 🔥 [핵심] 스크롤바를 눈에 보이지 않게 숨김 */
    -ms-overflow-style: none; /* IE 및 Edge */
    scrollbar-width: none;    /* Firefox */
    
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    line-height: 1.6;
    text-align: left;
    margin: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}
.help-modal-content::-webkit-scrollbar {
    display: none;
}
.help-modal-content::-webkit-scrollbar-thumb {
    background-color: #f8c2d1;
    border-radius: 10px;
}
.help-modal-content::-webkit-scrollbar-track {
    background: transparent;
}
.help-modal-content h2 { color: #333; font-size: 20px; margin-bottom: 15px; display: flex; align-items: center; gap: 8px; margin-top: 0; }
.help-modal-content h3 { color: #0984e3; font-size: 15px; margin-top: 20px; margin-bottom: 8px; }
.help-modal-content p { font-size: 13px; color: #555; margin-bottom: 10px; }
.help-modal-content ul { list-style: none; padding: 0; margin: 0; }
.help-modal-content li { font-size: 13px; color: #555; margin-bottom: 8px; padding-left: 18px; position: relative; }
.help-modal-content li::before { content: "💡"; position: absolute; left: 0; font-size: 11px; }

.help-btn-floating { position: fixed; bottom: 30px; right: 30px; width: 50px; height: 50px; background-color: #f8c2d1; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.15); transition: all 0.3s ease; z-index: 9000; }
.help-btn-floating:hover { transform: translateY(-3px); box-shadow: 0 6px 15px rgba(0,0,0,0.2); background-color: #f1a7bb; }
.help-modal-content { background-color: white; padding: 30px; border-radius: 20px; width: 90%; max-width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); line-height: 1.6; text-align: left; margin: auto; }
.help-modal-content h2 { color: #333; font-size: 20px; margin-bottom: 15px; display: flex; align-items: center; gap: 8px; margin-top: 0; }
.help-modal-content h3 { color: #0984e3; font-size: 15px; margin-top: 20px; margin-bottom: 8px; }
.help-modal-content p { font-size: 13px; color: #555; margin-bottom: 10px; }

