/* Custom Styles for Online Viewer */
/* Green Theme with Dark Mode Support */

:root {
  --color-primary: #059669;
  --color-primary-dark: #047857;
  --color-primary-light: #10b981;
  --color-accent: #34d399;
  --color-bg: #f8fafc;
  --color-bg-secondary: #ffffff;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-editor-bg: #ffffff;
  --color-toolbar-bg: #f1f5f9;
  --color-hover: #ecfdf5;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
  --color-primary: #10b981;
  --color-primary-dark: #059669;
  --color-primary-light: #34d399;
  --color-accent: #6ee7b7;
  --color-bg: #0f172a;
  --color-bg-secondary: #1e293b;
  --color-text: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-border: #334155;
  --color-editor-bg: #1e293b;
  --color-toolbar-bg: #1e293b;
  --color-hover: #064e3b;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header */
.site-header {
  background-color: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.25rem;
}

.site-logo:hover {
  color: var(--color-primary);
}

.site-logo h1 {
  font-size: inherit;
  font-weight: inherit;
  margin: 0;
  line-height: inherit;
}

.site-logo svg {
  width: 32px;
  height: 32px;
}

/* Navigation */
.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.site-nav a:hover {
  color: var(--color-primary);
  background-color: var(--color-hover);
}

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background-color: var(--color-hover);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Viewer Page Title */
.viewer-page-title {
  padding: 0.75rem 1rem 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
  background-color: var(--color-toolbar-bg);
  margin: 0;
}

/* Toolbar */
.toolbar {
  background-color: var(--color-toolbar-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.toolbar-group {
  display: flex;
  gap: 0.25rem;
  padding-right: 0.75rem;
  border-right: 1px solid var(--color-border);
}

.toolbar-group:last-child {
  border-right: none;
  padding-right: 0;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.toolbar-btn:hover {
  background-color: var(--color-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

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

.toolbar-btn svg {
  width: 16px;
  height: 16px;
}

.toolbar-btn-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.toolbar-btn-primary:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: white;
}

/* Editor Container */
.editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.editor-wrapper {
  flex: 1;
  position: relative;
  min-height: 400px;
}

#editor {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 14px;
  line-height: 1.5;
}

/* Split View for HTML Preview */
.split-container {
  flex: 1;
  display: flex;
  min-height: 400px;
}

.split-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.split-pane-header {
  background-color: var(--color-toolbar-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.split-divider {
  width: 4px;
  background-color: var(--color-border);
  cursor: col-resize;
  transition: background-color 0.2s ease;
}

.split-divider:hover {
  background-color: var(--color-primary);
}

.preview-frame {
  flex: 1;
  border: none;
  background-color: white;
}

/* Tree View (for JSON) */
.tree-container {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  font-family: 'Source Code Pro', 'Fira Code', monospace;
  font-size: 0.875rem;
  background-color: var(--color-editor-bg);
}

.tree-node {
  padding-left: 1.25rem;
  position: relative;
}

.tree-node::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: var(--color-border);
}

.tree-key {
  color: var(--color-primary);
  font-weight: 500;
}

.tree-string {
  color: #22c55e;
}

.tree-number {
  color: #3b82f6;
}

.tree-boolean {
  color: #f59e0b;
}

.tree-null {
  color: #ef4444;
}

.tree-toggle {
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.tree-toggle:hover {
  background-color: var(--color-hover);
  border-radius: 0.25rem;
}

/* Text Viewer Textarea */
.text-editor {
  flex: 1;
  width: 100%;
  min-height: 400px;
  padding: 1rem;
  font-family: 'Source Code Pro', 'Fira Code', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  border: none;
  outline: none;
  resize: none;
  background-color: var(--color-editor-bg);
  color: var(--color-text);
}

.text-editor:focus {
  outline: none;
}

/* Status Bar */
.status-bar {
  background-color: var(--color-toolbar-bg);
  border-top: 1px solid var(--color-border);
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Footer */
.site-footer {
  background-color: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.site-footer a {
  color: var(--color-primary);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* Homepage */
.hero-section {
  text-align: center;
  padding: 4rem 1.5rem;
  background: linear-gradient(135deg, var(--color-hover) 0%, var(--color-bg) 100%);
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.hero-title span {
  color: var(--color-primary);
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Tool Cards Grid */
.tools-section {
  padding: 2rem 1.5rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.tools-section:first-of-type {
  padding-top: 3rem;
}

.tools-section:last-of-type {
  padding-bottom: 3rem;
}

.tools-section-heading {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.375rem;
}

.tools-section-description {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.tool-card {
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tool-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tool-card-icon {
  width: 48px;
  height: 48px;
  background-color: var(--color-hover);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.tool-card-icon svg {
  width: 24px;
  height: 24px;
}

.tool-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.tool-card-description {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* About & Contact Pages */
.page-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--color-text);
}

.page-content p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.page-content a {
  color: var(--color-primary);
  text-decoration: none;
}

.page-content a:hover {
  text-decoration: underline;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--color-primary);
  color: white;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 500;
  margin-top: 1rem;
  transition: background-color 0.2s ease;
}

.contact-link:hover {
  background-color: var(--color-primary-dark);
  text-decoration: none;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  animation: slideIn 0.3s ease;
}

.toast-success {
  border-left: 3px solid var(--color-primary);
}

.toast-error {
  border-left: 3px solid #ef4444;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background-color: var(--color-bg-secondary);
  border-radius: 0.75rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0.25rem;
}

.modal-close:hover {
  color: var(--color-text);
}

.modal-body {
  padding: 1.5rem;
}

/* File Input */
.file-input {
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  .toolbar {
    padding: 0.5rem;
    gap: 0.375rem;
  }
  
  .toolbar-btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .toolbar-btn span {
    display: none;
  }
  
  .toolbar-group {
    padding-right: 0.5rem;
  }
  
  .hero-title {
    font-size: 1.75rem;
  }
  
  .split-container {
    flex-direction: column;
  }
  
  .split-divider {
    width: 100%;
    height: 4px;
    cursor: row-resize;
  }
}

/* Ace Editor Theme Overrides */
.ace_editor {
  font-family: 'Source Code Pro', 'Fira Code', monospace !important;
}

[data-theme="dark"] .ace_editor {
  background-color: var(--color-editor-bg) !important;
}
