/* JSON & CSV/TSV Converter Web App Stylesheet */

:root {
  /* Colors */
  --brand-purple: #a855f7;
  --brand-purple-dark: #7e22ce;
  --brand-blue: #3b82f6;
  --brand-blue-dark: #1d4ed8;
  --brand-green: #10b981;
  --brand-green-dark: #047857;
  
  --bg-dark: #060913;
  --panel-bg: rgba(14, 20, 38, 0.55);
  --border-light: rgba(255, 255, 255, 0.05);
  --text-light: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dark: #64748b;
  
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-premium: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: 'Noto Sans KR', 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Grid Background Grid */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -2;
  pointer-events: none;
}

/* Background Lighting */
.bg-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(160px);
  opacity: 0.22;
  pointer-events: none;
  z-index: -3;
}
.bg-glow-purple {
  background: radial-gradient(circle, #7e22ce 0%, transparent 70%);
  top: -200px;
  left: 10%;
}
.bg-glow-blue {
  background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
  top: 35%;
  right: 5%;
}

/* Glass panel helpers */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-premium);
  transition: var(--transition-smooth);
}
.glass-panel:hover {
  border-color: rgba(168, 85, 247, 0.2);
  box-shadow: var(--shadow-premium), 0 0 25px rgba(168, 85, 247, 0.05);
}

.glass-panel-inner {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  transition: var(--transition-smooth);
}
.glass-panel-inner:hover {
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--border-light);
}

/* ==========================================
     PORTAL HEADER & FOOTER
     ========================================== */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  z-index: 100;
  margin: 1rem 1.5rem 0 1.5rem;
  border-radius: 50px;
  position: sticky;
  top: 1rem;
}

.glass-header {
  background: rgba(14, 20, 38, 0.75);
  border: 1px solid var(--border-light);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.logo-circle {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-blue) 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(168, 85, 247, 0.3);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-text {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.logo-text span {
  color: var(--text-muted);
  font-weight: 400;
}

.header-nav {
  flex-grow: 1;
  margin: 0 2rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.header-nav::-webkit-scrollbar {
  display: none;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 1.25rem;
  white-space: nowrap;
}

.nav-list a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-smooth);
  padding: 0.5rem 0.25rem;
  position: relative;
}

.nav-list a:hover {
  color: var(--text-light);
}

.nav-list a.active {
  color: var(--text-muted);
}

.nav-list a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--brand-purple);
  border-radius: 2px;
}

.btn-back-dashboard {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  padding: 0.5rem 1.2rem;
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-back-dashboard:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--brand-purple);
  transform: translateX(-2px);
}

.main-footer {
  text-align: center;
  padding: 4rem 2rem;
  border-top: 1px solid var(--border-light);
  margin-top: 5rem;
  background: rgba(14, 20, 38, 0.4);
}
.main-footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.footer-note {
  margin-top: 0.5rem;
  font-size: 0.78rem !important;
}

/* ==========================================
     MAIN CALCULATOR WORKSPACE
     ========================================== */
.calculator-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 1.5rem 6rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Back Link */
.sub-nav-back {
  display: flex;
}
.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}
.back-link:hover {
  color: var(--brand-purple);
  transform: translateX(-3px);
}

/* Header Banner Card */
.app-banner {
  padding: 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(14, 20, 38, 0.85) 0%, rgba(30, 41, 59, 0.4) 100%);
}
.app-banner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 4px; height: 100%;
  background: linear-gradient(to bottom, var(--brand-purple), var(--brand-blue));
}

.badge-capsule {
  display: inline-block;
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.2);
  color: var(--brand-purple);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.85rem;
  border-radius: 50px;
  margin-bottom: 0.8rem;
  letter-spacing: 0.5px;
}

.app-banner h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}
.app-banner p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}
.banner-decor {
  font-size: 4rem;
  color: rgba(255, 255, 255, 0.03);
}

/* ==========================================
     FILE UPLOADER ZONE
     ========================================== */
.upload-zone {
  padding: 2rem;
  border: 2px dashed rgba(255,255,255,0.08);
  border-radius: 20px;
  text-align: center;
  cursor: pointer;
  background: rgba(14, 20, 38, 0.3);
  transition: var(--transition-smooth);
}
.upload-zone.dragover {
  border-color: var(--brand-purple);
  background: rgba(168, 85, 247, 0.05);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.1);
}
.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.upload-icon {
  font-size: 2.5rem;
  transition: transform 0.3s;
}
.upload-zone:hover .upload-icon {
  transform: translateY(-4px);
}
.upload-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
}
.browse-link {
  color: var(--brand-purple);
  text-decoration: underline;
  cursor: pointer;
}
.upload-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.text-purple { color: var(--brand-purple); }

/* ==========================================
     EDITORS WORKSPACE LAYOUT
     ========================================== */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: stretch;
}

.editor-panel-box {
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.editor-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  background: rgba(255,255,255,0.01);
}
.editor-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.editor-title-row h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}
.badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.2);
  color: var(--brand-purple);
}
.badge-blue {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.2);
  color: var(--brand-blue);
}
.editor-actions {
  display: flex;
  gap: 0.5rem;
}
.btn-action-small {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-action-small:hover {
  background: rgba(168, 85, 247, 0.1);
  border-color: var(--brand-purple);
  color: #fff;
}
.btn-action-small.btn-blue:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--brand-blue);
}

