/* ============================================================
   PROBACK - Design System & Global Styles
   ============================================================ */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css');

:root {
  /* Colors */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent-orange: #f59e0b;
  --accent-orange-dark: #d97706;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;

  /* Neutrals */
  --nav-bg: #0f172a;
  --nav-active: #1e293b;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);

  /* Radius */
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Transitions */
  --transition: all .2s ease;
}

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

html { font-size: 14px; }

body {
  font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   Login Page
   ============================================================ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp .5s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-card .logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-card .logo h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--nav-bg);
  letter-spacing: -0.5px;
}

.login-card .logo h1 span {
  color: var(--primary);
}

.login-card .logo p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-orange {
  background: var(--accent-orange);
  color: #fff;
}
.btn-orange:hover { background: var(--accent-orange-dark); }

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { background: var(--bg); border-color: var(--text-muted); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }

.login-error {
  background: #fef2f2;
  color: var(--accent-red);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  border: 1px solid #fecaca;
}

/* ============================================================
   Navigation
   ============================================================ */
.navbar {
  background: var(--nav-bg);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.navbar .logo {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-right: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar .logo .icon {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0;
  height: 100%;
}

.nav-links a {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 18px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
  position: relative;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(255,255,255,.05);
}

.nav-links a.active {
  color: #fff;
  border-bottom-color: var(--primary);
  background: var(--nav-active);
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-right .user-info {
  color: #94a3b8;
  font-size: 13px;
}

.nav-right .user-info strong {
  color: #fff;
}

.nav-right .btn-logout {
  padding: 6px 14px;
  background: rgba(255,255,255,.1);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 12px;
  transition: var(--transition);
}

.nav-right .btn-logout:hover {
  background: rgba(255,255,255,.2);
}

/* ============================================================
   Page Layout
   ============================================================ */
.page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.page-header p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

/* ============================================================
   Stats Cards
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card:nth-child(2) { border-left-color: var(--accent-green); }
.stat-card:nth-child(3) { border-left-color: var(--accent-orange); }
.stat-card:nth-child(4) { border-left-color: var(--accent-red); }

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
}

.stat-card .stat-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 2px;
}

/* ============================================================
   Search & Filters
   ============================================================ */
.search-bar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input-wrap {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.search-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.search-input-wrap input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  background: var(--bg);
}

.search-input-wrap input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 11px;
  transition: var(--transition);
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

.filter-buttons {
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  transition: var(--transition);
}

.filter-btn:hover { border-color: var(--primary); color: var(--primary); }

.filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ============================================================
   Data Table
   ============================================================ */
.table-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.table-header .count {
  font-size: 13px;
  color: var(--text-secondary);
}

.table-header .count strong {
  color: var(--primary);
}

.table-actions {
  display: flex;
  gap: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.data-table tbody tr {
  transition: var(--transition);
  border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table tbody td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

.data-table .amount {
  font-weight: 700;
  color: var(--primary);
}

.data-table .mismatch-row {
  background: #fff7ed;
}

.data-table .mismatch-row:hover {
  background: #fed7aa33;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
}

.badge-success { background: #dcfce7; color: #16a34a; }
.badge-pending { background: #dbeafe; color: #2563eb; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }

/* Empty state */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: .4;
}

.empty-state p {
  font-size: 14px;
}

/* Pagination */
.pagination {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-top: 1px solid var(--border);
}

.pagination button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeIn .2s ease;
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 20px;
  border-radius: var(--radius);
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Form row */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-info {
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  border: 1px solid var(--border);
}

.form-info.highlight {
  background: #fffbeb;
  border-color: #fcd34d;
  font-weight: 700;
  color: var(--accent-orange-dark);
}

/* ============================================================
   Cards Section (for accounts, settings pages)
   ============================================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* Settings form */
.settings-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.settings-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  background: var(--nav-bg);
  color: #fff;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight .3s ease;
  min-width: 280px;
}

.toast.success { border-left: 4px solid var(--accent-green); }
.toast.error { border-left: 4px solid var(--accent-red); }
.toast.warning { border-left: 4px solid var(--accent-orange); }

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

/* Account balance card */
.balance-display {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}

/* Sender info highlight */
.sender-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sender-info .sender-name {
  font-weight: 700;
  color: var(--text);
}

.sender-info .sender-bank {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ============================================================
   Date Picker
   ============================================================ */
.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-range input[type="date"] {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  background: var(--surface);
}

.date-range input[type="date"]:focus {
  border-color: var(--primary);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .search-bar { flex-direction: column; align-items: stretch; }
  .filter-buttons { justify-content: flex-end; }
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr; }
  .navbar { padding: 0 12px; }
  .nav-links a { padding: 0 10px; font-size: 12px; }
  .page-container { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }

  .data-table { font-size: 12px; }
  .data-table thead th, .data-table tbody td { padding: 10px 8px; }
}

/* ============================================================
   User Management Table
   ============================================================ */
.user-expire-warning {
  color: var(--accent-red);
  font-weight: 600;
}

.user-expire-ok {
  color: var(--accent-green);
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--border-light) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Inquiry section */
.inquiry-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.inquiry-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.inquiry-result {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.inquiry-result .result-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.inquiry-result .result-row:last-child {
  border-bottom: none;
}

.inquiry-result .result-label {
  color: var(--text-secondary);
  font-size: 13px;
}

.inquiry-result .result-value {
  font-weight: 600;
  font-size: 13px;
}
