/* ==========================================================================
   main.css – 보배드림 홈 (New UI)
   Design Tokens from Figma:
     --c-text:      #1A1C1F / #1A1C20
     --c-text-sub:  #2B2F37
     --c-text-spec: #323437
     --c-gray:      #868B94
     --c-gray-light:#B0B3B9
     --c-border:    #F3F3F3
     --c-bg:        #F3F4F5 / #F7F8F9
     --c-blue:      #3B7FC9
     --c-blue-bg:   #E1F0FF
     --c-blue-dark: #1B498C
     --c-green-bg:  #EDFAF6
     --c-green:     #075445
     --c-pill-dark: #2A3038 / #2B2F37
   ========================================================================== */

:root {
    --c-text: #1A1C1F;
    --c-text2: #1A1C20;
    --c-text-sub: #2B2F37;
    --c-text-spec: #323437;
    --c-gray: #868B94;
    --c-gray-light: #B0B3B9;
    --c-border: #F3F3F3;
    --c-bg: #F3F4F5;
    --c-bg-light: #F7F8F9;
    --c-blue: #3B7FC9;
    --c-blue-link: #2A94FF;
    --c-blue-bg: #E1F0FF;
    --c-blue-dark: #1B498C;
    --c-green-bg: #EDFAF6;
    --c-green: #075445;
    --c-pill-dark: #2A3038;
    --c-white: #FFFFFF;

    --header-h: 72px;  /* 50 header + 22 padding */
    --bottom-h: 64px;
    --side-pad: 20px;
    --max-w: 412px;
}


/* ==========================================================================
   Header
   ========================================================================== */
.main-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--side-pad) 6px;
    background: var(--c-white);
    max-width: var(--max-w);
}

a.main-header__left {
    text-decoration: none;
    color: inherit;
}

.main-header__left {
    display: flex;
    align-items: center;
    gap: 5px;
}

.main-header__symbol {
    width: 24px; height: 24px; flex-shrink: 0;
}
.main-header__symbol img,
.main-header__symbol svg { display: block; }

.main-header__logo-text {
    font-size: 18px;
    font-weight: 800;
    color: var(--c-text);
    letter-spacing: -0.3px;
}

.main-header__right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.main-header__btn {
    display: flex; align-items: center; justify-content: center;
    padding: 0; border: none; background: none;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.main-header__btn svg { display: block; }


/* ==========================================================================
   Pill Menu (가로 스크롤)
   ========================================================================== */
.pill-menu-wrap {
    position: sticky;
    top: 52px;
    z-index: 99;
    background: var(--c-white);
    padding: 10px 0 20px var(--side-pad);
}

.pill-menu {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-right: var(--side-pad);
    cursor: grab;
}
.pill-menu::-webkit-scrollbar { display: none; }
.pill-menu.is-grabbing {
    cursor: grabbing;
    user-select: none;
}

.pill-menu__item {
    flex-shrink: 0;
    padding: 11px 13px;
    border-radius: 25px;
    border: none;
    background: var(--c-bg);
    font-size: 14px;
    font-weight: 700;
    color: var(--c-text2);
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: background .2s ease, color .2s ease, transform .1s ease;
}

.pill-menu__item:active {
    transform: scale(0.96);
}

.pill-menu__item.is-active {
    background: var(--c-pill-dark);
    color: var(--c-white);
}

.pill-menu__item--arrow {
    display: flex;
    align-items: center;
    gap: 6px;
}
.pill-menu__item--arrow svg { flex-shrink: 0; }


/* ==========================================================================
   Main Content
   ========================================================================== */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding-bottom: calc(var(--bottom-h) + 40px);
}


