/*
 * sidebar_style.css
 * 캐롯팜 사이드바 통합 스타일시트
 * navigation.php에서 자동으로 include됨
 * 모든 페이지에서 동일한 사이드바 스타일 보장
 *
 * 이 파일에 사이드바 관련 스타일을 집중 관리합니다.
 * 다른 CSS 파일(main_style.css, view_item_style.css, commu_style.css 등)에서
 * 사이드바 관련 스타일을 중복 선언하지 마세요.
 */

/* ========================================
   1. 레이아웃 컨테이너
======================================== */
.main-layout-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    gap: 24px;
    width: 100%;
    box-sizing: border-box;
}


.main-container {
    flex: 1 1 0%;
    min-width: 0;
    box-sizing: border-box;
    z-index: 1;
}

.page-content-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 5px auto 0;
    box-sizing: border-box;
    padding-bottom: 80px;
    background: white;
    padding: 0;
    min-height: calc(100vh - 80px);
}

/* PC용 main.main-container */
@media (min-width: 1025px) {
    main.main-container {
        max-width: 1200px;
        width: 100%;
        box-sizing: border-box;
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 4px 24px rgba(0,0,0,0.07);
        padding: 10px;
        min-height: 1000px;
        position: relative;
    }
}

/* ========================================
   2. 사이드바 구조 컨테이너
======================================== */
.sidebar-top-container {
    margin-bottom: 14px;
}

.sidebar-main-container {
    background: #fff;
    border: 1px solid #e6e8eb;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    padding: 10px 6px;
}

.sidebar-kakao-wrap {
    padding: 8px 10px 4px;
    text-align: center;
}

/* ========================================
   3. 프로필 카드
======================================== */
.sidebar-profile-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e6e8eb;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    padding: 0;
    margin-bottom: 14px;
    overflow: hidden;
}

/* 히어로 영역 (배경 + 아바타) */
.spc-hero {
    position: relative;
    height: 70px;
    display: flex;
    justify-content: center;
}
.spc-hero-bg {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 70px;
    background: linear-gradient(135deg, #ff9a5c 0%, #ff7e36 50%, #e8590c 100%);
    border-radius: 0;
}
.spc-avatar {
    position: absolute;
    bottom: -28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #fff;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    z-index: 2;
}
.spc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 닉네임 + 액션 */
.spc-user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 34px 16px 12px;
    gap: 8px;
}
.spc-nickname {
    font-size: 17px;
    font-weight: 700;
    color: #202124;
    line-height: 1.3;
}
.spc-user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.spc-btn-settings {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #f1f3f5;
    border-radius: 50%;
    color: #868e96;
    text-decoration: none;
    transition: all 0.2s;
}
.spc-btn-settings:hover {
    background: #ff7e36;
    color: #fff;
}
.spc-btn-logout {
    display: inline-block;
    padding: 5px 14px;
    background: #f1f3f5;
    color: #495057;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}
.spc-btn-logout:hover {
    background: #e9ecef;
    color: #212529;
}

/* 포인트 | 등급 카드 */
.spc-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 14px;
    margin-bottom: 12px;
}
.spc-stat-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fafbfc;
    border: 1px solid #f1f3f5;
    border-radius: 10px;
    padding: 10px 12px;
    transition: all 0.2s;
}
.spc-stat-card:hover {
    background: #fff5ef;
    border-color: #ffd8b8;
}
.spc-stat-icon {
    font-size: 18px;
    line-height: 1;
}
.spc-stat-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.spc-stat-label {
    font-size: 11px;
    color: #868e96;
    font-weight: 500;
    line-height: 1.3;
}
.spc-stat-value {
    font-size: 14px;
    font-weight: 700;
    color: #ff7e36;
    line-height: 1.3;
}
.spc-stat-value.small-text {
    font-size: 13px;
    color: #495057;
}

