/* Cache Buster: v1773559865 */
/* ========================================
   Layout Fix - 헤더/정렬 고정 및 레이아웃 조정
   ======================================== */

/* 1. 헤더를 완전히 고정 (position: fixed) */
.app-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    background: white !important;
    border-bottom: 1px solid #E5E5E5 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

/* 헤더 내부 레이아웃 조정 */
.app-header-inner {
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 12px 20px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

/* 햄버거 메뉴는 맨 왼쪽에 고정 */
.app-sidebar-toggle {
    order: 1 !important;
    flex-shrink: 0 !important;
    width: 36px !important;
    height: 36px !important;
    padding: 8px !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    border-radius: 8px !important;
    transition: background 0.2s !important;
}

.app-sidebar-toggle:hover {
    background: #F5F5F5 !important;
}

.app-sidebar-toggle .icon {
    width: 20px !important;
    height: 20px !important;
    color: #404040 !important;
}

/* 로고를 햄버거 메뉴 바로 옆으로 */
.app-header-logo {
    order: 2 !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    text-decoration: none !important;
    color: #1E3A8A !important;
    font-weight: 700 !important;
    font-size: 17px !important;
}

.app-header-logo .icon {
    width: 24px !important;
    height: 24px !important;
    color: #1E3A8A !important;
}

/* 검색창을 완전히 중앙에 배치 (PC) */
.sfp-sort-dropdown {
    order: 3 !important;
    flex-shrink: 0 !important;
}
.app-header-search {
    order: 3 !important;
    flex: 1 1 200px !important;
    max-width: 480px !important;
    margin: 0 !important;
    position: relative !important;
}

/* 액션 버튼들을 오른쪽으로 */
.app-header-actions {
    order: 4 !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

/* 2. 메인 콘텐츠 영역에 상단 패딩 추가 (헤더 높이만큼) */
.app-main {
    margin-top: 60px !important; /* 헤더 높이 */
}

.container {
    padding-top: 0 !important;
}

/* 3. 정렬 컨트롤을 고정 (sticky) */
.sort-control {
    position: sticky !important;
    top: 60px !important; /* 헤더 높이 */
    z-index: 999 !important;
    background: white !important;
    border-bottom: 1px solid #E5E5E5 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
    padding: 10px 16px !important;
    margin: 0 !important;
}

/* 4. 사이드바도 헤더 아래로 조정 */
.app-sidebar {
    top: 60px !important; /* 헤더 높이 */
    position: fixed !important;
}

/* 5. 기존 헤더 영역 숨김 (중복 제거) */
.container > .header {
    display: none !important;
}

.container > .stats {
    display: none !important;
}

/* 6. 중복 검색창 숨김 */
.search-section {
    display: none !important;
}

/* 7. 노트 그리드/리스트 상단 여백 조정 */
.notes-grid,
.notes-list {
    margin-top: 0 !important;
    padding-top: 16px !important;
}

/* ========================================
   헤더 검색 스타일 (스타일 가이드 준수)
   ======================================== */
.app-header-search-input {
    width: 100% !important;
    padding: 10px 44px 10px 16px !important;
    border: 1px solid #E5E5E5 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-family: 'Spoqa Han Sans Neo', -apple-system, sans-serif !important;
    background: #FAFAFA !important;
    transition: all 0.2s ease !important;
    color: #404040 !important;
}

.app-header-search-input::placeholder {
    color: #A3A3A3 !important;
}

.app-header-search-input:focus {
    outline: none !important;
    border-color: #1E3A8A !important;
    background: white !important;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.08) !important;
}

/* 검색 아이콘 숨김 */
.app-header-search-icon {
    display: none !important;
}

/* 음성 검색 버튼 (SVG 아이콘 스타일) */
.app-header-search-voice {
    position: absolute !important;
    right: 6px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
}

.app-header-search-voice .icon {
    width: 18px !important;
    height: 18px !important;
    color: #8B5CF6 !important;
    display: block !important;
    transition: all 0.2s ease !important;
}

.app-header-search-voice:hover {
    background: #EDE9FE !important;
}

.app-header-search-voice:hover .icon {
    color: #7C3AED !important;
}

.app-header-search-voice:active {
    transform: translateY(-50%) scale(0.95) !important;
}

/* 음성 검색 녹음 중 상태 */
.app-header-search-voice.recording {
    background: #EDE9FE !important;
    animation: voicePulse 1.5s infinite !important;
}

.app-header-search-voice.recording .icon {
    color: #8B5CF6 !important;
    animation: voiceIconPulse 1.5s infinite !important;
}

@keyframes voicePulse {
    0%, 100% {
        background: #EDE9FE;
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4);
    }
    50% {
        background: #DDD6FE;
        box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
    }
}

@keyframes voiceIconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

/* ========================================
   모바일 반응형
   ======================================== */
@media (max-width: 768px) {
    .app-header-inner {
        padding: 10px 12px !important;
        gap: 8px !important;
    }
    
    /* 모바일에서 로고 텍스트 숨김 */
    .app-header-logo span {
        display: none !important;
    }
    
    .app-header-logo {
        font-size: 0 !important;
    }
    
    .app-header-logo .icon {
        width: 22px !important;
        height: 22px !important;
    }
    
    /* 검색창 조정 */
    .app-header-search {
        max-width: 100% !important;
        flex: 1 !important;
    }
    
    .app-header-search-input {
        padding: 8px 40px 8px 12px !important;
        font-size: 13px !important;
    }
    
    .app-header-search-voice {
        width: 30px !important;
        height: 30px !important;
    }
    
    .app-header-search-voice .icon {
        width: 16px !important;
        height: 16px !important;
    }
    
    /* 정렬 컨트롤 패딩 조정 */
    .sort-control {
        padding: 8px 12px !important;
    }
    
    /* 햄버거 메뉴 */
    .app-sidebar-toggle {
        width: 32px !important;
        height: 32px !important;
        padding: 6px !important;
    }
    
    .app-sidebar-toggle .icon {
        width: 18px !important;
        height: 18px !important;
    }
}

/* 태블릿 */
@media (min-width: 769px) and (max-width: 1024px) {
    .app-header-search {
        max-width: 400px !important;
    }
}

/* 대형 화면 */
@media (min-width: 1400px) {
    .app-header-search {
        max-width: 600px !important;
    }
}

/* ========================================
   검색창 X(지우기) 버튼
   ======================================== */
.app-header-search-clear {
    position: absolute !important;
    right: 42px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 22px !important;
    height: 22px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #D1D5DB !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 12px !important;
    color: #6B7280 !important;
    line-height: 1 !important;
    padding: 0 !important;
    transition: all 0.15s ease !important;
}

.app-header-search-clear:hover {
    background: #9CA3AF !important;
    color: #fff !important;
}

.app-header-search-input.has-value {
    padding-right: 76px !important;
}

html[data-card-theme="dark"] .app-header-search-clear {
    background: rgba(255,255,255,0.15) !important;
    color: #9CA3AF !important;
}

html[data-card-theme="dark"] .app-header-search-clear:hover {
    background: rgba(255,255,255,0.3) !important;
    color: #fff !important;
}

/* submit 버튼 영구 숨김 (실시간 검색으로 대체, X버튼과 위치 충돌 방지) */
.app-header-search-submit {
    display: none !important;
}
