@import url("https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700&display=swap");

:root {
  --primary: #096c1a;
  --primary-dark: #005b2a;
  --accent: #e7fd99;
  --bg: #f8faf9;
  --card-bg: #ffffff;
  --text-main: #1a1a1a;
  --text-muted: #666666;
  --border: #e0e0e0;
  --success: #096c1a;
  --error: #d32f2f;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  --font-main: 'Lexend', sans-serif;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  padding: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* Header & Toggle */
.header {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 30px;
}

.mode-toggle {
  background: white;
  padding: 4px;
  border-radius: 12px;
  display: flex;
  gap: 4px;
  box-shadow: var(--shadow);
}

.mode-btn {
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-main);
  transition: all 0.2s;
  background: transparent;
  color: var(--text-muted);
}

.mode-btn.active {
  background: var(--primary);
  color: white;
}

/* Layout */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

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

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-dark);
}

/* Inputs */
.label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modern-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: #fdfdfd;
  color: var(--primary-dark);
}

.modern-input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(9, 108, 26, 0.1);
  transform: translateY(-1px);
}

textarea {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 120px;
  outline: none;
  transition: border-color 0.2s;
}

textarea:focus {
  border-color: var(--primary);
}

/* Right Sidebar (Status) */
.status-card {
  background: var(--primary-dark);
  color: white;
}

.status-card .card-title {
  color: white;
}

.status-display {
  background: rgba(0, 0, 0, 0.2);
  padding: 16px;
  border-radius: 12px;
  font-family: monospace;
  word-break: break-all;
  margin-bottom: 20px;
  font-size: 13px;
  max-height: 150px;
  overflow-y: auto;
}

.copy-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: var(--primary-dark);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s;
}

.copy-btn:active {
  transform: scale(0.98);
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.metric-item {
  text-align: center;
}

.metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.7;
}

.metric-value {
  font-size: 18px;
  font-weight: 700;
}

/* Details List */
.details-list {
  display: grid;
  gap: 12px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.detail-label {
  color: var(--text-muted);
  font-size: 14px;
}

.detail-value {
  font-weight: 600;
  font-size: 14px;
}

/* Table */
.vendor-table-container {
  overflow-x: auto;
  max-height: 600px;
  overflow-y: auto;
}

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

thead th {
  position: sticky;
  top: 0;
  background: var(--primary-dark);
  color: white;
  text-align: left;
  padding: 16px;
  font-size: 13px;
  font-weight: 600;
  z-index: 20;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

tbody tr:hover {
  background: rgba(231, 253, 153, 0.1);
}

tbody td {
  padding: 16px;
  text-align: left;
  vertical-align: middle;
}

.privacy-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.search-box {
  margin-bottom: 20px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  outline: none;
  font-family: inherit;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Purpose Tags */
.purposes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.purpose-item {
  background: #f9f9f9;
  padding: 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
}

.purpose-item.active {
  border-color: var(--primary);
  background: rgba(9, 108, 26, 0.05);
}

.purpose-id {
  width: 24px;
  height: 24px;
  background: #eee;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.purpose-item.active .purpose-id {
  background: var(--primary);
  color: white;
}

/* Encode Specifics */
.encode-section {
  display: none;
}

.encode-section.active {
  display: block;
}

.decode-section {
  display: none;
}

.decode-section.active {
  display: block;
}

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

/* Modern Checkbox */
.custom-checkbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(0,0,0,0.02);
  transition: all 0.2s;
  border: 1px solid transparent;
}

.custom-checkbox:hover {
  background: rgba(9, 108, 26, 0.05);
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0; width: 0;
}

.checkmark {
  flex-shrink: 0;
  position: relative;
  height: 22px;
  width: 22px;
  background-color: white;
  border: 2px solid var(--border);
  border-radius: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-checkbox:hover input ~ .checkmark {
  border-color: var(--primary);
}

.custom-checkbox input:checked ~ .checkmark {
  background-color: var(--primary);
  border-color: var(--primary);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 50%;
  top: 45%;
  width: 5px;
  height: 10px;
  border: solid var(--accent);
  border-width: 0 2.5px 2.5px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.custom-checkbox input:checked ~ .checkmark:after {
  display: block;
}

.custom-checkbox input:checked + .checkmark + span {
  color: var(--primary-dark);
}

/* Config Grid */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

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

/* Loading State */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--accent);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ===== Site Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.header-logo {
  display: flex;
  align-items: center;
}

.header-logo img {
  height: 24px;
  width: auto;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.header-link:hover {
  color: var(--primary);
}

.header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
}

.header-cta:hover {
  background: var(--primary-dark);
}

/* ===== Free Tools Section ===== */
.free-tools-section {
  margin-top: 60px;
  padding: 60px 0;
  border-top: 1px solid var(--border);
}

.free-tools-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

.free-tools-subtitle {
  text-align: center;
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 40px;
}

.free-tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .free-tools-grid {
    grid-template-columns: 1fr;
  }
}

.free-tool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.3s, border-color 0.3s;
}

.free-tool-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  border-color: var(--primary);
}

.free-tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(9, 108, 26, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.free-tool-icon .material-symbols-outlined {
  font-size: 24px;
  color: var(--primary);
}

.free-tool-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.free-tool-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.free-tool-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  transition: gap 0.2s;
}

.free-tool-card:hover .free-tool-link {
  letter-spacing: 0.5px;
}

/* ===== Site Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  background: white;
  padding: 24px 20px;
  margin-top: 0;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 640px) {
  .footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

.footer-copyright {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--primary);
}