.editor-body {
  flex-grow: 1;
  background: #020408;
  position: relative;
}
.editor-textarea-wrapper {
  display: flex;
  width: 100%;
  height: 380px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.8rem;
}
.line-numbers {
  width: 34px;
  padding: 1rem 0.5rem;
  text-align: right;
  color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.005);
  border-right: 1px solid rgba(255,255,255,0.02);
  user-select: none;
  font-size: 0.76rem;
  line-height: 1.5;
  overflow: hidden;
}
.editor-textarea {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #a7f3d0; /* Soft emerald for code text */
  padding: 1rem;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.5;
  overflow-y: auto;
}
.editor-textarea::placeholder {
  color: #4b5563;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
}
#txt-output-code {
  color: #93c5fd; /* Soft blue for output text */
}

/* Custom Scrollbar for code editors */
.editor-textarea::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.editor-textarea::-webkit-scrollbar-track {
  background: transparent;
}
.editor-textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}
.editor-textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Center Action buttons block */
.converter-triggers-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
}
.btn-convert {
  background: rgba(14, 20, 38, 0.75);
  border: 1px solid var(--border-light);
  color: var(--text-light);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  white-space: nowrap;
}
.btn-convert i {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.3s;
}
.btn-convert:hover {
  border-color: var(--brand-purple);
  background: rgba(168, 85, 247, 0.08);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(168, 85, 247, 0.15);
}
.btn-convert:hover i {
  color: var(--brand-purple);
  transform: translateX(3px);
}

/* ==========================================
     TABLE VISUALIZATION SECTION
     ========================================== */
.table-visualization-section {
  padding: 2rem;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: tableFadeIn 0.5s ease;
}
@keyframes tableFadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.table-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.viewer-title-block h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.viewer-title-block p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.viewer-search-wrap {
  position: relative;
  min-width: 250px;
}
.viewer-search-wrap .search-icon {
  position: absolute;
  top: 50%;
  left: 0.85rem;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--text-muted);
}
#input-table-search {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.5rem 0.85rem 0.5rem 2.1rem;
  color: #fff;
  font-size: 0.82rem;
  outline: none;
  transition: var(--transition-smooth);
}
#input-table-search:focus {
  border-color: var(--brand-purple);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.1);
}

/* Column Toggle filters */
.column-filters-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0,0,0,0.12);
  border: 1px solid rgba(255,255,255,0.02);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
}
.column-filters-wrapper .filter-lbl {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.column-checkboxes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.col-check-lbl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  user-select: none;
}
.col-check-lbl input {
  accent-color: var(--brand-purple);
  cursor: pointer;
}

/* Data Table grid */
.data-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: 12px;
}
.visual-data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8rem;
  white-space: nowrap;
}
.visual-data-table th, .visual-data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.visual-data-table th {
  background: rgba(255,255,255,0.015);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.74rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}
.visual-data-table th:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}
.visual-data-table th.sorted-asc::after {
  content: ' ▲';
  font-size: 0.65rem;
  color: var(--brand-purple);
}
.visual-data-table th.sorted-desc::after {
  content: ' ▼';
  font-size: 0.65rem;
  color: var(--brand-purple);
}
.visual-data-table tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

.type-pill {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  margin-left: 6px;
}

/* Viewer footer */
.table-viewer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}
.table-meta-info {
  font-size: 0.78rem;
  color: var(--text-dark);
}
.table-pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.btn-page {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-page:hover:not(:disabled) {
  border-color: var(--brand-purple);
  color: #fff;
}
.btn-page:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.page-indicator {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==========================================
     GUIDE & FAQ SECTION
     ========================================== */
.guide-details-section {
  padding: 2.5rem;
}
.guide-details-section h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.guide-intro {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin-bottom: 2.5rem;
}
.guide-card {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.guide-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.guide-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.guide-list li {
  display: flex;
  gap: 0.85rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.guide-list .num {
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.2);
  color: var(--brand-purple);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.guide-list strong {
  color: var(--text-light);
}

.faq-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.faq-list li {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
}
.faq-list li strong {
  color: #fff;
}
.faq-list li p {
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================
     FLOATING TOOLBAR CONTROLS
     ========================================== */
.floating-controls-panel {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 100;
}

.progress-ring-wrap {
  width: 50px;
  height: 50px;
  background: rgba(14, 20, 38, 0.85);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.progress-ring-svg {
  transform: rotate(-90deg);
}
.progress-ring-circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 3;
}
.progress-ring-circle-indicator {
  fill: none;
  stroke: var(--brand-purple);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 125.66;
  stroke-dashoffset: 125.66;
  transition: stroke-dashoffset 0.1s;
}
.progress-txt {
  position: absolute;
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
}

.floating-btn {
  width: 50px;
  height: 50px;
  background: rgba(14, 20, 38, 0.85);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: var(--transition-smooth);
}
.floating-btn:hover {
  background: rgba(168, 85, 247, 0.1);
  border-color: var(--brand-purple);
  color: #fff;
  transform: translateY(-2px);
}

/* Mobile Media Queries */
@media (max-width: 900px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .converter-triggers-box {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  .btn-convert {
    flex: 1;
    min-width: 150px;
  }
  .table-viewer-header {
    flex-direction: column;
    align-items: stretch;
  }
  .viewer-search-wrap {
    min-width: 100%;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .main-header {
    margin: 0.5rem;
    padding: 0.5rem 1rem;
  }
  .header-nav {
    display: none;
  }
  .editor-textarea-wrapper {
    height: 280px;
  }
  .table-viewer-footer {
    flex-direction: column;
    gap: 1rem;
  }
}
