/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-main: #0B0F19;
  --bg-card: #161B26;
  --bg-card-hover: #212836;
  --bg-pre: #070A12;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: rgba(30, 41, 59, 0.8);
  --blue-glow: rgba(59, 130, 246, 0.15);
  --emerald-glow: rgba(16, 185, 129, 0.15);
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: 'Poppins', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 768px) {
  body {
    padding: 2rem;
  }
}

/* Custom Selection Highlight */
::selection {
  background-color: rgba(59, 130, 246, 0.3);
}

/* Page Layout Container */
.container {
  max-width: 56rem;
  /* max-w-4xl (896px) */
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Header Component */
header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #1e293b;
  /* border-slate-800 */
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  header {
    flex-direction: row;
  }
}

.brand-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.875rem;
  text-align: center;
}

@media (min-width: 640px) {
  .brand-section {
    flex-direction: row;
    text-align: left;
  }
}

.logo-icon-wrapper {
  padding: 0.5rem;
  background-color: rgba(59, 130, 246, 0.1);
  border-radius: 0.75rem;
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon-wrapper svg {
  width: 1.5rem;
  height: 1.5rem;
}

.title-subtext h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #60a5fa, #818cf8, #22d3ee);
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  line-height: 1.2;
}

.title-subtext p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
  font-weight: 500;
  letter-spacing: 0.025em;
}

/* Host IP Status Badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-card);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-family: monospace;
  color: #34d399;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background-color: #10b981;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .5;
  }
}

/* Main Section */
main {
  width: 100%;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  flex-grow: 1;
}

@media (min-width: 768px) {
  main {
    margin-top: 2rem;
    margin-bottom: 2.5rem;
  }
}

/* Card Component */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

@media (min-width: 768px) {
  .card {
    padding: 1.75rem;
  }
}

.input-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 0.75rem;
  letter-spacing: 0.025em;
}

/* Textarea styling */
.textarea {
  width: 100%;
  background-color: var(--bg-main);
  border: 1px solid rgba(71, 85, 105, 0.6);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #e2e8f0;

  &::placeholder {
    color: #64748b;
  }

  outline: none;
  resize: none;
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  transition: all 0.2s;
  font-family: inherit;
}

.textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Actions Section */
.actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (min-width: 640px) {
  .actions {
    flex-direction: row;
  }
}

/* Buttons */
.btn {
  flex: 1;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.875rem 1.5rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  outline: none;
}

.btn-lua {
  background: linear-gradient(to right, #2563eb, #0891b2);
  color: white;
  border: none;
  box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.1);
}

.btn-lua:hover {
  background: linear-gradient(to right, #3b82f6, #06b6d4);
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.2);
}

.btn-json {
  background: transparent;
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-json:hover {
  border-color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.05);
}

