/**
 * NewMyoung Admin - CMS Styles
 * 뉴명 관리자 대시보드
 */

/* AR PL UKai: 한자 전용 (19,565자, KR/JP/ZH 공용) */
@font-face {
    font-family: 'UKai';
    src: url('../fonts/UKai-CJK.woff2') format('woff2');
    font-weight: normal;
    font-display: swap;
}

/* ========================================
   Brand Colors (CMS Design Doc)
   ======================================== */
:root {
    --nm-bg: #F5F4F1;
    --nm-text: #2C2B28;
    --nm-text-sub: #8A8984;
    --nm-sidebar-bg: #2556F5;
    --nm-sidebar-selected: #1B41C4;
    --nm-sidebar-text: #B8B7B3;
    --nm-sidebar-text-active: #FFFFFF;
    --nm-accent: #2556F5;
    --nm-accent-light: #4F74F7;
    --nm-accent-dark: #1B41C4;
    --nm-card-bg: #FFFFFF;
    --nm-card-shadow: 0 1px 3px rgba(0,0,0,0.04);
    --nm-border: #E8E7E3;
    --nm-success: #4CAF50;
    --nm-warning: #FF9800;
    --nm-danger: #F44336;
    --nm-info: #2196F3;
}

/* ========================================
   Global
   ======================================== */
body {
    font-family: 'Spoqa Han Sans Neo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--nm-bg);
    color: var(--nm-text);
    margin: 0;
    padding: 0;
}

/* ========================================
   Admin Layout
   ======================================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--nm-sidebar-bg);
    color: var(--nm-sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.admin-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.admin-topbar {
    height: 60px;
    min-height: 60px;
    background: var(--nm-card-bg);
    border-bottom: 1px solid var(--nm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 50;
}

.admin-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand-icon {
    font-size: 22px;
    color: var(--nm-accent);
}

.sidebar-brand-text {
    font-size: 16px;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.3px;
}

.sidebar-section {
    padding: 16px 0 4px 0;
}

.sidebar-section-title {
    padding: 0 24px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.5px;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    color: var(--nm-sidebar-text);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-menu-item:hover {
    background: rgba(255,255,255,0.05);
    color: #FFFFFF;
}

.sidebar-menu-item.active {
    background: var(--nm-sidebar-selected);
    color: #FFFFFF;
    border-left-color: var(--nm-accent);
}

.sidebar-menu-item i {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

/* ========================================
   Topbar
   ======================================== */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--nm-text-sub);
}

.topbar-user-name {
    font-weight: 500;
    color: var(--nm-text);
}

.topbar-btn {
    padding: 6px 14px;
    border: 1px solid var(--nm-border);
    border-radius: 6px;
    background: transparent;
    color: var(--nm-text-sub);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.topbar-btn:hover {
    border-color: var(--nm-accent);
    color: var(--nm-accent);
}

/* ========================================
   Cards & Stat Cards
   ======================================== */
.card {
    background: var(--nm-card-bg);
    border-radius: 12px;
    box-shadow: var(--nm-card-shadow);
    border: 1px solid var(--nm-border);
}

/* Legacy stat-cards (kept for compatibility) */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--nm-card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--nm-card-shadow);
    border: 1px solid var(--nm-border);
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.stat-card-icon.blue { background: #E3F2FD; color: #1976D2; }
.stat-card-icon.green { background: #E8F5E9; color: #388E3C; }
.stat-card-icon.amber { background: #FFF8E1; color: #F57F17; }
.stat-card-icon.purple { background: #F3E5F5; color: #7B1FA2; }

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--nm-text);
    margin-bottom: 4px;
}

.stat-card-label {
    font-size: 13px;
    color: var(--nm-text-sub);
}

/* ========================================
   Platform Filter Tabs
   ======================================== */
.platform-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--nm-card-bg);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--nm-border);
    width: fit-content;
}

.platform-tab {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    background: transparent;
    color: var(--nm-text-sub);
}

.platform-tab.active {
    background: var(--nm-accent);
    color: #FFFFFF;
}

.platform-tab:hover:not(.active) {
    background: rgba(0,0,0,0.04);
}

/* ========================================
   Tables (ns-table override)
   ======================================== */
