/**
 * Dog WMS Admin - 공통 스타일
 * 모든 페이지에서 동일한 레이아웃 적용
 * 기반: 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: #2d1b4e;  /* 진한 보라색 */
    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 .highlight {
    color: #ff9f43;  /* 오렌지색 강조 */
}

.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(255, 159, 67, 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: #ff9f43;
    font-size: 11px;
    background: rgba(255, 159, 67, 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: #3d2a5c;  /* 보라색 사이드바 */
    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(255, 159, 67, 0.15);
    border-left-color: #ff9f43;
}

/* 권한별 메뉴 숨김 */
.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: #2d1b4e;
    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: #2d1b4e;
    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: #2d1b4e;
    text-align: right;
}

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

.stat-card.primary .value { color: #ff9f43; }
.stat-card.green .value { color: #00b894; }
.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;
}

/* 테이블 지그재그 배경 */
.data-table tbody tr:nth-child(even) {
    background: #f5f7fa;
}

.data-table tbody tr:hover {
    background: #e8e0f0 !important;
}

/* ========== 뱃지 ========== */
.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.primary { background: #fff3e6; color: #ff9f43; }

/* 권한 뱃지 */
.badge.super-admin { background: #8e44ad; color: #fff; }
.badge.store-admin { background: #ff9f43; 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: #ff9f43;
    color: #fff;
}

.btn-primary:hover {
    background: #e68a2e;
}

.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-danger {
    background: #d63031;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.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-label.required::after {
    content: ' *';
    color: #d63031;
}

.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: #ff9f43;
}

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

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: #ff9f43;
}

.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-height: 100px;
    resize: vertical;
}

.form-textarea:focus {
    outline: none;
    border-color: #ff9f43;
}

/* ========== 이미지 업로드 ========== */
.image-upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.image-upload-area:hover {
    border-color: #ff9f43;
    background: #fff9f0;
}

.image-upload-area.dragover {
    border-color: #ff9f43;
    background: #fff3e6;
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.image-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: #d63031;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

/* ========== 모달 ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #2d1b4e;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

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

/* ========== 햄버거 메뉴 버튼 (모바일용) ========== */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 3px;
    background: #fff;
    margin: 5px 0;
    border-radius: 2px;
    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: 149;
}

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

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

@media (max-width: 768px) {
    /* 햄버거 버튼 표시 */
    .hamburger-btn {
        display: block;
    }

    /* 로고 축소 */
    .logo {
        width: auto;
        padding-left: 0;
        font-size: 18px;
    }

    /* 상단 네비게이션 숨김 */
    .top-nav {
        display: none;
    }

    /* 사용자 정보 축소 */
    .user-info .name,
    .user-info .role {
        display: none;
    }

    /* 사이드바 슬라이드 메뉴 */
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        width: 260px;
        height: 100vh;
        z-index: 150;
        padding-top: 70px;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    /* 사이드바 닫기 버튼 */
    .sidebar-close {
        position: absolute;
        top: 16px;
        right: 16px;
        background: none;
        border: none;
        color: #fff;
        font-size: 28px;
        cursor: pointer;
        padding: 4px 10px;
    }

    .sidebar-close:hover {
        color: #ff9f43;
    }

    /* 메인 컨텐츠 전체 너비 */
    .main-content {
        margin-left: 0;
        padding: 16px;
    }

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

    /* 테이블 스크롤 */
    .data-table {
        display: block;
        overflow-x: auto;
    }

    /* 페이지 타이틀 축소 */
    .page-title {
        font-size: 20px;
    }

    /* 카드 패딩 축소 */
    .card {
        padding: 16px;
    }
}