/* ==========================================================================
   Section Header (공통)
   ========================================================================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 10px;
}
.section-header--padded {
    padding-left: var(--side-pad);
}

.section-header__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--c-text-sub);
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.beta-badge {
    font-family: 'Segoe UI', sans-serif;
    font-size: 9px;
    font-weight: 700;
    font-style: italic;
    color: var(--c-blue);
}

.section-header__arrow {
    display: flex; align-items: center; justify-content: center;
    padding: 0; border: none; background: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.section-header__arrow svg { display: block; }

/* 공통 dot */
.dot {
    color: var(--c-gray);
    margin: 0 1px;
}


/* ==========================================================================
   Feed Section (이슈/이벤트 + 인기글 순위)
   ========================================================================== */
.feed-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0 var(--side-pad);
}

.feed-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--c-border);
}

.feed-item__title-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.feed-badge {
    flex-shrink: 0;
    padding: 2px 4px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
}
.feed-badge--issue {
    background: var(--c-blue-bg);
    color: var(--c-blue);
}
.feed-badge--event {
    background: var(--c-green-bg);
    color: var(--c-green);
}

.feed-rank {
    flex-shrink: 0;
    padding: 0 3px;
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    font-weight: 700;
    font-style: italic;
    color: var(--c-blue);
    min-width: 14px;
    text-align: center;
}

.feed-item__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text2);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.feed-item__comments {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--c-blue);
}

.feed-item__meta {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 600;
    color: var(--c-gray);
}


/* ==========================================================================
   Shortform Section (자동차 숏폼)
   ========================================================================== */
.shortform-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-left: var(--side-pad);
}

.shortform-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-right: var(--side-pad);
    cursor: grab;
}
.shortform-scroll::-webkit-scrollbar { display: none; }
.shortform-scroll.is-grabbing { cursor: grabbing; user-select: none; }

.shortform-card {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 148px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.shortform-card__thumb {
    position: relative;
    width: 148px;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(127deg, #fff 1%, #ddeeff 99%);
}

.shortform-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.shortform-card:hover .shortform-card__img {
    transform: scale(1.08);
}

.shortform-card__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    opacity: 0.9;
}

.shortform-card__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-sub);
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ==========================================================================
   Car Section (중고차)
   ========================================================================== */
.car-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-left: var(--side-pad);
}

/* Car Tabs */
.car-tabs-wrap {
    overflow: visible;
}

.car-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-right: var(--side-pad);
    cursor: grab;
}
.car-tabs::-webkit-scrollbar { display: none; }
.car-tabs.is-grabbing { cursor: grabbing; user-select: none; }

.car-tab {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 11px 13px;
    border-radius: 25px;
    border: 1px solid var(--c-bg);
    background: var(--c-white);
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text2);
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s, color .15s, border-color .15s;
}

.car-tab.is-active {
    background: var(--c-text-sub);
    color: var(--c-white);
    border-color: var(--c-text-sub);
}
.car-tab.is-active svg { display: inline-block; }
.car-tab svg { display: none; }

/* Car List */
.car-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-right: var(--side-pad);
}

.car-item {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--c-border);
}

.car-item__thumb {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background: #eee;
}

.car-item__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.car-item:hover .car-item__img {
    transform: scale(1.08);
}

.car-item__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.car-item__name {
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text2);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.car-item__price-row {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.car-item__price {
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text2);
}

.car-item__price-row span {
    font-size: 14px;
    font-weight: 500;
    color: var(--c-text-spec);
}

.car-item__tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.car-tag {
    padding: 3px 6px;
    border-radius: 50px;
    background: var(--c-blue-bg);
    font-size: 11px;
    font-weight: 700;
    color: var(--c-blue);
    white-space: nowrap;
}

.car-item__meta {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 600;
    color: var(--c-gray);
}

.car-item__more {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    padding: 4px 0 0;
    border: none;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}


/* ==========================================================================
   Trending Section (지금 뜨는 커뮤니티)
   ========================================================================== */
.trending-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 var(--side-pad);
}

.trending-boards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trending-board {
    background: var(--c-bg-light);
    border-radius: 16px;
    overflow: hidden;
}

