/* 네비게이션 */
.navbar {
    padding: 12px 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    background: var(--bg-card);
}
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text);
}
.navbar-brand span {
    color: var(--primary);
}
.nav-link {
    font-weight: 600;
    color: var(--text);
    margin: 0 10px;
}
.nav-link:hover, .nav-link.active {
    color: var(--primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.user-profile .name {
    font-weight: 600;
    color: var(--text);
}

.btn-login {
    background-color: var(--bg);
    color: var(--primary);
    font-weight: 600;
    border-radius: 4px;
    padding: 8px 20px;
}
.btn-login:hover {
    background-color: var(--primary);
    color: #fff;
}

/* 대시보드 헤더 */
.dash-header {
    padding: 24px 0;
    margin-bottom: 24px;
}
.dash-header h2 {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 4px;
}
.dash-header p {
    color: var(--text-secondary);
    margin: 0;
}

.list-section {
    padding: 24px 0 48px;
    background-color: var(--bg);
    min-height: calc(100vh - 200px);
}

/* 푸터 */
.footer {
    background-color: #1a1a1a;
    color: #fff;
    padding: 40px 0 16px;
    text-align: center;
}
.footer .social-icons a {
    color: #fff;
    font-size: 1.3rem;
    margin: 0 10px;
    opacity: 0.7;
}
.footer .social-icons a:hover { opacity: 1; }
.footer-menu { margin-bottom: 16px; }
.footer-menu a {
    color: #fff;
    text-decoration: none;
    margin: 0 12px;
    opacity: 0.8;
}
.footer-menu a:hover { opacity: 1; }

/* 사이드바 */
:root {
    --sidebar-w: 240px;
    --topbar-h: 48px;
    --border-color: var(--border);
    --muted-text: var(--text-muted);
    --focus-color: var(--primary);
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: #1e2a3a;
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width 0.2s, transform 0.2s;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sidebar-brand a {
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
    text-decoration: none;
}
.sidebar-brand a span { color: #fff; }

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
}
.sidebar-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.4);
    padding: 16px 20px 4px;
    font-weight: 600;
}
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 8px 20px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 400;
    transition: background 0.15s, color 0.15s;
    gap: 10px;
    white-space: nowrap;
}
.sidebar-link i { width: 18px; text-align: center; font-size: 0.82rem; flex-shrink: 0; }
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9); }
.sidebar-link.active { background: rgba(255,255,255,0.1); color: #fff; font-weight: 600; }
.sidebar-badge {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    line-height: 1;
}
.sidebar-footer {
    padding: 8px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sidebar-hide-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 10px;
    min-height: 44px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    font-weight: 400;
    border-radius: 4px;
    cursor: pointer;
}
.sidebar-hide-btn:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); }
.sidebar-hide-btn i { font-size: 0.7rem; }

.sidebar-resize {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    width: 4px;
    height: 100vh;
    cursor: col-resize;
    z-index: 1001;
    transition: left 0.2s, background 0.15s;
}
.sidebar-resize:hover,
.sidebar-resizing .sidebar-resize { background: rgba(0,86,179,0.2); }
.sidebar-resizing { cursor: col-resize; user-select: none; }
.sidebar-resizing * { pointer-events: none; }
.sidebar-resizing .sidebar-resize { pointer-events: auto; }

.sidebar-hover-zone {
    position: fixed;
    top: 0;
    left: 0;
    width: 8px;
    height: 100vh;
    z-index: 999;
    display: none;
}
.sidebar-hidden .sidebar-hover-zone { display: block; }

.sidebar-hidden .sidebar { transform: translateX(-100%); }
.sidebar-hidden .sidebar-resize { display: none; }
.sidebar-hidden .main-wrap { margin-left: 0; }

.sidebar-peek .sidebar {
    transform: translateX(0);
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}
.sidebar-peek .main-wrap { margin-left: 0; }

.sidebar-reset-btn {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
.sidebar-reset-btn:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 6px 12px;
    margin: 4px 12px;
    overflow: visible;
    clip: auto;
    white-space: normal;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* 메인 영역 */
.main-wrap {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    transition: margin-left 0.2s;
}

/* 탑바 */
.topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    height: var(--topbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
}
.topbar-brand a {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}
.topbar-brand a span { color: var(--primary); }

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--muted-text);
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 4px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text); }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.topbar-icon {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--muted-text);
    cursor: pointer;
    text-decoration: none;
}
.topbar-actions > .dropdown { display: flex; }
button.topbar-icon { background: none; border: none; padding: 0; }
.topbar-icon:hover { background: var(--bg); color: var(--text); }
.topbar-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.topbar-profile {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    background: none;
    border: none;
    min-height: 44px;
}
.topbar-profile:hover { background: var(--bg); }
.topbar-profile img { width: 28px; height: 28px; border-radius: 50%; }

.content-area {
    padding: 24px 28px;
    min-height: calc(100vh - var(--topbar-h));
    background: var(--bg);
}

.main-wrap .dash-header { margin-bottom: 0; }
.main-wrap .list-section { padding-top: 20px; min-height: unset; }

/* 반응형 */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar-open .sidebar { transform: translateX(0); }
    .main-wrap { margin-left: 0; }
    .content-area { padding: 16px 16px; }
}

@media (max-width: 767.98px) {
    form.row [class*="col-md-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .dash-header {
        padding: 16px 0;
        margin-bottom: 16px;
    }
    .dash-header h2 {
        font-size: 1.15rem;
    }
    dl.row dt[class*="col-sm-"],
    dl.row dd[class*="col-sm-"] {
        flex: 0 0 100%;
        max-width: 100%;
        padding-left: var(--bs-gutter-x, 0.75rem);
    }
    dl.row dt[class*="col-sm-"] {
        margin-bottom: 2px;
        padding-bottom: 0;
    }
    dl.row dd[class*="col-sm-"] {
        margin-bottom: 12px;
    }
    .navbar-brand {
        font-size: 1.2rem;
    }
    .nav-link {
        margin: 0;
        padding: 8px 0;
    }
    .footer {
        padding: 24px 0 12px;
    }
    .table th, .table td {
        font-size: 0.85rem;
        padding: 0.5rem 0.3rem;
    }
    .modal-dialog {
        margin: 16px;
    }
}

@media (max-width: 479.98px) {
    body {
        font-size: 14px;
    }
    .dash-header h2 {
        font-size: 1.1rem;
    }
}

/* 다크모드 사이드바 */
[data-theme="dark"] .sidebar { background: #0D1117; }
[data-theme="dark"] .sidebar-link:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .sidebar-link.active { background: rgba(255,255,255,0.08); }
