/* NetTools BR - Styles */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #38bdf8;
  --accent-hover: #0284c7;
  --border-color: #334155;
  --success-bg: #064e3b;
  --success-text: #34d399;
  --warning-bg: #78350f;
  --warning-text: #fbbf24;
  --error-bg: #7f1d1d;
  --error-text: #f87171;
  --info-bg: #1e3a8a;
  --info-text: #60a5fa;
  --sidebar-width: 260px;
  --header-height: 64px;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --radius: 8px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --border-color: #e2e8f0;
  --success-bg: #d1fae5;
  --success-text: #065f46;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --error-bg: #fee2e2;
  --error-text: #991b1b;
  --info-bg: #dbeafe;
  --info-text: #1e40af;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App Layout */
#app-container {
  display: flex;
  flex: 1;
  min-height: 100vh;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
}

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

.header-brand svg {
  color: var(--accent);
}

.header-search {
  position: relative;
  width: 300px;
}

.header-search input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.header-search input:focus {
  outline: 2px solid var(--accent);
}

.header-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.env-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  background-color: var(--info-bg);
  color: var(--info-text);
  font-weight: 600;
}

.theme-toggle, .mobile-nav-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover, .mobile-nav-toggle:hover {
  color: var(--text-primary);
  background-color: var(--bg-input);
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  transition: transform 0.3s ease;
  z-index: 90;
}

.nav-group {
  margin-bottom: 1.5rem;
}

.nav-group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding: 0 0.75rem;
  font-weight: 700;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-input);
}

.nav-link.active {
  color: var(--accent);
  background-color: rgba(56, 189, 248, 0.1);
  font-weight: 600;
}

/* Main Content */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 2rem;
  max-width: 1200px;
  width: calc(100% - var(--sidebar-width));
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Cards & Layout Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card-tool {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.card-tool:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.card-tool-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.card-tool-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background-color: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.card-tool-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-tool-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  flex: 1;
}

.card-tool-badge {
  align-self: flex-start;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  background-color: var(--bg-input);
  color: var(--text-muted);
}

/* Tool Form Controls */
.tool-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

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

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 200px;
}

label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

input[type="text"], input[type="number"], input[type="url"], select, textarea {
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.9rem;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.btn-primary {
  background-color: var(--accent);
  color: #0f172a;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  color: #ffffff;
}

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

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

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Results & Panels */
.result-section {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.result-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  gap: 1rem;
}

/* Code / Output Box */
.code-block {
  background-color: #090d16;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--border-color);
}

[data-theme="light"] .code-block {
  background-color: #1e293b;
  color: #f8fafc;
}

/* Badges & Alerts */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.success, .alert-success {
  background-color: var(--success-bg);
  color: var(--success-text);
}

.status-badge.warning, .alert-warning {
  background-color: var(--warning-bg);
  color: var(--warning-text);
}

.status-badge.error, .alert-error {
  background-color: var(--error-bg);
  color: var(--error-text);
}

.status-badge.info, .alert-info {
  background-color: var(--info-bg);
  color: var(--info-text);
}

.alert {
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: var(--bg-input);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table td.mono {
  font-family: var(--font-mono);
}

/* Technical Analysis Block */
.analysis-card {
  border-left: 4px solid var(--accent);
  background-color: var(--bg-card);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: var(--shadow);
}

.analysis-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.analysis-content {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Loading Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

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

/* Search suggestions popup */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-top: 0.25rem;
  box-shadow: var(--shadow);
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
}

.search-result-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text-primary);
}

.search-result-item:hover {
  background-color: var(--bg-input);
}

.search-result-title {
  font-weight: 600;
  font-size: 0.85rem;
}

.search-result-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

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

.mobile-nav-toggle {
  display: none;
}
