/**
 * KN Store Admin - 공통 스타일
 * 모든 페이지에서 동일한 레이아웃 적용
 */

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard', 'Noto Sans KR', '맑은 고딕', 'Malgun Gothic', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f5f6fa;
    min-height: 100vh;
}

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

/* ========== 상단 헤더 (고정) ========== */
.top-header {
    background: #1a1a2e;
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.logo {
    width: 240px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    padding-left: 20px;
    cursor: pointer;
    transition: opacity 0.2s;
    letter-spacing: -0.02em;
}

.logo:hover {
    opacity: 0.8;
}

.logo .n-green {
    color: #03C75A;
}

.top-nav {
    display: flex;
    gap: 8px;
}

.top-nav a {
    color: #a0a0a0;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.top-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.top-nav a.active {
    color: #fff;
    background: rgba(0, 212, 170, 0.2);
}

.user-info {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info .name {
    color: #fff;
    font-size: 14px;
}

.user-info .role {
    color: #00d4aa;
    font-size: 11px;
    background: rgba(0, 212, 170, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
}

.user-info .logout-btn {
    color: #a0a0a0;
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border: 1px solid #444;
    border-radius: 4px;
    transition: all 0.2s;
    cursor: pointer;
    background: transparent;
}

.user-info .logout-btn:hover {
    color: #fff;
    border-color: #666;
}

/* ========== 레이아웃 ========== */
.layout {
    display: flex;
    padding-top: 56px;
}

/* ========== 좌측 사이드바 (고정) ========== */
.sidebar {
    width: 240px;
    background: #2d2d44;
    min-height: calc(100vh - 56px);
    position: fixed;
    left: 0;
    top: 56px;
    padding: 20px 0;
}

.menu-section {
    margin-bottom: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-section:last-child {
    border-bottom: none;
}

.menu-title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px 8px;
}

.menu-item {
    display: block;
    color: #b0b0b0;
    text-decoration: none;
    padding: 10px 20px 10px 36px;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

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

.menu-item.active {
    color: #fff;
    background: rgba(0, 212, 170, 0.15);
    border-left-color: #00d4aa;
}

/* 권한별 메뉴 숨김 */
.menu-item.admin-only,
.menu-section.admin-only,
.top-nav a.admin-only {
    display: none;
}

body.is-super-admin .menu-item.admin-only {
    display: block;
}

body.is-super-admin .menu-section.admin-only {
    display: block;
}

body.is-super-admin .top-nav a.admin-only {
    display: inline-block;
}

/* ========== 메인 컨텐츠 ========== */
.main-content {
    margin-left: 240px;
    padding: 24px;
    flex: 1;
    min-height: calc(100vh - 56px);
}

.page-title {
    font-size: 24px;
    color: #1a1a2e;
    margin-bottom: 24px;
    font-weight: 600;
}

/* ========== 카드 ========== */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    color: #1a1a2e;
    font-weight: 600;
}

/* ========== 통계 카드 그리드 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stat-card .label {
    color: #888;
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a2e;
}

.stat-card .unit {
    font-size: 16px;
    color: #888;
    margin-left: 4px;
}

.stat-card.green .value { color: #00d4aa; }
.stat-card.blue .value { color: #0984e3; }
.stat-card.orange .value { color: #fdcb6e; }
.stat-card.red .value { color: #d63031; }

/* ========== 데이터 테이블 ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8f9fa;
    color: #666;
    font-size: 13px;
    font-weight: 600;
}

.data-table td {
    color: #333;
    font-size: 14px;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* ========== 뱃지 ========== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge.success { background: #e6fff7; color: #00b894; }
.badge.warning { background: #fff8e6; color: #f39c12; }
.badge.danger { background: #ffe6e6; color: #d63031; }
.badge.info { background: #e6f2ff; color: #0984e3; }
.badge.gray { background: #f0f0f0; color: #666; }

/* 권한 뱃지 */
.badge.super-admin { background: #ff6b6b; color: #fff; }
.badge.store-admin { background: #4ecdc4; color: #fff; }
.badge.active { background: #d4edda; color: #155724; }
.badge.inactive { background: #f8d7da; color: #721c24; }

/* ========== 버튼 ========== */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: #00d4aa;
    color: #fff;
}

.btn-primary:hover {
    background: #00b894;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-outline {
    background: transparent;
    border: 1px solid #ddd;
    color: #666;
}

.btn-outline:hover {
    background: #f8f9fa;
    border-color: #ccc;
}

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

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

/* ========== 스토어 태그 ========== */
.store-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.store-tag {
    display: inline-block;
    padding: 3px 8px;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 12px;
    color: #495057;
}

.store-tag.all {
    background: #fff3cd;
    color: #856404;
}

/* ========== 폼 요소 ========== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #00d4aa;
}

.form-input-sm {
    width: auto;
    padding: 6px 10px;
}

/* ========== 유틸리티 ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: #00b894; }
.text-danger { color: #d63031; }
.text-muted { color: #888; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

/* ========== 반응형 ========== */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}