/* ═══════════════════════════════════════════════════════
   SMS 솔루션 회원 사이트 — 공통 스타일
   ═══════════════════════════════════════════════════════ */

:root {
  --primary:      #4361ee;
  --primary-dark: #3a0ca3;
  --secondary:    #7209b7;
  --success:      #2dc653;
  --warning:      #f8961e;
  --danger:       #ef233c;
  --info:         #4cc9f0;
  --light:        #f8f9fa;
  --dark:         #212529;
  --gray-100:     #f8f9fa;
  --gray-200:     #e9ecef;
  --gray-300:     #dee2e6;
  --gray-400:     #ced4da;
  --gray-500:     #adb5bd;
  --gray-600:     #6c757d;
  --gray-700:     #495057;
  --gray-800:     #343a40;
  --gray-900:     #212529;
  --sidebar-width: 240px;
  --topbar-height: 64px;
  --radius:       8px;
  --shadow:       0 2px 8px rgba(0,0,0,.08);
  --font:         'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-100);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 레이아웃 ─────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── 사이드바 ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: #1e2235;
  color: #c8cde4;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform .3s ease;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo img { height: 32px; }

.sidebar-brand {
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand img { flex-shrink: 0; }

.sidebar-section-title {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: rgba(200,205,228,.45);
  padding: 18px 18px 5px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  color: rgba(200,205,228,.8);
  font-size: 14px;
  font-weight: 400;
  border-radius: 0;
  transition: background .15s, color .15s;
}
.sidebar-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar-item.active { background: var(--primary); color: #fff; }

.sidebar-item .si-icon {
  font-size: 17px;
  line-height: 1;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: .85;
}
.sidebar-item.active .si-icon { opacity: 1; }
.sidebar-item .si-text {
  font-size: 14px;
  line-height: 1.3;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.btn-logout {
  width: 100%;
  padding: 7px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  color: #c8cde4;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.btn-logout:hover { background: rgba(239,35,60,.15); color: #ef233c; }

/* ── 메인 영역 ────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── 상단바 ───────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* ── 상단 칩 공통 (잔액 / 알림 / 회원) ───────────────── */
.topbar-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 6px 10px 6px 6px;
  border: none;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
  transition: transform .12s;
}
.topbar-chip-btn:hover {
  transform: translateY(-1px);
}
.topbar-chip-btn[aria-expanded="true"] {
  transform: translateY(0);
}

.topbar-chip-icon {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.topbar-chip-icon .ph {
  font-size: 20px;
  color: #fff;
}

.topbar-chip-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.topbar-chip-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: .02em;
  line-height: 1.2;
}

.topbar-chip-value {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--gray-800);
}

.topbar-chip-caret {
  font-size: 12px;
  color: var(--gray-500);
  margin-left: 2px;
  transition: transform .2s;
  flex-shrink: 0;
}
.topbar-chip-btn[aria-expanded="true"] .topbar-chip-caret {
  transform: rotate(180deg);
}

/* 잔액·충전 칩 */
.wallet-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 6px;
  background: transparent;
  border: none;
  border-radius: 999px;
  transition: transform .15s;
}
.wallet-chip:hover {
  transform: translateY(-1px);
}

.wallet-chip .topbar-chip-icon,
.wallet-chip-icon {
  background: linear-gradient(145deg, var(--primary) 0%, #5b7cfa 100%);
  box-shadow: 0 2px 8px rgba(67, 97, 238, .35);
}

.wallet-chip-body {
  padding-right: 4px;
}

.wallet-chip-amount {
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(90deg, #3451d1 0%, var(--primary) 50%, #5b7cfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  min-width: 5ch;
}

/* 알림 칩 */
.notify-chip {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.notify-chip:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.notify-chip-icon {
  background: linear-gradient(145deg, #f8961e 0%, #f3722c 100%);
  box-shadow: 0 2px 8px rgba(248, 150, 30, .4);
}
.notify-chip .topbar-chip-value {
  color: #c45c00;
}
.notify-chip[aria-expanded="true"] {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.user-chip[aria-expanded="true"] {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

/* 회원 칩 */
.user-chip {
  padding-right: 12px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.user-chip:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.user-chip-icon {
  background: linear-gradient(145deg, #7209b7 0%, #9d4edd 100%);
  box-shadow: 0 2px 8px rgba(114, 9, 183, .35);
}
.user-chip-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: linear-gradient(90deg, #5a189a 0%, #7209b7 50%, #9d4edd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-charge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 18px;
  margin-left: 2px;
  background: linear-gradient(145deg, var(--primary) 0%, #3451d1 100%);
  color: #fff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  border: none;
  box-shadow: 0 2px 10px rgba(67, 97, 238, .4);
  transition: background .15s, transform .12s, box-shadow .15s;
  flex-shrink: 0;
}
.btn-charge .ph {
  font-size: 15px;
}
.btn-charge:hover {
  background: linear-gradient(145deg, #3451d1 0%, #2a3fbb 100%);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(67, 97, 238, .45);
}
.btn-charge:active {
  transform: translateY(0);
  box-shadow: 0 1px 6px rgba(67, 97, 238, .35);
}

.topbar-divider {
  width: 1px;
  height: 28px;
  background: var(--gray-300);
  flex-shrink: 0;
}

.topbar-notify,
.topbar-user {
  position: relative;
}

.notify-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(239, 35, 60, .4);
}

.topbar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  z-index: 200;
  overflow: hidden;
}

.notify-dropdown { min-width: 280px; }

.dropdown-header {
  padding: 14px 16px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-800);
  border-bottom: 1px solid var(--gray-100);
}

.notify-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--gray-500);
}
.notify-empty .ph {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: .5;
}
.notify-empty p {
  margin: 0;
  font-size: 13px;
}

.dropdown-footer-link {
  display: block;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-align: center;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-100);
}
.dropdown-footer-link:hover {
  background: var(--gray-200);
  text-decoration: none;
}

.user-dropdown a,
.user-dropdown .dropdown-logout-form button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 13.5px;
  color: var(--gray-700);
  text-decoration: none;
  transition: background .12s;
}
.user-dropdown a:hover,
.user-dropdown .dropdown-logout-form button:hover {
  background: var(--gray-100);
  text-decoration: none;
}
.user-dropdown a .ph,
.user-dropdown .dropdown-logout-form button .ph {
  font-size: 17px;
  color: var(--gray-500);
}

.dropdown-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}

.dropdown-logout-form {
  margin: 0;
  padding: 0;
}
.dropdown-logout-form button {
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--danger) !important;
  text-align: left;
}
.dropdown-logout-form button .ph {
  color: var(--danger) !important;
}

/* ── 페이지 본문 ──────────────────────────────────────── */
.main-content {
  padding: 24px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-title { font-size: 20px; font-weight: 700; margin: 0; }
.page-subtitle { font-size: 13px; color: var(--gray-600); margin: 4px 0 0; }

/* ── 카드 ─────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-100);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── 폼 ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--gray-700); }
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-800);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: var(--font);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}
.form-control:disabled { background: var(--gray-100); color: var(--gray-600); }
textarea.form-control { resize: vertical; min-height: 120px; }

.form-hint { font-size: 11.5px; color: var(--gray-500); margin-top: 4px; }
.form-error { font-size: 11.5px; color: var(--danger); margin-top: 4px; }
.form-control.is-invalid { border-color: var(--danger); }

.input-group { display: flex; gap: 8px; }
.input-group .form-control { flex: 1; }

/* ── 버튼 ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  font-family: var(--font);
  white-space: nowrap;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--gray-600); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-outline   { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-sm        { padding: 6px 12px; font-size: 12px; }
.btn-lg        { padding: 12px 24px; font-size: 15px; }
.btn-block     { width: 100%; justify-content: center; }

/* ── 알림 ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── 테이블 ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  padding: 10px 12px;
  background: var(--gray-100);
  border-bottom: 2px solid var(--gray-200);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  color: var(--gray-700);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-100); }

/* ── 배지 ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: var(--gray-200); color: var(--gray-700); }
.badge-primary { background: rgba(67,97,238,.12); color: var(--primary); }

/* ── 페이지네이션 ─────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}
.page-link {
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--gray-700);
  transition: background .12s, color .12s;
}
.page-link:hover { background: var(--gray-100); text-decoration: none; }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link.disabled { opacity: .4; pointer-events: none; }

/* ── 모달 ─────────────────────────────────────────────── */
/* ── 공통 확인 다이얼로그 헤더 ──────────────────────── */
.modal-confirm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  font-size: 15px;
  font-weight: 700;
}
.modal-confirm-header .modal-confirm-icon { font-size: 20px; }
.modal-confirm-header.danger  { background: #fff1f2; color: #be123c; border-bottom-color: #fecdd3; }
.modal-confirm-header.warning { background: #fffbeb; color: #b45309; border-bottom-color: #fde68a; }
.modal-confirm-header.info    { background: #eff6ff; color: #1d4ed8; border-bottom-color: #bfdbfe; }
.modal-confirm-header.success { background: #f0fdf4; color: #15803d; border-bottom-color: #bbf7d0; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: none;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  width: min(520px, 90vw);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--gray-500);
  line-height: 1; padding: 0;
}

/* ── 탭 ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
}
.tab-link {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s;
}
.tab-link:hover { color: var(--primary); text-decoration: none; }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── 통계 카드 ────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 26px; font-weight: 800; margin: 4px 0; line-height: 1.2; }
.stat-sub   { font-size: 12px; color: var(--gray-500); }

/* ── 검색 폼 ──────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--gray-100);
  border-radius: var(--radius);
}
.search-bar .form-control { flex: 1; min-width: 120px; }

/* ── 유틸리티 ─────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--gray-500); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-primary{ color: var(--primary); }
.fw-bold     { font-weight: 700; }
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.mt-2        { margin-top: 8px; }
.mt-3        { margin-top: 12px; }
.mt-4        { margin-top: 16px; }
.mb-0        { margin-bottom: 0; }
.mb-2        { margin-bottom: 8px; }
.mb-3        { margin-bottom: 12px; }
.ms-auto     { margin-left: auto; }
.p-0         { padding: 0; }
.w-100       { width: 100%; }

/* ── 반응형 ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-wrap { margin-left: 0; }
}
