/* ============================================================
 * MOMO 관리자 페이지 스타일 (Triangle 스타일 베이스)
 * ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

.admin-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Pretendard', 'Noto Sans KR', Roboto, Arial, sans-serif;
    background-color: #f5f7fb;
    color: #1f2a44;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* ============================================================
 * 상단 다크 네비게이션 바
 * ============================================================ */
.adm-topbar {
    background: #1f2a44;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.adm-topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.adm-brand {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: #fff;
}

.adm-brand::before {
    content: '◆';
    color: #4f8eff;
    margin-right: 8px;
    font-size: 14px;
}

.adm-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    height: 100%;
}

.adm-nav-item {
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
    font-weight: 500;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
}

.adm-nav-item:hover {
    color: #fff;
}

.adm-nav-item.active {
    color: #fff;
    border-bottom-color: #4f8eff;
    font-weight: 600;
}

.adm-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.adm-user-menu {
    position: relative;
    cursor: pointer;
    outline: none;
}

.adm-user {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    transition: background .15s, color .15s;
    display: inline-flex;
    align-items: center;
    user-select: none;
}

.adm-user::before {
    content: '👤';
    margin-right: 6px;
    font-size: 12px;
}

.adm-user::after {
    content: '▾';
    margin-left: 6px;
    font-size: 10px;
    opacity: 0.7;
}

.adm-user-menu:hover .adm-user,
.adm-user-menu:focus-within .adm-user {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* 드롭다운 */
.adm-user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid #e5e8ee;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity .15s, transform .15s, visibility .15s;
    z-index: 1000;
}

.adm-user-menu:hover .adm-user-dropdown,
.adm-user-menu:focus-within .adm-user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.adm-user-dropdown::before {
    /* 메뉴와 사용자 영역 사이 빈 공간을 메워 hover 끊김 방지 */
    content: '';
    position: absolute;
    top: -6px; right: 0; left: 0;
    height: 6px;
}

.adm-user-dropdown a {
    display: block;
    padding: 9px 14px;
    font-size: 13px;
    color: #1f2a44;
    text-decoration: none;
    border-radius: 4px;
    white-space: nowrap;
    transition: background .15s;
}

.adm-user-dropdown a:hover {
    background: #f5f7fb;
    color: #1f2a44;
}

.adm-logout {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    padding: 4px 10px;
    border-radius: 4px;
}

.adm-logout:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

/* ============================================================
 * 페이지 헤더 (제목 영역)
 * ============================================================ */
.adm-pagehead {
    background: #fff;
    border-bottom: 1px solid #e5e8ee;
}

.adm-pagehead-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.adm-pagehead-title {
    font-size: 22px;
    font-weight: 700;
    color: #1f2a44;
    letter-spacing: -0.3px;
}

.adm-pagehead-sub {
    font-size: 13px;
    color: #7a8499;
    margin-top: 4px;
}

/* ============================================================
 * 컨테이너
 * ============================================================ */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ============================================================
 * 카드/섹션
 * ============================================================ */
.admin-section,
.adm-card {
    background: #fff;
    border: 1px solid #e5e8ee;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 16px;
}

.admin-section-header,
.adm-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eef0f4;
}

.admin-section-title,
.adm-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2a44;
}

.admin-section-link {
    color: #4f8eff;
    font-size: 13px;
    font-weight: 500;
}

.admin-section-link:hover { text-decoration: underline; }

/* ============================================================
 * 통계 카드
 * ============================================================ */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.admin-stat-card {
    background: #fff;
    border: 1px solid #e5e8ee;
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color .15s, box-shadow .15s;
}

.admin-stat-card:hover {
    border-color: #4f8eff;
    box-shadow: 0 2px 8px rgba(79, 142, 255, 0.08);
}

.admin-stat-label {
    font-size: 12px;
    color: #7a8499;
    font-weight: 500;
}

.admin-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1f2a44;
    letter-spacing: -0.3px;
}

.admin-stat-icon { display: none; }

/* ============================================================
 * 버튼
 * ============================================================ */