.trending-board__header {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 15px;
    border: none;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.trending-board__emoji {
    font-size: 16px;
    flex-shrink: 0;
}

.trending-board__name {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    color: var(--c-text2);
    text-align: left;
}

.trending-board__chevron {
    flex-shrink: 0;
    transition: transform .25s ease;
}

.trending-board.is-expanded .trending-board__chevron {
    transform: rotate(180deg);
}

.trending-board__sub {
    display: none;
    padding: 0 15px 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--c-gray);
    gap: 3px;
}
.trending-board.is-expanded .trending-board__sub {
    display: flex;
}

.trending-board__list {
    display: none;
    flex-direction: column;
    padding: 0 0 5px;
}
.trending-board.is-expanded .trending-board__list {
    display: flex;
}

.trending-post {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 15px;
    text-decoration: none;
    border-bottom: 1px solid var(--c-border);
    -webkit-tap-highlight-color: transparent;
}
.trending-post--last {
    border-bottom: none;
}

.trending-post__rank {
    font-size: 15px;
    font-weight: 700;
    color: var(--c-blue);
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.trending-post__title {
    flex: 1;
    min-width: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trending-post__comments {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--c-blue-link);
}


/* ==========================================================================
   Drawer (사이드 메뉴)
   ========================================================================== */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}
.drawer-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 201;
    width: 280px;
    max-width: 80vw;
    height: 100%;
    background: var(--c-white);
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1), visibility .3s;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08);
    visibility: hidden;
}
.drawer.is-open {
    transform: translateX(0);
    visibility: visible;
}

.drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--c-border);
}

.drawer__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--c-text);
}

.drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.drawer__close svg { display: block; }

.drawer__nav {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.drawer__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s ease;
}
.drawer__item:active {
    background: var(--c-bg);
}

.drawer__item--danger {
    color: #E53935;
}
.drawer__item--danger svg {
    stroke: #E53935;
}

.drawer__divider {
    height: 1px;
    background: var(--c-border);
    margin: 8px 20px;
}


/* ==========================================================================
   Bottom Navigation
   ========================================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-w);
    background: var(--c-white);
    display: flex;
    align-items: center;
    border-top: 1px solid #DCDEE2;
    padding-bottom: 0;  /* safe area */
    z-index: 100;
}

.bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 0;
    text-decoration: none;
    color: var(--c-gray-light);
    -webkit-tap-highlight-color: transparent;
    transition: color .15s;
}

.bottom-nav__item.is-active {
    color: var(--c-text);
}

.bottom-nav__icon {
    width: 24px; height: 24px; display: block;
}

.bottom-nav__label {
    font-size: 12px;
    font-weight: 700;
    color: inherit;
    text-align: center;
}


/* ==========================================================================
   반응형 – 모바일웹 센터 정렬
   ========================================================================== */

/* 전체 래퍼 중앙 정렬 */
.mobile-wrap {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    min-height: 100vh;
    background: var(--c-white);
    position: relative;
}

/* 스티키 헤더 – 래퍼 안에서 자동 센터 */
.main-header {
    max-width: var(--max-w);
    margin-left: auto;
    margin-right: auto;
}

/* 스티키 필메뉴 – 래퍼 안에서 자동 센터 */
.pill-menu-wrap {
    max-width: var(--max-w);
    margin-left: auto;
    margin-right: auto;
}

/* 하단 내비게이션 – fixed이므로 별도 센터 처리 */
.bottom-nav {
    left: 50%;
    transform: translateX(-50%);
    max-width: var(--max-w);
}

/* 드로어 – 넓은 화면에서 래퍼 우측에 정렬 */
@media (min-width: 413px) {
    .drawer {
        right: calc(50% - var(--max-w) / 2);
    }
}

/* 412px 이하에서는 화면 전체 사용 */
@media (max-width: 412px) {
    .mobile-wrap {
        max-width: 100vw;
    }
}
