/* ===== 종친회 앱 — 남색 + 금색 테마 ===== */

:root {
    --navy: #0D1B2A;
    --blue: #1B3A5C;
    --gold: #C8963E;
    --gold-light: #D4A853;
    --bg: #F5F0E8;
    --bg-page: #F2F2F2;
    --white: #FFFFFF;
    --dark: #2C2C2C;
    --gray: #888888;
    --light-gray: #E8E8E8;
    --danger: #C62828;
    --success: #2E7D32;

    --font-xs: 11px;
    --font-sm: 13px;
    --font-md: 15px;
    --font-lg: 17px;
    --font-xl: 20px;
    --font-xxl: 24px;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;

    --topbar-h: 52px;
    --tabbar-h: 58px;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    background: var(--bg-page);
    color: var(--dark);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { border: none; background: none; cursor: pointer; font: inherit; color: inherit; }
input, textarea, select {
    font: inherit;
    color: var(--dark);
    border: 1.5px solid var(--light-gray);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    width: 100%;
    background: var(--white);
    outline: none;
    transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); }
img { max-width: 100%; display: block; }

/* ===== Topbar ===== */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: calc(var(--topbar-h) + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--navy);
    color: var(--white);
    display: flex;
    align-items: center;
    z-index: 100;
    padding-left: 12px;
    padding-right: 12px;
}
.topbar-left, .topbar-right { width: 48px; flex-shrink: 0; }
.topbar-right { text-align: right; }
.topbar-center {
    flex: 1;
    text-align: center;
    font-size: var(--font-lg);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    font-size: 20px;
    color: var(--white);
    border-radius: 50%;
}
.topbar-btn:active { background: rgba(255,255,255,0.1); }

/* ===== Content ===== */
.content {
    padding-top: calc(var(--topbar-h) + var(--safe-top));
    min-height: 100vh;
}
.content.has-tabbar {
    padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}

/* ===== Tabbar ===== */
.tabbar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--tabbar-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--white);
    border-top: 1px solid var(--light-gray);
    display: flex;
    z-index: 100;
}
.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--gray);
    font-size: 10px;
    transition: color 0.2s;
}
.tab.active { color: var(--gold); }
.tab-icon { font-size: 22px; line-height: 1; }
.tab-label { font-weight: 500; }

/* ===== Card ===== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    margin: 8px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-title {
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
}
.card-meta {
    font-size: var(--font-xs);
    color: var(--gray);
}
.card-body {
    font-size: var(--font-sm);
    color: #555;
    line-height: 1.6;
    margin-top: 6px;
}

/* ===== Banner ===== */
.banner {
    margin: 10px 14px;
    padding: 18px;
    background: linear-gradient(135deg, var(--navy), var(--blue));
    border-radius: var(--radius-lg);
    color: var(--white);
}
.banner-title { font-size: var(--font-md); font-weight: 600; }
.banner-desc { font-size: var(--font-xs); opacity: 0.8; margin-top: 4px; }

/* ===== Button ===== */
.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--font-md);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn:active { opacity: 0.8; }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-gold { background: var(--gold); color: var(--white); }
.btn-outline { background: var(--white); color: var(--navy); border: 1.5px solid var(--navy); }
.btn-danger { background: var(--white); color: var(--danger); border: 1.5px solid var(--danger); }
.btn-group { display: flex; gap: 8px; margin: 12px 0; }
.btn-group .btn { flex: 1; }

/* ===== Form ===== */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block;
    font-size: var(--font-xs);
    color: var(--gray);
    margin-bottom: 4px;
    font-weight: 500;
}

/* ===== Tag ===== */
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}
.tag-blue { background: #E8EAF6; color: var(--blue); }
.tag-gold { background: #FFF8E1; color: var(--gold); }
.tag-green { background: #E8F5E9; color: var(--success); }
.tag-red { background: #FFEBEE; color: var(--danger); }
.tag-gray { background: #F5F5F5; color: var(--gray); }
.tag-notice { background: var(--danger); color: var(--white); font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.tag-vote { background: var(--gold); color: var(--white); font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.tag-anon { background: #666; color: var(--white); font-size: 10px; padding: 2px 6px; border-radius: 4px; }

/* ===== Common Text ===== */
.name { font-size: var(--font-sm); font-weight: 600; color: var(--dark); }
.desc { font-size: var(--font-xs); color: var(--gray); margin-top: 1px; }

/* ===== List ===== */
.list-item {
    display: flex;
    align-items: center;
    padding: 14px;
    background: var(--white);
    border-bottom: 1px solid #F0F0F0;
    gap: 12px;
}
.list-item:active { background: #FAFAFA; }
.avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--gray);
    flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 14px; }
.avatar-lg { width: 64px; height: 64px; font-size: 28px; }
.avatar-navy { background: var(--navy); color: var(--white); }
.avatar-gold { background: var(--gold); color: var(--white); }

/* ===== Notification ===== */
.noti-item {
    padding: 14px;
    background: var(--white);
    border-bottom: 1px solid #F0F0F0;
}
.noti-item.unread { background: #F0F4FF; }
.noti-title { font-size: var(--font-sm); color: var(--dark); font-weight: 500; }
.noti-time { font-size: var(--font-xs); color: var(--gray); margin-top: 3px; }

/* ===== Tab Menu (게시판 등) ===== */
.tab-menu {
    display: flex;
    background: var(--white);
    border-bottom: 1px solid var(--light-gray);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab-menu-item {
    flex: 1;
    min-width: 60px;
    text-align: center;
    padding: 10px 0;
    font-size: var(--font-sm);
    color: var(--gray);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.tab-menu-item.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
    font-weight: 600;
}

/* ===== Info Box ===== */
.info-box {
    margin: 10px 14px;
    padding: 14px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid #E8E0D0;
}
.info-box-title {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--gold);
    margin-bottom: 4px;
}
.info-box-text {
    font-size: var(--font-xs);
    color: var(--gray);
    line-height: 1.5;
}

/* ===== Empty State ===== */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: var(--font-sm); }

/* ===== Loading ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray);
    font-size: var(--font-sm);
}

/* ===== Type Button ===== */
.type-btn { padding: 6px 14px; border-radius: 16px; font-size: 12px; background: #f0f0f0; color: #666; cursor: pointer; }
.type-btn.active { background: var(--navy); color: #fff; }

/* ===== Genealogy Tree ===== */
.gen-row { text-align: center; margin: 4px 0; }
.gen-label { font-size: 11px; color: var(--gray); margin-bottom: 2px; }
.gen-nodes { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }
.tree-person { display: inline-block; padding: 6px 12px; border: 1.5px solid var(--blue); border-radius: 6px; font-size: 12px; color: var(--navy); background: #fff; cursor: pointer; margin: 2px; }
.tree-person:active { background: var(--bg); }
.tree-connector { width: 2px; height: 12px; background: var(--light-gray); margin: 0 auto; }

/* ===== 반응형: PC ===== */
/* ===== FAB ===== */
.fab {
    position: fixed;
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
    right: 16px;
    width: 56px; height: 56px;
    background: var(--gold);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 50;
    text-decoration: none;
}

@media (min-width: 768px) {
    body { background: #E8E8E8; }
    .topbar, .tabbar { max-width: 480px; left: 50%; transform: translateX(-50%); }
    .content { max-width: 480px; margin: 0 auto; background: var(--bg-page); min-height: 100vh; }
    .fab { right: calc(50% - 240px + 16px); }
}