.adm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid #d4d8e0;
    background: #fff;
    color: #1f2a44;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}

.adm-btn:hover {
    background: #f5f7fb;
    border-color: #b8bdc8;
}

.adm-btn-primary {
    background: #4f8eff;
    border-color: #4f8eff;
    color: #fff;
}

.adm-btn-primary:hover {
    background: #3d7aee;
    border-color: #3d7aee;
}

.adm-btn-danger {
    background: #fff;
    border-color: #e5645b;
    color: #e5645b;
}

.adm-btn-danger:hover {
    background: #fff5f4;
}

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

/* legacy-호환 모달 버튼 */
.admin-modal-btn {
    padding: 8px 16px;
    border: 1px solid #d4d8e0;
    background: #fff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
}

.admin-modal-btn-primary {
    background: #4f8eff;
    color: #fff;
    border-color: #4f8eff;
}

.admin-modal-btn-primary:hover {
    background: #3d7aee;
}

.admin-modal-btn-secondary {
    background: #fff;
    color: #1f2a44;
}

.admin-modal-btn-secondary:hover {
    background: #f5f7fb;
}

/* ============================================================
 * 폼
 * ============================================================ */
.admin-form-group,
.adm-form-group {
    margin-bottom: 16px;
}

.admin-form-label,
.adm-form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #1f2a44;
}

.admin-form-section {
    font-size: 14px;
    font-weight: 700;
    color: #1f2a44;
    margin: 20px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e8ee;
}

.admin-form-hint,
.adm-form-hint {
    font-size: 12px;
    color: #7a8499;
    margin: 4px 0 0;
}

.admin-form-input,
.adm-form-input,
.adm-form-select,
.adm-form-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d4d8e0;
    border-radius: 6px;
    font-size: 14px;
    color: #1f2a44;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}

.admin-form-input:focus,
.adm-form-input:focus,
.adm-form-select:focus,
.adm-form-textarea:focus {
    outline: none;
    border-color: #4f8eff;
    box-shadow: 0 0 0 3px rgba(79, 142, 255, 0.12);
}

.adm-form-textarea {
    min-height: 240px;
    resize: vertical;
    line-height: 1.6;
}

/* 체크박스 라인 */
.adm-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #1f2a44;
    cursor: pointer;
    user-select: none;
}

.adm-check-row input[type="checkbox"],
.adm-check-row input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #4f8eff;
}

/* 라디오 그룹 */
.adm-radio-group {
    display: flex;
    gap: 16px;
}

/* 썸네일 미리보기 */
.adm-thumb-preview {
    width: 160px;
    height: 160px;
    border: 1px dashed #d4d8e0;
    border-radius: 6px;
    background: #f5f7fb center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b8bdc8;
    font-size: 12px;
    margin-top: 8px;
    overflow: hidden;
}

.adm-thumb-preview.has-image { border-style: solid; }

/* ============================================================
 * 필터
 * ============================================================ */
.admin-filter-section,
.adm-filter {
    background: #fff;
    border: 1px solid #e5e8ee;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.admin-filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-filter-label {
    font-weight: 600;
    color: #1f2a44;
    font-size: 13px;
}

.admin-filter-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.admin-filter-btn {
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    color: #555f74;
    background: #f5f7fb;
    border: 1px solid #e5e8ee;
    transition: all .15s;
    cursor: pointer;
}

.admin-filter-btn:hover {
    background: #e9edf5;
    color: #1f2a44;
}

.admin-filter-btn.active {
    background: #4f8eff;
    color: #fff;
    border-color: #4f8eff;
}

/* ============================================================
 * 테이블
 * ============================================================ */
.admin-table-container { overflow-x: auto; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table thead {
    background-color: #f5f7fb;
}

.admin-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #555f74;
    border-bottom: 1px solid #e5e8ee;
    white-space: nowrap;
    font-size: 12px;
}

.admin-table td {
    padding: 12px;
    border-bottom: 1px solid #eef0f4;
    color: #1f2a44;
}

.admin-table tbody tr:hover {
    background-color: #f8fafd;
}

