/* ============================================================
   모두시공 - 모바일 앱 스타일 CSS
   ============================================================ */

/* --- CSS 변수 --- */
:root {
    --primary: #2c3e6b;
    --primary-light: #3d5a9e;
    --primary-dark: #1a2744;
    --accent: #e67e22;
    --accent-light: #f39c12;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f1c40f;
    --info: #3498db;

    --bg: #f5f5f5;
    --bg-white: #ffffff;
    --bg-card: #ffffff;
    --bg-header: #ffffff;

    --text: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --text-white: #ffffff;

    --border: #e8e8e8;
    --border-light: #f0f0f0;

    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --header-height: 56px;
    --bottom-nav-height: 60px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);

    --font: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.3s ease;
}

/* --- 리셋 --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

ul, ol {
    list-style: none;
}

/* --- 앱 컨테이너 --- */
.app-body {
    min-height: 100vh;
    min-height: 100dvh;
    background: #0a0e1a;
}

/* 파티클 배경 캔버스 */
#particle-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg-white);
    position: relative;
    z-index: 1;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.app-main {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 16px);
    min-height: calc(100vh - var(--header-height));
}

/* --- 헤더 --- */
.app-header {
    position: sticky;
    top: 0;
    width: 100%;
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-light);
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 8px;
}

.header-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.header-btn:active {
    background: var(--border-light);
}

.header-btn .material-icons-round {
    font-size: 24px;
    color: var(--text);
}

.header-center {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.header-icon {
    font-size: 20px;
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.header-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.header-right {
    display: flex;
    gap: 4px;
    min-width: 44px;
    justify-content: flex-end;
}

/* --- 하단 탭 네비게이션 --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    z-index: 100;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 4px;
    flex: 1;
    gap: 2px;
    color: var(--text-muted);
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item .material-icons-round {
    font-size: 24px;
}

.bottom-nav-label {
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
}

/* --- 사이드 메뉴 --- */
.side-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.side-overlay.active {
    opacity: 1;
    visibility: visible;
}

.side-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 80%;
    height: 100%;
    background: var(--bg-white);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.side-menu.active {
    transform: translateX(0);
}

.side-menu-content {
    padding: 60px 0 20px;
}

.side-menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
}

.side-menu-item:active {
    background: var(--bg);
}

.side-menu-item .material-icons-round {
    font-size: 24px;
    color: var(--text-light);
}

.side-menu-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.side-menu-text strong {
    font-size: 15px;
    font-weight: 600;
}

.side-menu-text span {
    font-size: 12px;
    color: var(--text-muted);
}

.side-menu-close {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    width: 100%;
    color: var(--text-light);
    font-size: 14px;
}

.side-menu-close .material-icons-round {
    font-size: 20px;
}

/* --- 플래시 메시지 --- */
.flash-message {
    margin: 12px 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    animation: flashFadeIn 0.3s ease;
}

.flash-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.flash-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

@keyframes flashFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 유틸리티 --- */
.section {
    padding: 20px 16px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

.section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: -12px;
    margin-bottom: 16px;
}

.divider {
    height: 8px;
    background: var(--bg);
    margin: 0 -16px;
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.px-16 { padding-left: 16px; padding-right: 16px; }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* --- 빈 상태 --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .material-icons-round {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}

/* --- 페이지네이션 --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 20px 16px;
}

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-light);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--bg);
}

.pagination .active {
    background: var(--primary);
    color: var(--text-white);
    border-color: var(--primary);
}

/* --- 스크롤바 숨기기 (모바일 앱 느낌) --- */
::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* --- 모바일 탭 하이라이트 제거 --- */
* {
    -webkit-tap-highlight-color: transparent;
}

/* --- 안전 영역 (노치 대응) --- */
@supports (padding: env(safe-area-inset-top)) {
    .app-header {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--header-height) + env(safe-area-inset-top));
    }
}