.btn:active {
  transform: scale(0.99);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Loading Area */
.loading {
  display: none;
  text-align: center;
  margin-top: 1.25rem;
  color: #3b82f6;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.025em;
  animation: pulse 1.5s infinite;
}

/* Result Box Section */
.result-area {
  display: none;
  margin-top: 1.5rem;
  border-top: 1px solid rgba(30, 41, 59, 0.6);
  padding-top: 1.5rem;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.result-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-title-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background-color: #3b82f6;
}

.result-header-title h3 {
  font-size: 0.75rem;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.btn-copy {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background-color: #212836;
  border: 1px solid rgba(71, 85, 105, 0.5);
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}

.btn-copy:hover {
  border-color: #94a3b8;
  color: white;
}

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

.btn-copy svg {
  width: 0.875rem;
  height: 0.875rem;
}

/* Output Box */
.output-box {
  background-color: var(--bg-pre);
  border: 1px solid #0f172a;
  border-radius: 0.75rem;
  padding: 1rem;
  font-family: monospace;
  font-size: 0.75rem;
  color: rgba(52, 211, 153, 0.9);
  overflow-x: auto;
  line-height: 1.625;
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.2);
}

@media (min-width: 768px) {
  .output-box {
    padding: 1.25rem;
    font-size: 0.875rem;
  }
}

/* LUA Output Code Highlighting */
.output-box .text-blue-400 {
  color: #60a5fa;
}

.output-box .text-amber-400 {
  color: #f59e0b;
}

.output-box .text-cyan-400 {
  color: #22d3ee;
}

/* Examples Header Component */
.examples-header {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .examples-header {
    flex-direction: row;
    align-items: center;
  }
}

.examples-header-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.examples-header-title svg {
  width: 1.25rem;
  height: 1.25rem;
  color: #60a5fa;
}

.examples-header-title h2 {
  font-size: 0.875rem;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.025em;
}

/* Custom Tabs component */
.tabs-wrapper {
  background-color: var(--bg-main);
  padding: 0.25rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(30, 41, 59, 0.8);
  display: flex;
  width: fit-content;
}

.tab {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover {
  color: #e2e8f0;
}

.tab.active {
  background-color: #212836;
  color: #60a5fa;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Example Panes */
.example-pane {
  display: none;
}

.example-pane.active {
  display: block;
}

.example-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .example-list {
    grid-template-columns: 1fr 1fr;
  }
}

/* Example Item */
.example-item {
  background-color: rgba(33, 40, 54, 0.4);
  border: 1px solid rgba(30, 41, 59, 0.8);
  padding: 1rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.example-item:hover {
  background-color: #212836;
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.05);
}

.example-item:active {
  transform: scale(0.99);
}

.example-item-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.example-item-header svg {
  width: 1rem;
  height: 1rem;
  color: #60a5fa;
  transition: color 0.2s;
}

.example-item:hover .example-item-header svg {
  color: #93c5fd;
}

.example-item h4 {
  font-size: 0.75rem;
  font-weight: 700;
  color: #60a5fa;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.example-item:hover h4 {
  color: #93c5fd;
}

.example-item p {
  font-size: 0.75rem;
  color: #cbd5e1;
  line-height: 1.625;
  font-weight: 400;
}

/* Footer Component */
footer {
  width: 100%;
  max-width: 56rem;
  /* max-w-4xl */
  margin-left: auto;
  margin-right: auto;
  border-top: 1px solid rgba(30, 41, 59, 0.6);
  padding-top: 1.5rem;
  margin-top: 1rem;
  font-size: 0.75rem;
  color: #64748b;
  letter-spacing: 0.025em;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: center;
}

@media (min-width: 640px) {
  .footer-content {
    flex-direction: row;
    text-align: left;
  }
}

.footer-brand {
  color: #94a3b8;
  font-weight: 500;
}

.footer-badge {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background-color: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(30, 41, 59, 0.5);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 11px;
}

.footer-badge svg {
  width: 0.875rem;
  height: 0.875rem;
  color: rgba(59, 130, 246, 0.7);
}

.footer-badge-text {
  color: #94a3b8;
}

/* ===== NEW UX ELEMENTS ===== */

/* Loading spinner (replaces plain text) */
.loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  margin-top: 1.25rem;
  color: #60a5fa;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.025em;
}

.spinner {
  width: 1.25rem;
  height: 1.25rem;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}

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

/* Inline textarea validation hint */
.input-error {
  border-color: #f87171 !important;
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.1) !important;
}

.validation-hint {
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: #f87171;
  font-weight: 500;
}

/* Inline error banner */
.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  background-color: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 0.75rem;
  color: #fca5a5;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
}

.error-banner svg {
  margin-top: 0.1rem;
  color: #f87171;
}

.error-banner span {
  flex: 1;
}

.error-close {
  background: transparent;
  border: none;
  color: #f87171;
  cursor: pointer;
  padding: 0.125rem;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.error-close:hover {
  opacity: 1;
}

/* Copy toast notification */
.copy-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.5rem);
  background-color: #1e293b;
  border: 1px solid rgba(71, 85, 105, 0.6);
  color: #34d399;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  white-space: nowrap;
}

.copy-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== RODO MODAL ===== */

.rodo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 18, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.25s ease;
}

.rodo-overlay.hidden {
  display: none;
}

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

.rodo-modal {
  background: var(--bg-card);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 1.25rem;
  max-width: 42rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(59, 130, 246, 0.1);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(1.5rem); opacity: 0; }
  to   { transform: translateY(0);      opacity: 1; }
}

.rodo-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.8);
}

.rodo-header svg {
  width: 1.5rem;
  height: 1.5rem;
  color: #60a5fa;
  flex-shrink: 0;
}

.rodo-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.rodo-body {
  padding: 1.25rem 1.75rem;
}

.rodo-intro {
  font-size: 0.8125rem;
  color: #94a3b8;
  line-height: 1.6;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
}

.rodo-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.rodo-list dt {
  font-size: 0.75rem;
  font-weight: 700;
  color: #60a5fa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.2rem;
}

.rodo-list dd {
  font-size: 0.8125rem;
  color: #cbd5e1;
  line-height: 1.65;
  margin-left: 0;
  padding-left: 0.75rem;
  border-left: 2px solid rgba(59, 130, 246, 0.2);
}

.rodo-list dd a {
  color: #60a5fa;
  text-decoration: none;
}

.rodo-list dd a:hover {
  text-decoration: underline;
}

.rodo-footer {
  padding: 1.25rem 1.75rem 1.5rem;
  border-top: 1px solid rgba(30, 41, 59, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.rodo-btn {
  width: 100%;
  max-width: 18rem;
  padding: 0.875rem 1.5rem;
}

.rodo-note {
  font-size: 0.7rem;
  color: #64748b;
  text-align: center;
  line-height: 1.5;
  max-width: 30rem;
}