.admin-table-empty {
    text-align: center;
    padding: 60px 20px !important;
    color: #b8bdc8;
}

/* ============================================================
 * 상태 배지
 * ============================================================ */
.admin-status-badge,
.adm-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.adm-badge-on {
    background: #e7f5ed;
    color: #1d7a4a;
    border-color: #c5e8d3;
}

.adm-badge-off {
    background: #f5f7fb;
    color: #7a8499;
    border-color: #e5e8ee;
}

/* 주문 상태 코드 (legacy 호환용 — 노출 안되도록 hidden 처리는 메뉴에서) */
.status-100 { background: #fff8e1; color: #8a6d00; }
.status-200 { background: #e8f0fe; color: #1655c0; }
.status-300 { background: #e0f3f5; color: #06616e; }
.status-400 { background: #e8f0fe; color: #1655c0; }
.status-500 { background: #e7f5ed; color: #1d7a4a; }
.status-600 { background: #ffefef; color: #8a6d00; }
.status-700 { background: #fde8ea; color: #a32132; }
.status-800 { background: #fff0e0; color: #99510a; }
.status-900 { background: #fde8ea; color: #a32132; }
.status-1000 { background: #efe8fa; color: #5a4d7a; }
.status-1100 { background: #e7f5ed; color: #1d7a4a; }

/* ============================================================
 * 모달
 * ============================================================ */
.admin-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10000;
}

.admin-modal.active,
.admin-modal[style*="display: block"],
.admin-modal[style*="display:flex"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.admin-modal-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(31, 42, 68, 0.55);
}

.admin-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(31, 42, 68, 0.2);
    z-index: 10001;
    margin: auto;
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e8ee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}

.admin-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f2a44;
}

.admin-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #7a8499;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all .15s;
}

.admin-modal-close:hover {
    background: #f5f7fb;
    color: #1f2a44;
}

.admin-modal-body { padding: 24px; }

.admin-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #e5e8ee;
    margin-top: 20px;
}

/* 주문 상세(legacy 잔여물) */
.admin-order-detail-section { margin-bottom: 20px; }
.admin-order-detail-title {
    font-size: 15px;
    font-weight: 700;
    color: #1f2a44;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e8ee;
}
.admin-order-detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.admin-order-detail-item { display: flex; flex-direction: column; gap: 4px; }
.admin-order-detail-label { font-size: 12px; color: #7a8499; font-weight: 600; }
.admin-order-detail-value { font-size: 14px; color: #1f2a44; font-weight: 500; }

/* ============================================================
 * 로그인 화면
 * ============================================================ */
.admin-login-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Pretendard', 'Noto Sans KR', Roboto, Arial, sans-serif;
    background: #1f2a44;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.admin-login-container {
    width: 100%;
    max-width: 380px;
}

.admin-login-box {
    background: #fff;
    border-radius: 10px;
    padding: 40px 36px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.admin-login-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 28px;
    color: #1f2a44;
}

.admin-error-message {
    background-color: #fde8ea;
    color: #a32132;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    text-align: center;
}

.admin-login-btn {
    width: 100%;
    padding: 12px;
    background: #4f8eff;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.admin-login-btn:hover { background: #3d7aee; }

/* ============================================================
 * 페이지네이션
 * ============================================================ */
.adm-pager {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
}

.adm-pager a, .adm-pager span {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e8ee;
    border-radius: 4px;
    font-size: 13px;
    color: #555f74;
    background: #fff;
}

.adm-pager a:hover { background: #f5f7fb; }
.adm-pager .current {
    background: #4f8eff;
    color: #fff;
    border-color: #4f8eff;
    font-weight: 600;
}

/* ============================================================
 * 반응형
 * ============================================================ */
@media (max-width: 900px) {
    .adm-topbar-inner {
        height: auto;
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 12px;
    }
    .adm-nav { order: 3; width: 100%; overflow-x: auto; }
    .adm-pagehead-inner,
    .admin-container { padding: 16px; }
    .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-modal-content { width: 95%; }
    .admin-order-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .admin-stats-grid { grid-template-columns: 1fr; }
}
