@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@500;700&family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

:root {
  --bg-main: #0a0e17;
  --bg-panel: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(31, 41, 55, 0.9);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: #38bdf8;
  
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-purple: #8b5cf6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --font-sans: 'Plus Jakarta Sans', 'Noto Sans KR', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.08) 0%, transparent 40%);
}

/* Header */
.top-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 11px;
  color: var(--text-secondary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.badge-official {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--accent-emerald);
  color: #34d399;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-full);
}

.btn-pricing {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
  transition: all 0.2s ease;
}

/* Layout */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 24px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 960px) {
  .app-container {
    grid-template-columns: 1fr;
  }
}

/* Left Panel: Search & Classifier */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.panel-title-row h2 {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: keep-all;
}

.search-box-large {
  position: relative;
  width: 100%;
}

.input-search {
  width: 100%;
  padding: 16px 20px 16px 46px;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.input-search:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.2);
}

.search-lens-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Quick Pills */
.quick-pills-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
  width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.quick-pills-row::-webkit-scrollbar {
  display: none;
}

.pill-item {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-item:hover {
  border-color: var(--accent-cyan);
  color: #38bdf8;
}

/* Search Results Cards */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 440px;
  overflow-y: auto;
  width: 100%;
  min-width: 0;
}

.hs-item-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.hs-item-card:hover, .hs-item-card.selected {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.25);
}

.hs-header-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.hs-code-tag {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.5px;
}

.hs-chapter-tag {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-panel);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.hs-title-ko {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  word-break: keep-all;
  overflow-wrap: break-word;
}

.hs-title-en {
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Right Panel: Customs & Duty Breakdown */
.duty-calculator-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  width: 100%;
}

.inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  word-break: keep-all;
}

.form-input, .form-select {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: white;
  font-size: 13px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-blue);
}

/* Breakdown Display */
.tax-summary-box {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.tax-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  flex-wrap: wrap;
  gap: 6px;
}

.tax-row.highlight {
  border-top: 1px dashed var(--border-color);
  padding-top: 10px;
  font-size: 15px;
  font-weight: 800;
  color: #38bdf8;
}

.fta-savings-banner {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--accent-emerald);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #6ee7b7;
  font-weight: 700;
  word-break: keep-all;
  overflow-wrap: break-word;
  box-sizing: border-box;
}

/* Document Checklist */
.docs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.doc-item {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  word-break: keep-all;
}

/* Subscription Pricing Modal */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 768px) {
  .pricing-grid { grid-template-columns: 1fr; }
}

.plan-card {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  box-sizing: border-box;
}

.plan-card.featured {
  border-color: #8b5cf6;
  box-shadow: 0 0 25px rgba(139, 92, 246, 0.25);
}

.plan-name { font-size: 16px; font-weight: 800; }
.plan-price { font-size: 24px; font-weight: 800; color: #38bdf8; }
.plan-price span { font-size: 12px; color: var(--text-muted); }

/* Modal Overlay & Centered Card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.modal-card {
  width: 100%;
  max-width: 880px;
  max-height: 90vh;
  overflow-y: auto;
  background: #0d1527;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(139, 92, 246, 0.2);
  animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: auto;
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  position: sticky;
  top: 0;
  background: #0d1527;
  z-index: 10;
  padding-bottom: 8px;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: white;
}

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

.btn-close-modal {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  font-size: 18px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-close-modal:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: #ef4444;
}

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

.active-hs-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-hs-tag {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.active-hs-name {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile Responsive Optimization */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }
  
  .top-navbar {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .brand-logo {
    gap: 10px;
  }

  .logo-badge {
    width: 32px;
    height: 32px;
    font-size: 16px;
    flex-shrink: 0;
  }

  .brand-text h1 {
    font-size: 16px;
    line-height: 1.2;
  }
  
  .brand-text p {
    font-size: 10px;
    line-height: 1.3;
  }

  .nav-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .badge-official {
    font-size: 10px;
    padding: 5px 9px;
    white-space: nowrap;
    text-align: center;
    flex: 1 1 auto;
  }

  .btn-pricing {
    font-size: 11px;
    padding: 6px 12px;
    white-space: nowrap;
    text-align: center;
    flex: 0 0 auto;
  }

  .app-container {
    padding: 12px 10px;
    gap: 14px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .panel {
    padding: 14px 12px;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border-radius: var(--radius-md);
  }

  .panel-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
  }

  .panel-title-row h2 {
    font-size: 15px;
    line-height: 1.3;
  }

  .inputs-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
  }

  .search-box-large .input-search {
    padding: 12px 14px 12px 38px;
    font-size: 13px;
    width: 100%;
  }

  .search-lens-icon {
    left: 12px;
    font-size: 14px;
  }

  .tax-summary-box {
    padding: 14px 12px;
    gap: 10px;
    width: 100%;
  }

  .tax-row {
    font-size: 12px;
  }

  .tax-row.highlight {
    font-size: 13px;
  }

  .fta-savings-banner {
    font-size: 11px;
    padding: 10px;
    width: 100%;
  }

  .modal-overlay {
    padding: 10px;
    align-items: flex-start;
  }

  .modal-card {
    max-height: calc(100vh - 20px);
    padding: 16px 12px;
    border-radius: 16px;
    margin: 10px auto;
  }
}


