/* ============================================================
   이태원회중 공통 스타일 (itw-common.css)
   ============================================================ */

:root {
    --bg: #f5f4f0;
    --surface: #ffffff;
    --border: #e8e6e0;
    --text: #1a1916;
    --text-muted: #7a7872;
    --accent: #1a3a5c;
    --accent-bg: #eef3f9;
    --green: #1e7e34;
    --green-bg: #eafaf1;
    --orange: #d35400;
    --orange-bg: #fef5ec;
    --red: #c0392b;
    --red-bg: #fdf0ef;
    --blue: #2471a3;
    --blue-bg: #eaf4fb;

    /* 지역별 브랜드 컬러 */
    --c-yongsan: #c0392b;
    --c-itw2: #d35400;
    --c-itw1: #7d6608;
    --c-bogwang: #27ae60;
    --c-dongbing: #2471a3;
    --c-hannam-s: #6c3483;
    --c-hannam-n: #9b59b6;
    --c-etc: #1a5276;
    --c-redev: #616a6b;
    --c-hold: #b2bec3;

    --font-main: 'Noto Sans KR', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --header-h: 52px;
    --tabbar-h: 64px;
}

/* 다크모드 대응은 theme.js에서 data-theme="dark" 속성을 통해 제어합니다. */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    font-size: 14px;
    min-height: 100dvh;
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    -webkit-tap-highlight-color: transparent;
}

.admin-only {
    display: none !important;
}

body.is-admin .admin-only {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
}

/* ── HEADER ── */
.itw-hd {
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: var(--header-h);
}

.itw-hd-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.itw-hd-btn {
    font-size: 12px;
    color: var(--accent);
    padding: 5px 10px;
    border-radius: 7px;
    background: var(--accent-bg);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}

/* ── TABBAR ── */
.itw-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tabbar-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    isolation: isolate;
}

.itw-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 500;
    padding-top: 8px;
    position: relative;
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
    -webkit-user-select: none;
    user-select: none;
}

.itw-tab.active {
    color: var(--accent);
}

.itw-tab svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
}

/* ── TABBAR BADGE ── */
.itw-tab-badge {
    position: absolute;
    top: -2px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    background: var(--red);
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--surface);
    pointer-events: none;
    z-index: 10;
}

/* ── RESPONSIVE: DESKTOP (768px+) ── */
@media (min-width: 768px) {
    body {
        padding-bottom: 0 !important;
        padding-left: 80px;
    }

    .itw-hd {
        left: 80px;
        width: calc(100% - 80px);
    }

    .itw-tabbar {
        top: 0;
        bottom: 0;
        left: 0;
        right: auto;
        width: 80px;
        height: 100dvh;
        flex-direction: column;
        justify-content: flex-start;
        border-top: none;
        border-right: 1px solid var(--border);
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .itw-tab {
        flex: none;
        height: 72px;
        padding-top: 0;
    }

    .itw-tab-badge {
        right: 4px;
        top: 4px;
    }
}

/* ── 공통 오버레이 ── */
.itw-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(0, 0, 0, 0.45);
    align-items: flex-end;
}

.itw-overlay.open {
    display: flex;
}

.itw-sheet {
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    width: 100%;
    animation: itwSlideUp .2s ease;
}

@keyframes itwSlideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.itw-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 16px;
}

/* ── 공통 모달 (Modal System) ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.45);
    align-items: flex-end;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    width: 100%;
    max-height: 90dvh;
    overflow-y: auto;
    animation: slideUp .2s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 16px;
}

.modal-title {
    font-size: clamp(16px, 4.8vmin, 20px);
    font-weight: 700;
    margin-bottom: 16px;
}

.form-field {
    margin-bottom: 14px;
}

.form-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
    display: block;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 11px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
    background: var(--surface);
    color: var(--text);
}

.form-input:focus {
    border-color: var(--accent);
}

.form-input:disabled {
    background: var(--bg);
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.modal-save {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    margin-top: 4px;
}

.modal-cancel {
    width: 100%;
    padding: 12px;
    background: none;
    color: var(--text-muted);
    border: none;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    margin-top: 6px;
}