/* ============================================================================
   EU IMPORT REQUIREMENTS TOOL - STYLESHEET
   UNIDO Branding Colors:
   - Primary Blue: #0275BF
   - White: #FFFFFF  
   - Light Blue: #E9F5FF
   - Orange Accent: #F57A43
   - Secondary Blue: #98CBEA
   ============================================================================ */

/* ===== GLOBAL STYLES ===== */
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(to bottom, #E9F5FF 0%, #F5FAFF 100%);
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

/* Smooth transitions for all elements */
* {
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

/* ===== ANIMATIONS ===== */
@keyframes spinner {
  to { transform: rotate(360deg); }
}

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

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 2000px;
  }
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #98CBEA;
  border-radius: 50%;
  border-top-color: #0275BF;
  animation: spinner 0.8s ease-in-out infinite;
}

/* ===== HEADER STYLES ===== */
.page-header {
  background: linear-gradient(to bottom, #E9F5FF 0%, #F5FAFF 100%) !important;
  color: #333333 !important;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,89,172,0.1);
  margin-bottom: 0;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.logo-section {
  flex: 0 0 auto;
  padding-top: 2px;
}

.logo {
  height: 50px;
  width: auto;
}

.title-section {
  flex: 0 1 auto;
  min-width: 280px;
  padding-top: 2px;
  text-align: right;
  margin-left: auto;
  margin-right: 5px;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: #FFFFFF;
  line-height: 1.3;
}

.page-subtitle {
  font-size: 13px;
  margin: 0;
  opacity: 0.95;
  color: #FFFFFF;
  font-weight: 400;
  line-height: 1.5;
}

.dropdown-section {
  background: rgba(255,255,255,0.1);
  padding: 16px 20px;
  border-radius: 8px;
  flex: 1 1 100%;
  margin-top: 8px;
}

.dropdown-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.dropdown-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 200px;
}

.dropdown-label {
  font-weight: 600;
  font-size: 13px;
  color: #FFFFFF;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.select-in-header {
  padding: 11px 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #FFFFFF;
  color: #0275BF;
  font-weight: 500;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0,89,172,0.1);
}

.select-in-header:hover {
  border-color: rgba(255,255,255,0.6);
  box-shadow: 0 4px 12px rgba(0,89,172,0.2);
}

.select-in-header:focus {
  outline: none;
  border-color: #F57A43;
  box-shadow: 0 0 0 3px rgba(245,122,67,0.2);
}

/* ===== CUSTOM SEARCHABLE DROPDOWN ===== */
.custom-dropdown {
  position: relative;
  width: 100%;
}

.dropdown-display {
  padding: 11px 36px 11px 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  background: #FFFFFF;
  color: #0275BF;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,89,172,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dropdown-display:hover {
  border-color: rgba(255,255,255,0.6);
  box-shadow: 0 4px 12px rgba(0,89,172,0.2);
}

.dropdown-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #0275BF;
  pointer-events: none;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #FFFFFF;
  border: 2px solid #0275BF;
  border-radius: 8px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,89,172,0.2);
}

.dropdown-search-wrapper {
  position: sticky;
  top: 0;
  background: #E9F5FF;
  padding: 12px;
  border-bottom: 1px solid #98CBEA;
  display: flex;
  gap: 8px;
  align-items: center;
}

.dropdown-search {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid #98CBEA;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.dropdown-search:focus {
  outline: none;
  border-color: #0275BF;
}

.clear-search-btn {
  padding: 6px 12px;
  background: #F57A43;
  color: #FFFFFF;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.clear-search-btn:hover {
  background: #e06832;
}

.dropdown-item-count {
  font-size: 12px;
  color: #666;
  text-align: center;
  padding: 8px;
  background: #F8FBFF;
  border-bottom: 1px solid #E9F5FF;
}

.dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #E9F5FF;
}

.dropdown-item:hover {
  background: #E9F5FF;
}

.dropdown-item.selected {
  background: #D6EDFF;
  font-weight: 600;
  color: #0275BF;
}

.no-products-message {
  padding: 16px;
  text-align: center;
  color: #666;
  font-style: italic;
}

/* ===== MAIN CONTAINER ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  line-height: 1.6;
}

/* ===== PANELS AND SECTIONS ===== */
.panel {
  background: #FFFFFF;
  border: 1px solid #98CBEA;
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: 0 4px 16px rgba(0,89,172,0.12);
  animation: fadeIn 0.5s ease-out;
}

.section-title {
  font-weight: 700;
  margin-bottom: 16px;
  font-size: 18px;
  color: #0275BF;
  border-bottom: 2px solid #98CBEA;
  padding-bottom: 8px;
}

.subsection-title {
  font-weight: 600;
  margin-bottom: 12px;
  margin-top: 24px;
  font-size: 16px;
  color: #0275BF;
  border-left: 4px solid #F57A43;
  padding-left: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.subsection-title:hover {
  background: #F8FBFF;
  padding-right: 12px;
}

.toggle-icon {
  font-size: 14px;
  color: #98CBEA;
  font-weight: bold;
  min-width: 20px;
  text-align: center;
  transition: transform 0.2s ease;
}

.section-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  justify-content: flex-end;
}

