/**
 * 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;
    display: flex;
    flex-direction: column;
}

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: 16px;
    cursor: pointer;
    transition: opacity 0.2s;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 9px;
}
.logo-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    flex-shrink: 0;
}

.logo:hover {
    opacity: 0.8;
}

.logo .s-accent {
    color: #fff;
}

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

/* ========== 계정 드롭다운 (user-menu) ========== */
.user-menu {
    position: relative;
    margin-left: 12px;
    flex-shrink: 0;
}

.user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.15s;
}
.user-trigger:hover { background: rgba(255,255,255,0.1); }

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #6366F1;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.user-trigger-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}
.user-trigger-name {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}
.user-trigger-email {
    color: #c0c0c0;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
}

.trigger-chevron {
    width: 16px;
    height: 16px;
    color: #a0a0a0;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.user-menu.open .trigger-chevron { transform: rotate(180deg); }

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    width: 260px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border: 1px solid #e8e8f0;
    z-index: 200;
    overflow: hidden;
    animation: ddFadeIn 0.15s ease;
}
.user-menu.open .user-dropdown { display: block; }

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

.dd-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 12px;
}
.dd-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #6366F1;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}
.dd-info { flex: 1; min-width: 0; }
.dd-name {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dd-email {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.dd-plan {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    background: #f0f0ff;
    color: #6366F1;
}
.dd-plan.super { background: #fef3c7; color: #92400e; }

.dd-divider { height: 1px; background: #f0f0f0; margin: 4px 0; }

.dd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    box-sizing: border-box;
}
.dd-item:hover { background: #f8f9ff; color: #6366F1; }

.dd-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

.dd-disabled { color: #aaa; cursor: default; }
.dd-disabled:hover { background: transparent; color: #aaa; }

.dd-soon {
    margin-left: auto;
    font-size: 10px;
    background: #f0f0f0;
    color: #888;
    padding: 2px 6px;
    border-radius: 4px;
}
.dd-warn {
    margin-left: auto;
    font-size: 10px;
    background: #fdecea;
    color: #e74c3c;
    padding: 2px 6px;
    border-radius: 4px;
}
.dd-logout { color: #e74c3c; }
.dd-logout:hover { background: #fdecea; color: #e74c3c; }

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

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

.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 {
    display: none;
}

/* 제휴·문의 버튼 */
.contact-btn {
    margin-left: auto;
    color: #a5b4fc;
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid rgba(165, 180, 252, 0.4);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}
.contact-btn:hover {
    color: #fff;
    border-color: #a5b4fc;
    background: rgba(99, 102, 241, 0.2);
}

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

    .site-footer {
        padding-left: 0;
    }

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

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

    .card {
        padding: 16px;
    }

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

/* ========== 사이트 풋터 ========== */
.site-footer {
    background: #1a1a2e;
    color: rgba(255,255,255,0.65);
    font-size: 13px;
    width: 100%;
    flex-shrink: 0;
    padding-left: 240px; /* 사이드바 너비만큼 컨텐츠 밀기 */
}
/* 사이드바 없는 페이지(비로그인·약관·개인정보) */
body.no-sidebar .site-footer,
body.public-mode .site-footer {
    padding-left: 0;
}
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 32px 0;
}
.footer-top {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 36px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.footer-brand-name {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}
.footer-brand-name span { color: #fff; }
.footer-brand-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    line-height: 1.75;
    max-width: 260px;
}
.footer-col-title {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 14px;
}
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-links li { margin-bottom: 10px; }
.footer-links a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.15s;
}
.footer-links a:hover { color: #818cf8; }
.footer-bottom {
    padding: 22px 0 24px;
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    line-height: 1.8;
}
.footer-sep { margin: 0 8px; color: rgba(255,255,255,0.18); }
.footer-copy { margin-top: 6px; }
.footer-policy-links {
    margin-top: 8px;
    display: flex;
    gap: 16px;
}
.footer-policy-links a {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.15s;
}
.footer-policy-links a:hover { color: #818cf8; }
.footer-policy-links a.bold { font-weight: 700; color: rgba(255,255,255,0.7); }
.footer-policy-links a.bold:hover { color: #a5b4fc; }

/* 약관·개인정보 페이지 공통 */
.policy-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 32px;
    flex: 1 0 auto;
}
.policy-wrap h1 {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 8px;
}
.policy-date {
    font-size: 13px;
    color: #888;
    margin-bottom: 40px;
}
.policy-section {
    margin-bottom: 36px;
}
.policy-section h2 {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}
.policy-section p, .policy-section li {
    font-size: 14px;
    color: #444;
    line-height: 1.85;
}
.policy-section ul, .policy-section ol {
    padding-left: 20px;
    margin-top: 8px;
}
.policy-section li { margin-bottom: 6px; }
.policy-highlight {
    background: #f5f6ff;
    border-left: 3px solid #6366F1;
    padding: 14px 18px;
    border-radius: 0 8px 8px 0;
    margin: 12px 0;
    font-size: 14px;
    color: #333;
    line-height: 1.75;
}
.policy-nav {
    background: #1a1a2e;
    padding: 0 32px;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 16px;
}
.policy-nav a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}
.policy-nav a:hover { color: #fff; }
.policy-nav .nav-brand {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    margin-right: auto;
}
.policy-nav .nav-brand span { color: #fff; }

@media (max-width: 768px) {
    .footer-top {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    .footer-inner { padding: 36px 20px 0; }
    .policy-wrap { padding: 40px 20px; }
    .policy-nav { padding: 0 20px; }
}
