/* ── 카카오아파트 커스텀 CSS ── */

:root {
    --primary: #5D4037;
    --primary-dark: #3E2723;
    --primary-light: #8D6E63;
    --accent: #FF8F00;
    --accent-light: #FFB300;
    --bg: #F5F5F5;
    --card-bg: #FFFFFF;
    --text: #333333;
    --text-light: #757575;
    --border: #E0E0E0;
    --success: #43A047;
    --danger: #E53935;
}

/* ── 기본 ── */
body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    font-size: 14px;
    padding-bottom: 60px;
}

/* ── 네비게이션 ── */
.navbar {
    padding: 0.5rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 1.1rem;
}

/* ── 카드 ── */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s, box-shadow 0.15s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.card-body {
    padding: 1rem;
}

/* ── 아파트 검색 ── */
.apt-search-wrap {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 56px;
    z-index: 50;
    margin-bottom: 0;
}

.apt-search-wrap .form-control {
    border-radius: 8px;
    font-size: 0.9rem;
    height: 40px;
    border-color: var(--border);
}

.apt-search-wrap .form-select {
    border-radius: 8px;
    font-size: 0.8rem;
    border-color: var(--border);
}

/* ── 아파트 리스트 래퍼 ── */
.apt-list-wrap {
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    overflow: hidden;
}

/* ── 아파트 ROW (당근마켓 스타일) ── */
.apt-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid #f2f2f2;
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.12s;
}