.control-btn {
  padding: 6px 14px;
  background: #E9F5FF;
  color: #0275BF;
  border: 1px solid #98CBEA;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: #0275BF;
  color: #FFFFFF;
  border-color: #0275BF;
}

.collapsible-content {
  animation: slideDown 0.3s ease-out;
  overflow: hidden;
}

/* ===== LISTS ===== */
.list {
  margin: 0;
  padding-left: 24px;
  line-height: 1.8;
  color: #333;
}

.list li {
  margin-bottom: 12px;
}

/* ===== TABLES ===== */
.table-wrapper {
  max-height: 600px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #E9F5FF;
  border-radius: 8px;
  margin-top: 12px;
  box-shadow: 0 2px 8px rgba(0,89,172,0.08);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border-radius: 8px;
}

.table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.table th {
  text-align: left;
  border-bottom: 2px solid #0275BF;
  padding: 10px 12px;
  font-weight: 600;
  color: #FFFFFF;
  background: linear-gradient(135deg, #0275BF 0%, #0066C0 100%);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table td {
  border-bottom: 1px solid #E9F5FF;
  padding: 8px 12px;
  vertical-align: top;
  color: #333;
  font-size: 14px;
}

.table tbody tr {
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.table tbody tr:nth-child(even) {
  background: #F8FBFF;
}

.table tbody tr:nth-child(odd) {
  background: #FFFFFF;
}

.table tbody tr:hover {
  background: #D6EDFF !important;
  transform: scale(1.01);
}

.link {
  cursor: pointer;
  text-decoration: underline;
  color: #0275BF;
  transition: color 0.2s;
  font-weight: 500;
}

.link:hover {
  color: #F57A43;
}

/* ===== SCROLL TO TOP BUTTON ===== */
.scroll-to-top {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0275BF 0%, #0066C0 100%);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,89,172,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  transition: all 0.3s ease;
  z-index: 10;
}

.scroll-to-top:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0,89,172,0.4);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,89,172,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 9999;
  animation: fadeIn 0.2s ease-out;
}

.modal {
  background: #FFFFFF;
  width: min(800px, 100%);
  max-height: 85vh;
  overflow: auto;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0,89,172,0.3);
  border: 1px solid #98CBEA;
  animation: fadeIn 0.3s ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 2px solid #98CBEA;
  font-weight: 600;
  font-size: 18px;
  background: #0275BF;
  color: #FFFFFF;
}

.close-btn {
  border: 2px solid #FFFFFF;
  padding: 6px 16px;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  color: #FFFFFF;
}

.close-btn:hover {
  background: #FFFFFF;
  color: #0275BF;
}

.modal-body {
  padding: 24px;
}

/* ===== DOCUMENT CARD (IN MODAL) ===== */
.doc-card {
  border: 1px solid #98CBEA;
  border-radius: 6px;
  margin-bottom: 16px;
  overflow: hidden;
}

.doc-header {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  background: #E9F5FF;
}

.doc-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: #0275BF;
  font-size: 15px;
}

.doc-meta {
  font-size: 13px;
  color: #666;
  margin-bottom: 2px;
}

.doc-hierarchy {
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.doc-node {
  margin: 4px 0;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.doc-node:hover {
  background: #E9F5FF;
}

.doc-node-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.doc-node-label {
  font-weight: 500;
  color: #0275BF;
}

.doc-node-text {
  color: #333;
}

.doc-node-children {
  margin-left: 20px;
  padding-left: 12px;
  border-left: 2px solid #E9F5FF;
}

.doc-leaf-link {
  color: #0275BF;
  text-decoration: underline;
  font-size: 13px;
  margin-left: 8px;
}

.doc-leaf-link:hover {
  color: #F57A43;
}

.section-list {
  margin: 12px 0 12px 24px;
  padding: 0;
  line-height: 1.8;
}

/* ===== HS HIERARCHY TREE ===== */
.hs-tree {
  font-family: monospace, 'Courier New';
  line-height: 1.6;
  padding: 12px 0;
}

.hs-node {
  padding: 6px 8px;
  margin: 1px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.hs-node:hover {
  background: #E9F5FF;
}

.hs-toggle {
  min-width: 16px;
  color: #98CBEA;
  font-weight: bold;
  user-select: none;
  text-align: center;
}

.hs-code {
  font-weight: 600;
  color: #0275BF;
  min-width: 70px;
}

.hs-label {
  color: #333;
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 32px 24px;
  color: #0275BF;
  font-size: 13px;
  margin-top: 48px;
  border-top: 1px solid #98CBEA;
}

/* ===== UTILITY CLASSES ===== */
.note {
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  font-style: italic;
}

.error-message {
  padding: 16px;
  background: #FFF3F3;
  border: 1px solid #FFD4D4;
  border-radius: 8px;
  color: #CC0000;
  font-size: 14px;
}

.loading-message {
  padding: 48px 24px;
  text-align: center;
  color: #0275BF;
  font-size: 16px;
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: #666;
  font-size: 16px;
  font-style: italic;
}