/* DevTools Hub - Shared Styles */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #10b981;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #475569;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

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

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

.search-box {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-box::before {
  content: "🔍";
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
}

.tool-switcher {
  position: relative;
}

.tool-switcher select {
  padding: 0.5rem 2rem 0.5rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  appearance: none;
}

.tool-switcher::after {
  content: "▼";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.6rem;
  pointer-events: none;
}

/* Breadcrumbs */
.breadcrumbs {
  padding: 0.75rem 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 1400px;
  margin: 0 auto;
}

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

.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs span { margin: 0 0.5rem; }

/* Main Layout */
.main-layout {
  display: grid;
  grid-template-columns: 250px 1fr 250px;
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
}

@media (max-width: 1200px) {
  .main-layout { grid-template-columns: 220px 1fr; }
  .related-tools { display: none; }
}

@media (max-width: 768px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 70px;
  height: fit-content;
}

.sidebar-section {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.sidebar-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.sidebar-links { list-style: none; }

.sidebar-links a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.sidebar-links a:hover { background: var(--bg-input); }
.sidebar-links a.active {
  background: var(--primary);
  color: white;
}

/* Tool Container */
.tool-container {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem;
  min-height: 500px;
}

.tool-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.tool-header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.tool-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Tool Workspace */
.tool-workspace {
  display: grid;
  gap: 1rem;
}

.tool-workspace.split {
  grid-template-columns: 1fr 1fr;
}

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

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

textarea, input[type="text"], input[type="number"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.9rem;
  resize: vertical;
}

textarea:focus, input:focus {
  outline: none;
  border-color: var(--primary);
}

textarea.code {
  min-height: 300px;
  line-height: 1.5;
}

/* Buttons */
.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

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

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--error);
  color: white;
}

/* Output */
.output-area {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  min-height: 100px;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Status Messages */
.status {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.status.success { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.status.error { background: rgba(239, 68, 68, 0.2); color: var(--error); }
.status.info { background: rgba(99, 102, 241, 0.2); color: var(--primary); }

/* Related Tools */
.related-tools {
  position: sticky;
  top: 70px;
  height: fit-content;
}

.related-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1rem;
}

.related-card h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.related-list { list-style: none; }

.related-list a {
  display: block;
  padding: 0.6rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.related-list a:hover { background: var(--bg-input); }

/* Landing Page Grid */
.hero {
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.tool-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid transparent;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  border-color: var(--primary);
}

.tool-card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.tool-card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.tool-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.tool-card-tag {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-input);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* Options Row */
.options-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 1rem 0;
}

.option-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.option-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.option-group select, .option-group input {
  padding: 0.4rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
}

/* Checkbox/Radio */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Color Picker */
input[type="color"] {
  width: 50px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}

/* Copy Button */
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
}

.output-wrapper {
  position: relative;
}

/* Diff specific */
.diff-line { padding: 2px 8px; }
.diff-add { background: rgba(34, 197, 94, 0.2); }
.diff-remove { background: rgba(239, 68, 68, 0.2); }
.diff-header { color: var(--primary); font-weight: bold; }

/* Hash results */
.hash-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hash-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.hash-label {
  font-weight: 600;
  color: var(--primary);
}

.hash-value {
  font-family: monospace;
  font-size: 0.8rem;
  background: var(--bg);
  padding: 0.5rem;
  border-radius: 4px;
  word-break: break-all;
}

/* Cron */
.cron-parts {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

@media (max-width: 600px) {
  .cron-parts { grid-template-columns: repeat(2, 1fr); }
}

.cron-part {
  text-align: center;
}

.cron-part label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.cron-part input {
  text-align: center;
  padding: 0.5rem;
}

.cron-expression {
  font-family: monospace;
  font-size: 1.5rem;
  text-align: center;
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
  margin: 1rem 0;
}

.cron-readable {
  text-align: center;
  color: var(--text-muted);
}

/* Color swatches */
.color-preview {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0;
}

.color-swatch {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  border: 2px solid var(--border);
}

.color-values {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.color-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-value code {
  background: var(--bg);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* UUID list */
.uuid-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.uuid-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-family: monospace;
}

/* Regex matches */
.regex-matches {
  margin-top: 1rem;
}

.match-item {
  display: inline-block;
  background: rgba(99, 102, 241, 0.3);
  padding: 0.25rem 0.5rem;
  margin: 0.25rem;
  border-radius: 4px;
  font-family: monospace;
}

.match-highlight {
  background: rgba(99, 102, 241, 0.4);
  border-radius: 2px;
}

/* Security Badge */
.security-badge {
  background: linear-gradient(135deg, #065f46 0%, #047857 100%);
  border: 1px solid #10b981;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.security-badge-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.security-badge-text {
  font-size: 0.9rem;
  line-height: 1.4;
}

.security-badge-text strong {
  color: #34d399;
}

@media (max-width: 600px) {
  .security-badge {
    flex-direction: column;
    text-align: center;
  }
}

/* Tabs for tool options */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  position: relative;
}

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

.tab.active {
  color: var(--primary);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Security Badge */
.security-badge {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(16, 185, 129, 0.1));
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.security-badge .badge-icon {
  font-size: 1.75rem;
  flex-shrink: 0;
}

.security-badge .badge-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.security-badge .badge-content strong {
  color: var(--success);
  font-size: 0.95rem;
}

.security-badge .badge-content span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.security-badge .btn {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

@media (max-width: 600px) {
  .security-badge {
    flex-direction: column;
    text-align: center;
  }
  .security-badge .btn {
    width: 100%;
  }
}

/* FAQ Section */
.faq-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.faq-section h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.faq-item {
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border);
}

.faq-question {
  width: 100%;
  background: transparent;
  border: none;
  padding: 1rem 1.25rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s;
}

.faq-question:hover {
  background: rgba(255, 255, 255, 0.05);
}

.faq-question::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--primary);
  transition: transform 0.3s;
}

.faq-item.open .faq-question::after {
  content: '−';
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s;
  padding: 0 1.25rem;
}

.faq-item.open .faq-answer {
  max-height: 500px;
  padding: 0 1.25rem 1rem;
}

.faq-answer p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 0;
}

.faq-answer ol, .faq-answer ul {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

/* Security Modal */
.security-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

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

.security-modal {
  background: var(--bg-card);
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.security-modal-overlay.active .security-modal {
  transform: scale(1);
}

.security-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
}

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

.security-modal h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.security-modal h2::before {
  content: '🔒';
}

.security-modal h3 {
  font-size: 1rem;
  color: var(--primary);
  margin: 1.5rem 0 0.75rem;
}

.security-modal p {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.security-modal ul {
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.security-modal .security-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--bg);
  padding: 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
}

.security-modal .security-check-icon {
  color: var(--success);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.security-modal .security-check-text {
  flex: 1;
}

.security-modal .security-check-text strong {
  color: var(--text);
  display: block;
  margin-bottom: 0.25rem;
}

.security-modal .security-check-text span {
  color: var(--text-muted);
  font-size: 0.85rem;
}
