/**
 * S Keyword Admin - 공통 스타일
 * 기반: KN Store Admin common.css
 */

/* ========== 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 .s-accent {
    color: #6366F1;
}

.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(99, 102, 241, 0.25);
}

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

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

.user-info .role {
    color: #a5b4fc;
    font-size: 11px;
    background: rgba(99, 102, 241, 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(99, 102, 241, 0.15);
    border-left-color: #6366F1;
}

/* 권한별 메뉴 숨김 */
.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: 29px;
    font-weight: 700;
    color: #1a1a2e;
    text-align: right;
}

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

.stat-card.purple .value { color: #6366F1; }
.stat-card.blue .value { color: #0984e3; }
.stat-card.green .value { color: #00b894; }
.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: #e8e6ff; color: #6366F1; }
.badge.gray { background: #f0f0f0; color: #666; }

.badge.super-admin { background: #6366F1; color: #fff; }
.badge.user { 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: #6366F1;
    color: #fff;
}

.btn-primary:hover {
    background: #5558E3;
}

.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;
}

/* ========== 폼 요소 ========== */
.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: #6366F1;
}

.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; }

/* ========== 햄버거 메뉴 버튼 (기본: 숨김) ========== */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: 8px;
}

.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    margin: 3px 0;
    transition: all 0.3s;
}

/* ========== 사이드바 오버레이 (기본: 숨김) ========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* ========== 사이드바 닫기 버튼 (기본: 숨김) ========== */
.sidebar-close {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.sidebar-close:hover {
    color: #6366F1;
}

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

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }

    .top-nav {
        display: none;
    }

    .logo {
        width: auto;
        padding-left: 0;
        font-size: 18px;
    }

    .user-info .name,
    .user-info .role {
        display: none;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        width: 260px;
        min-height: 100vh;
        z-index: 200;
        padding-top: 56px;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-close {
        display: block;
        top: 66px;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

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

    .page-title {
        font-size: 20px;
    }

    .card {
        padding: 16px;
    }

    .table-responsive {
        overflow-x: auto;
    }
}