.apt-row:last-child { border-bottom: none; }
.apt-row:active { background-color: #f9f5f2; }

/* ── 아이콘 (56px, 당근 스타일) ── */
.apt-row__ic {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
}

.apt-ic {
    width: 56px;
    height: 56px;
    display: block;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

/* ── 본문 영역 ── */
.apt-row__body {
    flex: 1;
    min-width: 0;
}

.apt-row__top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

/* ── 아파트명 (당근 스타일 큰 폰트) ── */
.apt-row__name {
    font-weight: 700;
    font-size: 1rem;
    color: #212121;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    max-width: 55%;
}

/* ── 메타 정보 (지역·연도·평형) ── */
.apt-row__meta {
    font-size: 0.82rem;
    color: #999;
    line-height: 1.4;
    margin-bottom: 2px;
}

/* ── 미니 태그 (신축, 분양중, 하이앤드) ── */
.apt-mtag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    line-height: 1.3;
}

.mtag--gold {
    background: linear-gradient(135deg, #FFF8E1, #FFE082);
    color: #E65100;
}

.mtag--green {
    background: #E8F5E9;
    color: #2E7D32;
}

.mtag--red {
    background: linear-gradient(135deg, #FFEBEE, #EF9A9A);
    color: #C62828;
}

.mtag--highend {
    background: linear-gradient(135deg, #212121, #424242);
    color: #FFD700;
}

.mtag--highend i {
    font-size: 0.6rem;
}

/* ── 브랜드 원형 (오른쪽 끝) ── */
.brand-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    letter-spacing: -0.03em;
}

/* ── 인프라 아이콘 행 ── */
.apt-row__infra {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.inf-pill {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 8px;
    white-space: nowrap;
}

.inf-pill i { font-size: 0.6rem; }

.inf--blue   { background: #E3F2FD; color: #1565C0; }
.inf--green  { background: #E8F5E9; color: #2E7D32; }
.inf--orange { background: #FFF3E0; color: #E65100; }
.inf--teal   { background: #E0F2F1; color: #00695C; }
.inf--purple { background: #F3E5F5; color: #6A1B9A; }
.inf--indigo { background: #E8EAF6; color: #283593; }
.inf--park   { background: #F1F8E9; color: #33691E; }
.inf--red    { background: #FFEBEE; color: #C62828; }
.inf--pink   { background: #FCE4EC; color: #AD1457; }
.inf--rose   { background: #FBE9E7; color: #BF360C; }

/* ── 기존 호환 (상세 페이지) ── */
.apt-type-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
}

.apt-type-new {
    background-color: var(--accent);
    color: #fff;
}

.apt-type-complete {
    background-color: var(--primary-light);
    color: #fff;
}

/* ── 스켈레톤 로딩 (당근마켓 스타일) ── */
.apt-skel {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid #f2f2f2;
}

.apt-skel__icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: #eee;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.apt-skel__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.apt-skel__line {
    height: 12px;
    border-radius: 6px;
    background: #eee;
    position: relative;
    overflow: hidden;
}

.apt-skel__line--w70 { width: 70%; }
.apt-skel__line--w60 { width: 60%; }
.apt-skel__line--w55 { width: 55%; }
.apt-skel__line--w50 { width: 50%; }
.apt-skel__line--w45 { width: 45%; }
.apt-skel__line--w40 { width: 40%; }
.apt-skel__line--w35 { width: 35%; }
.apt-skel__line--w30 { width: 30%; }

.apt-skel__icon::after,
.apt-skel__line::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; bottom: 0;
    width: 200%;
    background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.6) 50%, transparent 75%);
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(50%); }
}

/* ── 검색 버튼 ── */
.btn-search {
    background-color: var(--primary);
    color: #fff;
    border-radius: 0 8px 8px 0 !important;
    border: none;
    padding: 0 14px;
}

.btn-search:hover,
.btn-search:active {
    background-color: var(--primary-dark);
    color: #fff;
}

/* ── 커뮤니티 게시판 ── */
.board-tabs .nav-link {
    color: var(--text-light);
    font-size: 0.85rem;
    padding: 0.5rem 0.8rem;
    border-radius: 20px;
}

.board-tabs .nav-link.active {
    background-color: var(--primary);
    color: #fff;
}

.post-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.post-item:last-child {
    border-bottom: none;
}

.post-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}

.post-title:hover {
    color: var(--primary);
}

.post-meta {
    font-size: 0.75rem;
    color: var(--text-light);
}

.post-notice {
    background-color: #FFF8E1;
}

.comment-count {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.8rem;
}

/* ── 게시글 상세 ── */
.post-detail .post-header {
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.post-detail .post-content {
    min-height: 200px;
    line-height: 1.8;
    font-size: 0.9rem;
    white-space: pre-wrap;
}

/* ── 댓글 ── */
.comment-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.comment-reply {
    margin-left: 2rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--border);
}

.comment-author {
    font-weight: 500;
    font-size: 0.85rem;
}

.comment-content {
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.comment-date {
    font-size: 0.72rem;
    color: var(--text-light);
}

/* ── 폼 ── */
.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem rgba(93, 64, 55, 0.15);
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-accent {
    background-color: var(--accent);
    border: none;
    color: #fff;
}

.btn-accent:hover {
    background-color: var(--accent-light);
    color: #fff;
}

/* ── 상세 정보 테이블 ── */
.info-table th {
    background-color: #EFEBE9;
    color: var(--primary-dark);
    font-size: 0.8rem;
    font-weight: 500;
    width: 30%;
    padding: 0.5rem 0.75rem;
}

.info-table td {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
}

/* ── 페이지네이션 ── */
.page-link {
    color: var(--primary);
    border-color: var(--border);
    font-size: 0.8rem;
}

.page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ── 빈 상태 ── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state i {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.4;
}

/* ── 푸터 ── */
.footer-bar {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 0.5rem 0;
    z-index: 100;
}

/* ── FAB 버튼 ── */
.fab {
    position: fixed;
    bottom: 4rem;
    right: 1rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--accent);
    color: #fff;
    border: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    text-decoration: none;
}

.fab:hover {
    background-color: var(--accent-light);
    color: #fff;
    transform: scale(1.05);
}

/* ── 인증 페이지 ── */
.auth-container {
    max-width: 420px;
    margin: 2rem auto;
}

.auth-card {
    border-radius: 16px;
    overflow: hidden;
}

.auth-card .card-header {
    background-color: var(--primary);
    color: #fff;
    text-align: center;
    padding: 1.5rem;
    border-bottom: none;
}

.auth-card .card-header h4 {
    margin: 0;
    font-weight: 700;
}

/* ── 무한스크롤 로딩 ── */
#loading .spinner-border {
    width: 1rem;
    height: 1rem;
}

/* ── 반응형 ── */
@media (max-width: 576px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .card-body {
        padding: 0.75rem;
    }

    .comment-reply {
        margin-left: 1rem;
    }

    /* 카드 호버 효과 제거 (모바일) */
    .card:hover {
        transform: none;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }
}

@media (min-width: 768px) {
    body {
        font-size: 15px;
    }

    .fab {
        right: 2rem;
        bottom: 4.5rem;
    }

    .apt-row:hover {
        background-color: #faf7f5;
    }

    .apt-row__ic, .apt-ic {
        width: 64px;
        height: 64px;
    }

    .apt-row__name {
        font-size: 1.08rem;
    }

    .apt-row__meta {
        font-size: 0.88rem;
    }

    .brand-circle {
        width: 40px;
        height: 40px;
        font-size: 0.88rem;
    }

    .apt-mtag {
        font-size: 0.72rem;
        padding: 2px 10px;
    }

    .inf-pill {
        font-size: 0.7rem;
        padding: 3px 9px;
    }
}
