@import url("wecar-tokens.css");

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

body {
  background: var(--wc-bg-muted);
  color: var(--wc-text-primary);
  font-family: "Pretendard", "Noto Sans KR", ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  letter-spacing: -.01em;
  margin: 0;
}

.glass-card {
  background: var(--wc-bg-elevated);
  backdrop-filter: blur(var(--wc-glass-blur));
  -webkit-backdrop-filter: blur(var(--wc-glass-blur));
  border: 1px solid var(--wc-border);
  border-radius: var(--wc-radius-lg);
  box-shadow: var(--wc-shadow-md);
}

.btn-primary, .btn.btn-primary {
  background: var(--wc-primary);
  border: none;
  border-radius: 999px;
  font-weight: 700;
  padding: .6rem 1.4rem;
  color: #fff;
}
.btn-primary:hover { background: var(--wc-primary-hover); color: #fff; }

.btn-outline-primary {
  color: var(--wc-primary);
  border: 2px solid var(--wc-primary);
  border-radius: 999px;
  font-weight: 700;
}
.btn-outline-primary:hover {
  background: var(--wc-primary);
  border-color: var(--wc-primary);
  color: #fff;
}

.btn-outline-secondary {
  border-radius: 999px;
  font-weight: 600;
}

.section-kicker {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--wc-primary);
}

.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  background: var(--wc-bg-muted);
}

.app-stage {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.side-rail {
  position: sticky;
  top: 0;
  z-index: 1030;
  flex: 0 0 var(--wc-rail-width);
  width: var(--wc-rail-width);
  height: 100vh;
  padding: .85rem .55rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  background: linear-gradient(180deg, var(--wc-bg-lavender) 0%, #E8E4F0 100%);
  border-right: 1px solid var(--wc-border);
}

[data-theme="dark"] .side-rail {
  background: linear-gradient(180deg, var(--wc-bg-lavender) 0%, #1A1724 100%);
}

.side-rail-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-bottom: .35rem;
}

.side-rail-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  width: 100%;
  flex: 1 1 auto;
}

.side-rail-footer {
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.side-rail-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  min-height: 3.35rem;
  padding: .4rem .2rem;
  border-radius: 14px;
  color: var(--wc-text-secondary);
  text-decoration: none;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: -.01em;
  transition: background .15s, color .15s;
  background: transparent;
  border: none;
  cursor: pointer;
}

.side-rail-item:hover,
.side-rail-item:focus-visible {
  background: rgba(255, 255, 255, .55);
  color: var(--wc-primary);
}

.side-rail-item.active {
  background: var(--wc-bg);
  color: var(--wc-primary);
  box-shadow: var(--wc-shadow-sm);
}

.side-rail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
}

.side-rail-label {
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 1020;
  padding: .65rem 1rem .35rem;
  background: transparent;
}

.top-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--wc-topbar-height);
  padding: .55rem 1rem .55rem 1.1rem;
  background: var(--wc-bg-elevated);
  backdrop-filter: blur(var(--wc-glass-blur));
  -webkit-backdrop-filter: blur(var(--wc-glass-blur));
  border: 1px solid var(--wc-border);
  border-radius: var(--wc-radius-pill);
  box-shadow: var(--wc-shadow-sm);
}

.top-bar-brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  color: var(--wc-navy);
  font-weight: 800;
}

.top-bar-title {
  font-size: 1.05rem;
  letter-spacing: -.02em;
}

.app-content {
  padding: .5rem 1.25rem 2rem;
  animation: shell-fade-in .35s ease both;
}

@keyframes shell-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.reset-dialog {
  border: 1px solid var(--wc-border);
  border-radius: var(--wc-radius-lg);
  padding: 0;
  width: min(480px, calc(100vw - 2rem));
  box-shadow: var(--wc-shadow-lg);
  background: var(--wc-bg);
  color: var(--wc-text-primary);
}

.reset-dialog::backdrop {
  background: rgba(26, 31, 46, .45);
  backdrop-filter: blur(2px);
}

