/* ================================================================
   인 다이렉트 카보험 - 공통 CSS
   ================================================================ */

:root {
  --primary: #1565C0;
  --primary-dark: #0D47A1;
  --primary-light: #42A5F5;
  --accent: #FF6F00;
  --accent-light: #FFA726;
  --success: #2E7D32;
  --success-light: #66BB6A;
  --warning: #F57F17;
  --warning-light: #FFCA28;
  --danger: #C62828;
  --danger-light: #EF5350;
  --info: #0277BD;
  --info-light: #29B6F6;
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #EEEEEE;
  --gray-300: #E0E0E0;
  --gray-400: #BDBDBD;
  --gray-500: #9E9E9E;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.18);
  --shadow-xl: 0 16px 40px rgba(0,0,0,0.22);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --transition: all 0.25s ease;
}

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

body {
  font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; outline: none; }
input, select, textarea { outline: none; font-family: inherit; }
ul, ol { list-style: none; }

/* ── 버튼 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; transition: var(--transition);
  white-space: nowrap; cursor: pointer; border: none;
}
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-xl { padding: 18px 36px; font-size: 18px; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-accent { background: var(--accent); color: var(--white); }
.btn-accent:hover { background: #E65100; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #1B5E20; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #B71C1C; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-white { background: var(--white); color: var(--primary); }
.btn-white:hover { background: var(--gray-100); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: rgba(21,101,192,0.08); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── 카드 ── */
.card {
  background: var(--white); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
  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-50);
}

/* ── 폼 ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--gray-700); margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 3px; }
.form-control {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--gray-800);
  background: var(--white); transition: var(--transition);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21,101,192,0.12); }
.form-control::placeholder { color: var(--gray-400); }
.form-select {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm); font-size: 14px; background: var(--white);
  color: var(--gray-800); transition: var(--transition); appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23757575' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.form-select:focus { border-color: var(--primary); }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; }

/* ── 뱃지 ── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: var(--radius-full); font-size: 11px; font-weight: 700;
}
.badge-primary { background: rgba(21,101,192,0.12); color: var(--primary); }
.badge-success { background: rgba(46,125,50,0.12); color: var(--success); }
.badge-danger { background: rgba(198,40,40,0.12); color: var(--danger); }
.badge-warning { background: rgba(245,127,23,0.12); color: var(--warning); }
.badge-info { background: rgba(2,119,189,0.12); color: var(--info); }
.badge-gray { background: var(--gray-200); color: var(--gray-600); }
.badge-accent { background: rgba(255,111,0,0.12); color: var(--accent); }

/* ── 알림 ── */
.alert {
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: 14px; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: rgba(46,125,50,0.1); border-left: 4px solid var(--success); color: var(--success); }
.alert-danger { background: rgba(198,40,40,0.1); border-left: 4px solid var(--danger); color: var(--danger); }
.alert-warning { background: rgba(245,127,23,0.1); border-left: 4px solid var(--warning); color: var(--warning); }
.alert-info { background: rgba(2,119,189,0.1); border-left: 4px solid var(--info); color: var(--info); }

/* ── 테이블 ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  background: var(--gray-100); padding: 12px 16px; text-align: left;
  font-weight: 700; font-size: 12px; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-200);
}
.table td {
  padding: 13px 16px; border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.table tr:hover td { background: rgba(21,101,192,0.03); }
.table tr:last-child td { border-bottom: none; }

/* ── 모달 ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px; backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto; animation: modalIn 0.2s ease;
}
.modal-box.modal-lg { max-width: 760px; }
.modal-box.modal-xl { max-width: 980px; }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: 10px;
}
.modal-close {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--gray-100); color: var(--gray-600); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-800); }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.93) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── 토스트 ── */
#toast-container {
  position: fixed; bottom: 28px; right: 28px;
  display: flex; flex-direction: column; gap: 10px; z-index: 9999;
}
.toast {
  background: var(--gray-900); color: var(--white);
  padding: 14px 20px; border-radius: var(--radius-md);
  font-size: 14px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.3s ease; min-width: 260px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── 로딩 스피너 ── */
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--gray-200);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 공통 유틸 ── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--gray-500); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-4 { padding: 16px; }
.w-full { width: 100%; }

/* ── 반응형 ── */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .modal-box { margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; align-self: flex-end; max-height: 95vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}
@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}
