/* ========== CSS 변수 (Color Palette & Typography) ========== */
:root {
  /* 주색상 */
  --primary-color: #004137;
  --primary-light: #005a4d;

  /* 배경색 */
  --bg-primary: #fafafa;
  --bg-white: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.7);

  /* 텍스트 색상 */
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-white: #ffffff;

  /* 상태 색상 */
  --success: #10b981;
  --error: #dc3545;
  --warning: #f59e0b;

  /* 테두리 */
  --border-light: #e5e7eb;
  --border-dashed: #a1a1a1;

  /* 폰트 크기 */
  --font-xs: 10px;
  --font-sm: 12px;
  --font-md: 14px;
  --font-lg: 16px;
  --font-xl: 20px;
  --font-2xl: 28px;
}

/* ========== 전역 리셋 및 기본 스타일 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "돋움",
    "dotum", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--font-sm);
  line-height: 1.6;
}

/* ========== 레이아웃 ========== */
.container {
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 10px;
}

.content {
  min-height: calc(100vh - 60px);
}

.maincontent {
  margin-left: 200px;
  transition: margin-left 0.3s;
}

/* ========== 타이포그래피 ========== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: var(--font-2xl);
}
h2 {
  font-size: var(--font-xl);
}
h3 {
  font-size: var(--font-lg);
}
h4 {
  font-size: var(--font-md);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-light);
}

/* ========== 페이지 제목 ========== */
.contentTitle {
  font-size: var(--font-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.contentTitle .material-symbols-outlined {
  font-size: 28px;
}

/* ========== 버튼 스타일 ========== */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--text-white);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: var(--font-sm);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover {
  background-color: var(--primary-light);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--bg-white);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: var(--font-sm);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover {
  background-color: var(--bg-primary);
  border-color: var(--primary-color);
}

.btn-success {
  background-color: var(--success);
  color: var(--text-white);
}

.btn-error {
  background-color: var(--error);
  color: var(--text-white);
}

.btn-warning {
  background-color: var(--warning);
  color: var(--text-white);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== 카드 스타일 ========== */
.card {
  background-color: var(--bg-white);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.card-header {
  font-size: var(--font-lg);
  font-weight: 600;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-light);
}

/* ========== 통계 카드 ========== */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.cs-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background-color: var(--bg-white);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 15px;
  transition: all 0.2s;
}

.stat-card.clickable {
  cursor: pointer;
}

.stat-card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon .material-symbols-outlined {
  color: var(--text-white);
  font-size: 28px;
}

.stat-content {
  flex: 1;
}

.stat-title {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.stat-value {
  font-size: var(--font-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.stat-subtitle {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* ========== 폼 요소 ========== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: var(--font-sm);
  font-family: inherit;
  transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

label {
  display: block;
  font-weight: 500;
  font-size: var(--font-sm);
}

.form-group {
  margin-bottom: 15px;
}

/* ========== DataTables 커스텀 스타일 ========== */
.dataTable {
  width: 100% !important;
  border-collapse: collapse;
  margin: 0;
  table-layout: fixed;
  font-size: var(--font-sm);
}

.dataTable th {
  background-color: var(--primary-color);
  color: var(--text-white);
  font-weight: 600;
  font-size: var(--font-sm);
  padding: 1px 5px;
  height: 24px;
  border-right: 1px solid var(--text-white);
  border-bottom: none;
  text-align: left;
}

.dataTable td {
  border: none;
  padding: 1px 5px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--font-sm);
  border-right: 1px dashed var(--border-dashed);
}

.dataTable th:last-child,
.dataTable td:last-child {
  border-right: none;
}

.dataTable tbody tr:hover {
  background-color: var(--bg-primary);
}

.dataTable tbody tr:nth-child(even) {
  background-color: #f9fafb;
}

/* DataTables 페이지네이션 */
.dataTables_wrapper .dataTables_paginate {
  padding-top: 15px;
}

.dataTables_wrapper .dataTables_info {
  padding-top: 15px;
  font-size: var(--font-sm);
}

/* ========== 제로 재고 강조 ========== */
.zero-stock {
  color: var(--error);
  font-weight: 600;
}

/* ========== 토스트 알림 ========== */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background-color: var(--success);
  color: var(--text-white);
  padding: 12px 20px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 10000;
  font-size: var(--font-md);
  animation: slideIn 0.3s ease-out;
}

.toast.show {
  display: flex;
}

.toast.error {
  background-color: var(--error);
}

.toast .material-symbols-outlined {
  font-size: 24px;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========== 텍스트 truncate ========== */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== 유틸리티 클래스 ========== */
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-right {
  text-align: right;
}

.mt-10 {
  margin-top: 10px;
}
.mt-20 {
  margin-top: 20px;
}
.mb-10 {
  margin-bottom: 10px;
}
.mb-20 {
  margin-bottom: 20px;
}

.flex {
  display: flex;
}
.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.flex-gap-10 {
  gap: 10px;
}

.hidden {
  display: none !important;
}

/* ========== 반응형 ========== */
@media (max-width: 1024px) {
  .maincontent {
    margin-left: 0;
    padding-top: 60px; /* 모바일 헤더 높이 + 여백 */
  }

  .dashboard-stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

.data-table-container {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* 테이블 레이아웃 고정 */
}

table thead th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table tbody td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amount-cell {
  text-align: right;
}

.customerList .contentTitle {
  font-size: 13px;
  font-weight: 700;
  padding: 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  background-color: #004137;
  color: #fff;
  margin: 10px;
  border-radius: 5px;
}

/* ========== 모바일 헤더 (공용 스타일) ========== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 60px;
  background-color: #fff;
  border-bottom: 1px solid #e0e0e0;
  z-index: 1000;
  padding: 0 15px;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: #333;
  flex-shrink: 0;
  z-index: 1001;
  position: relative;
}

.mobile-menu-btn .material-symbols-outlined {
  font-size: 24px;
}

.mobile-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}

/* 사이드바가 숨겨지는 시점(1024px 이하)에 헤더 표시 */
@media (max-width: 1024px) {
  .mobile-header {
    display: flex;
  }

  /* 모바일 헤더 내부의 메뉴 버튼 표시 */
  .mobile-header .mobile-menu-btn {
    display: flex;
  }
}