.reset-dialog-form { display: flex; flex-direction: column; }
.reset-dialog-header,
.reset-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.25rem;
}
.reset-dialog-header { border-bottom: 1px solid var(--wc-border); }
.reset-dialog-body { padding: 1.25rem; }
.reset-dialog-footer {
  border-top: 1px solid var(--wc-border);
  justify-content: flex-end;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--wc-primary), #8E241C);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: -.02em;
  box-shadow: 0 2px 8px rgba(192, 57, 43, .28);
}

.brand-mark-lg {
  width: 3rem;
  height: 3rem;
  font-size: .85rem;
  border-radius: 14px;
}

body:not(.has-side-rail) { flex-direction: column; }

body.auth-shell .app-stage {
  background: var(--wc-auth-bg);
}

.page-title {
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--wc-navy);
  margin: 0 0 .25rem;
}

.page-subtitle {
  color: var(--wc-text-secondary);
  margin: 0 0 1.25rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-label { color: var(--wc-text-muted); font-size: .9rem; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--wc-navy); }

.login-page {
  min-height: calc(100vh - 5rem);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: min(420px, 100%);
  padding: 2rem;
}

.login-card .form-control:focus {
  border-color: var(--wc-primary);
  box-shadow: 0 0 0 .2rem rgba(192, 57, 43, .15);
}

.wc-table-wrap {
  overflow: auto;
  border-radius: var(--wc-radius-lg);
  border: 1px solid var(--wc-border);
  background: var(--wc-bg);
}

.wc-table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.wc-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--wc-bg-lavender);
  color: var(--wc-text-secondary);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--wc-border);
  white-space: nowrap;
  box-shadow: 0 1px 0 var(--wc-border);
}

.wc-table tbody td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--wc-border);
  vertical-align: middle;
}

.wc-table tbody tr:hover { background: rgba(192, 57, 43, .04); }
.wc-table tbody tr:last-child td { border-bottom: none; }

/* 데이터 페이지: 제목행 고정 + 가로/세로 스크롤바 */
.vehicles-table-card {
  overflow: hidden;
}

.vehicles-table-scroll {
  max-height: min(70vh, calc(100dvh - 22rem));
  overflow-x: scroll;
  overflow-y: scroll;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  border-radius: 0;
  border: none;
}

.vehicles-table-scroll:focus-visible {
  outline: 2px solid rgba(192, 57, 43, .35);
  outline-offset: -2px;
}

.vehicles-data-table {
  min-width: 1320px;
  width: max(100%, 1320px);
}

.vehicles-data-table tbody td {
  white-space: nowrap;
}

.vehicles-data-table .link-cell {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--wc-bg);
  box-shadow: -1px 0 0 var(--wc-border);
}

.vehicles-data-table thead th:last-child {
  position: sticky;
  right: 0;
  top: 0;
  z-index: 4;
  background: var(--wc-bg-lavender);
  box-shadow: -1px 0 0 var(--wc-border);
}

.vehicles-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--wc-bg-lavender);
}

.filter-card .form-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--wc-text-secondary);
}

.price-cell {
  font-weight: 700;
  color: var(--wc-primary);
  white-space: nowrap;
}

.pagination .page-link {
  border-radius: 999px;
  margin: 0 .15rem;
  color: var(--wc-navy);
}

.pagination .page-item.active .page-link {
  background: var(--wc-primary);
  border-color: var(--wc-primary);
}

#inapp-escape:not(.d-none) {
  position: sticky;
  top: 0;
  z-index: 1040;
  padding: .75rem 1rem;
  background: var(--wc-primary-soft);
  border-bottom: 1px solid var(--wc-border);
}

@media (max-width: 991.98px) {
  .side-rail { display: none !important; }
  .app-body { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.site-footer {
  position: static;
  background: transparent;
}

@supports not ((backdrop-filter: blur(1px))) {
  .glass-card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--wc-bg-elevated);
  }
}