.admin-table-wrapper {
    background: var(--nm-card-bg);
    border-radius: 12px;
    box-shadow: var(--nm-card-shadow);
    border: 1px solid var(--nm-border);
    overflow: hidden;
}

.admin-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nm-border);
}

.admin-table-title {
    font-size: 16px;
    font-weight: 600;
}

.admin-table-actions {
    display: flex;
    gap: 8px;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--nm-accent);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--nm-accent-dark);
}

.btn-secondary {
    background: transparent;
    color: var(--nm-text);
    border: 1px solid var(--nm-border);
}

.btn-secondary:hover {
    border-color: var(--nm-accent);
    color: var(--nm-accent);
}

.btn-danger {
    background: var(--nm-danger);
    color: #FFFFFF;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* ========================================
   Status Badges
   ======================================== */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success { background: #E8F5E9; color: #2E7D32; }
.badge-warning { background: #FFF8E1; color: #F57F17; }
.badge-danger { background: #FFEBEE; color: #C62828; }
.badge-info { background: #E3F2FD; color: #1565C0; }
.badge-default { background: #F5F5F5; color: #616161; }

.badge-platform {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
}

.badge-kr { background: #FFF3E0; color: #E65100; }
.badge-jp { background: #FCE4EC; color: #AD1457; }
.badge-zh { background: #E8EAF6; color: #283593; }

/* ========================================
   Forms
   ======================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--nm-text);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--nm-border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--nm-text);
    background: var(--nm-card-bg);
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--nm-accent);
    box-shadow: 0 0 0 3px rgba(31,119,98,0.1);
}

/* ========================================
   Search Bar
   ======================================== */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-input {
    flex: 1;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--nm-border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--nm-card-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238A8984' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 12px center;
}

.search-input:focus {
    outline: none;
    border-color: var(--nm-accent);
}

/* ========================================
   Panel (side slide-in)
   ======================================== */
.admin-panel-header {
    padding: 20px;
    border-bottom: 1px solid var(--nm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-panel-title {
    font-size: 18px;
    font-weight: 700;
}

.admin-panel-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.admin-panel-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--nm-border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ========================================
   Dashboard Charts
   ======================================== */
.chart-card {
    background: var(--nm-card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--nm-card-shadow);
    border: 1px solid var(--nm-border);
    margin-bottom: 20px;
}

.chart-card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.recent-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--nm-border);
    font-size: 13px;
}

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

/* ========================================
   Login Page
   ======================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #2556F5 100%);
}

.login-card {
    width: 400px;
    background: var(--nm-card-bg);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    font-size: 40px;
    color: var(--nm-accent);
    margin-bottom: 12px;
}

.login-logo-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--nm-text);
}

.login-logo-sub {
    font-size: 13px;
    color: var(--nm-text-sub);
    margin-top: 4px;
}

.login-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--nm-border);
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.login-input:focus {
    outline: none;
    border-color: var(--nm-accent);
    box-shadow: 0 0 0 3px rgba(31,119,98,0.1);
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--nm-accent);
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 8px;
}

.login-btn:hover {
    background: var(--nm-accent-dark);
}

.login-btn:disabled {
    background: #CCC;
    cursor: not-allowed;
}

/* ========================================
   Dashboard v2
   ======================================== */
.db-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.db-kpi-card {
    background: white;
    border-radius: 16px;
    padding: 20px 24px;
    border: 1px solid #E5E7EB;
    position: relative;
    overflow: hidden;
}

.db-kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.db-kpi-dau::before { background: linear-gradient(90deg, #2556F5, #34d399); }
.db-kpi-signup::before { background: linear-gradient(90deg, #2563EB, #60a5fa); }
.db-kpi-revenue::before { background: linear-gradient(90deg, #F57F17, #fbbf24); }
.db-kpi-naming::before { background: linear-gradient(90deg, #7B1FA2, #c084fc); }

.db-kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.db-kpi-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}

.db-kpi-dau .db-kpi-icon { background: #ECFDF5; color: #2556F5; }
.db-kpi-signup .db-kpi-icon { background: #EFF6FF; color: #2563EB; }
.db-kpi-revenue .db-kpi-icon { background: #FFFBEB; color: #F57F17; }
.db-kpi-naming .db-kpi-icon { background: #FAF5FF; color: #7B1FA2; }

.db-kpi-trend {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
}

.db-kpi-trend.up { background: #ECFDF5; color: #059669; }
.db-kpi-trend.down { background: #FEF2F2; color: #DC2626; }
.db-kpi-trend.flat { background: #F3F4F6; color: #6B7280; }

.db-kpi-value {
    font-size: 32px;
    font-weight: 800;
    color: #111827;
    line-height: 1.1;
    margin-bottom: 4px;
}

.db-kpi-label {
    font-size: 13px;
    color: #6B7280;
    font-weight: 500;
}

.db-kpi-sub {
    font-size: 12px;
    color: #9CA3AF;
    margin-top: 8px;
}

.db-charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.db-chart-main, .db-chart-side {
    background: white;
    border-radius: 16px;
    padding: 20px 24px;
    border: 1px solid #E5E7EB;
}

.db-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.db-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #1F2937;
}

.db-section-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    background: #FEE2E2;
    color: #DC2626;
}

.db-legend {
    display: flex; gap: 14px;
}

.db-legend-item {
    font-size: 12px;
    color: #6B7280;
    display: flex; align-items: center; gap: 4px;
}

.db-legend-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.db-platform-stats { margin-top: 12px; }

.db-platform-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #F3F4F6;
    font-size: 13px;
}

.db-platform-row:last-child { border-bottom: none; }

.db-platform-name {
    display: flex; align-items: center; gap: 8px;
    font-weight: 600; color: #374151;
}

.db-platform-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
}

.db-platform-count {
    color: #6B7280;
    font-weight: 500;
}

.db-summary-strip {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 16px;
    padding: 16px 32px;
    border: 1px solid #E5E7EB;
    margin-bottom: 24px;
    gap: 32px;
}

.db-summary-item {
    flex: 1;
    text-align: center;
}

.db-summary-value {
    font-size: 22px;
    font-weight: 800;
    color: #1F2937;
}

.db-summary-label {
    font-size: 12px;
    color: #9CA3AF;
    font-weight: 500;
    margin-top: 2px;
}

.db-summary-divider {
    width: 1px;
    height: 36px;
    background: #E5E7EB;
}

.db-summary-alert .db-summary-value {
    color: #DC2626;
}

.db-activity-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.db-activity-card {
    background: white;
    border-radius: 16px;
    padding: 20px 24px;
    border: 1px solid #E5E7EB;
}

.db-activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #F3F4F6;
}

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

.db-activity-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.db-activity-pf {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.db-activity-pf.pf-k { background: #FFF7ED; color: #C2410C; }
.db-activity-pf.pf-j { background: #FDF2F8; color: #BE185D; }
.db-activity-pf.pf-z { background: #EEF2FF; color: #4338CA; }

.db-activity-title {
    font-size: 13px;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.db-activity-right {
    flex-shrink: 0;
    margin-left: 12px;
}

.db-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
}

.db-badge-pending { background: #FEF3C7; color: #92400E; }
.db-badge-done { background: #D1FAE5; color: #065F46; }
.db-badge-paid { background: #D1FAE5; color: #065F46; }
.db-badge-refund { background: #FEE2E2; color: #991B1B; }
.db-badge-default { background: #F3F4F6; color: #6B7280; }

.db-activity-amount {
    font-size: 13px;
    font-weight: 700;
    color: #1F2937;
}

.db-activity-empty {
    text-align: center;
    padding: 28px;
    color: #9CA3AF;
    font-size: 13px;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1200px) {
    .stat-cards, .db-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid, .db-charts-row, .db-activity-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        width: 220px;
        min-width: 220px;
    }
    .admin-main {
        margin-left: 220px;
    }
}

/* ========================================
   Sub Page Styles (NSKit v1 Page Override)
   ======================================== */
.sub-page-header {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: white;
    border-bottom: 1px solid var(--nm-border);
    gap: 12px;
}

.sub-page-content {
    height: calc(100% - 56px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sub-page-content.with-footer {
    height: calc(100% - 56px - 60px);
}