/* 하단 4탭 */
.spc-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid #f1f3f5;
    margin: 4px 0 0;
    padding: 12px 8px 10px;
}
.spc-tab {
    position: relative;
    padding: 0;
    text-align: center;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.tab-icon-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.tab-icon-circle {
    font-size: 18px;
    line-height: 1;
}
.tab-label {
    color: #495057;
    font-size: 11px;
    font-weight: 600;
    padding: 0;
}
.spc-tab:hover .tab-label {
    color: #ff7e36;
}
.spc-tab:hover .tab-icon-circle {
    transform: scale(1.15);
    transition: transform 0.2s;
}

/* 탭 배지 */
.tab-badge {
    position: absolute;
    top: -8px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ff4757;
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(255, 71, 87, 0.3);
    white-space: nowrap;
}

/* 포인트 호버 */
.spc-points:hover {
    background: #f6f8fa;
    border-radius: 4px;
    padding: 4px 6px;
    margin: -4px -6px;
}

/* ========================================
   4. 사이드바 내비게이션 (그룹, 제목, 버튼)
======================================== */
.sidebar-group {
    padding: 8px 8px;
    margin-bottom: 0;
}
.sidebar-title {
    font-size: 12px;
    font-weight: 700;
    color: #868e96;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 8px 8px;
    margin: 0 0 4px 0;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sidebar-title-icon {
    font-size: 14px;
    line-height: 1;
}
.sidebar-divider {
    border: none;
    border-top: 1px solid #f1f3f5;
    margin: 4px 14px;
}

/* board-nav-btn */
.board-nav-btn {
    display: block;
    padding: 8px 14px;
    margin: 2px 4px;
    text-decoration: none;
    color: #495057;
    font-weight: 500;
    font-size: 13.5px;
    background-color: transparent;
    border-radius: 8px;
    transition: all 0.15s ease;
}
.board-nav-btn.sub-nav {
    padding-left: 30px;
    font-size: 13px;
    color: #868e96;
}
.board-nav-btn.sub-nav::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #dee2e6;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}
.board-nav-btn:hover {
    background-color: #f8f9fa;
    color: #212529;
}
.board-nav-btn.active {
    background: #fff5ef;
    color: #e8590c;
    font-weight: 700;
    border-left: 3px solid #ff7e36;
    padding-left: 11px;
}

/* 사이드바 요약 카드 (레거시 호환) */
.sidebar-carrot-card,
.sidebar-level-card {
    margin-top: 6px;
}
.sidebar-carrot-card p { font-size: 16px; }
.sidebar-level-card p.small-text { font-size: 13px; }

/* ========================================
   5. 사이드바 토글 (태블릿/iPad)
======================================== */
.sidebar-toggle-btn {
    display: none;
    position: fixed;
    left: 16px;
    bottom: 90px;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    background: #ff7e36;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 3px 12px rgba(255, 126, 54, 0.4);
    transition: background 0.2s, transform 0.2s;
}
.sidebar-toggle-btn:active {
    transform: scale(0.92);
}
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
}
.sidebar-backdrop.active {
    display: block;
}
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    background: #f1f3f5;
    border: none;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #495057;
    z-index: 1;
    transition: background 0.2s;
}
.sidebar-close-btn:hover {
    background: #e9ecef;
}

/* ========================================
   6. 캐롯포인트 변동내역 오버레이
======================================== */
.rating-popup-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}
.rating-popup {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.rating-popup h2 {
    margin-top: 0;
    text-align: center;
    color: #ff7e36;
    font-size: 20px;
}
.point-history-list {
    list-style: none;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
    margin: 0;
}
.point-history-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f2f5;
    font-size: 14px;
}
.point-history-list li:last-child { border-bottom: none; }
.history-points.gain { font-weight: 700; color: #28a745; flex-basis: 80px; }
.history-points.loss { font-weight: 700; color: #dc3545; flex-basis: 80px; }
.history-reason { flex-grow: 1; color: #333; text-align: left; padding: 0 10px; }
.history-date { font-size: 13px; color: #606770; flex-basis: 90px; text-align: right; }
.popup-buttons {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}
.btn-close-gift-popup {
    flex: 1;
    padding: 12px;
    border-radius: 6px;
    border: none;
    background: #6c757d;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.btn-close-gift-popup:hover { background: #5a6268; }

/* ========================================
   7. 반응형: 모바일 (767px 이하)
======================================== */
@media (max-width: 767px) {
    .board-nav-container,
    .sidebar-top-container,
    .sidebar-main-container {
        display: none !important;
    }
    .main-layout-container {
        flex-direction: column !important;
        padding: 0 !important;
        gap: 0 !important;
    }

}

/* ========================================
   8. 반응형: 데스크톱 (768px 이상)
======================================== */
@media (min-width: 768px) {
    .board-nav-container {
        display: flex;
        flex-direction: column;
        width: 260px;
        flex: 0 0 260px;
        flex-shrink: 0;
        padding: 0px;
        margin-top: 0;
        box-sizing: border-box;
        margin-bottom: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        height: auto;
        position: static;
        overflow-x: visible;
        white-space: normal;
    }
    .board-nav-btn {
        display: block;
        width: auto;
        text-align: left;
        margin: 2px 4px;
        padding: 8px 14px;
        border: none;
        border-radius: 8px;
    }
    .board-nav-btn:hover {
        background-color: #f8f9fa;
        color: #212529;
    }
    .board-nav-btn.active:hover {
        background: linear-gradient(135deg, #fff5ef 0%, #fff0e6 100%);
        color: #e8590c;
    }
}

/* ========================================
   9. 반응형: 태블릿 오버레이 (768px~1024px)
======================================== */
@media (min-width: 768px) and (max-width: 1024px) {
    .board-nav-container {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 80vw;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1001;
        background: #fff;
        padding: 56px 16px 20px;
        overflow-y: auto;
        box-shadow: none;
        flex: none;
        height: auto;
    }
    .board-nav-container.sidebar-open {
        transform: translateX(0);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    }
    .sidebar-toggle-btn { display: flex; }
    .sidebar-close-btn { display: flex; }
    .main-layout-container { gap: 0; }
    .main-container { flex: 1 1 100%; min-width: 0; width: 100%; }
    .post-list { min-width: 0; }
    .page-content-wrapper { max-width: 100%; padding: 0 16px; }
}
