/* Linux BenchTools - Main Styles (Monokai Dark Theme) */

:root {
  /* Couleurs Monokai */
  --bg-primary: #1e1e1e;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #3e3e3e;
  --text-primary: #f8f8f2;
  --text-secondary: #cccccc;
  --text-muted: #75715e;

  /* Couleurs fonctionnelles */
  --color-success: #a6e22e;
  --color-warning: #fd971f;
  --color-danger: #f92672;
  --color-info: #66d9ef;
  --color-purple: #ae81ff;
  --color-yellow: #e6db74;
  --border-color: #444444;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Icon sizing (customisable) */
  --section-icon-size: 32px;
  --button-icon-size: 24px;
  --icon-btn-size: 42px;
  --icon-btn-icon-size: 26px;
}

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

body {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
}

a {
  color: var(--color-info);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

.container-fluid {
  width: 100%;
  padding: var(--spacing-lg);
}

/* Header */
.header {
  background-color: var(--bg-secondary);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  border-bottom: 2px solid var(--color-success);
}

.header h1 {
  color: var(--color-success);
  font-size: 2rem;
  margin-bottom: var(--spacing-sm);
}

.header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Navigation */
.nav {
  display: flex;
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.nav-link {
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: all 0.2s;
}

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

.nav-link.active {
  background-color: var(--color-success);
  color: var(--bg-primary);
}

/* Cards */
.card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  border: 1px solid var(--bg-tertiary);
}

.card-header {
  font-size: 1.2rem;
  color: var(--color-info);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--bg-tertiary);
}

.card-body {
  color: var(--text-primary);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
}

.stat-card {
  background-color: var(--bg-secondary);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--color-success);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  margin-bottom: var(--spacing-xs);
}

.stat-value {
  color: var(--color-success);
  font-size: 2rem;
  font-weight: bold;
}

.stat-unit {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-left: var(--spacing-xs);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

thead {
  background-color: var(--bg-tertiary);
}

th {
  padding: var(--spacing-md);
  text-align: left;
  color: var(--color-info);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
}

td {
  padding: var(--spacing-md);
  border-top: 1px solid var(--bg-tertiary);
  color: var(--text-primary);
}

/* Device sections */
.device-section {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.device-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--bg-tertiary);
  padding-bottom: var(--spacing-sm);
}

.device-section .section-header h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--color-info);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.section-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.section-icon {
  width: var(--section-icon-size);
  height: var(--section-icon-size);
  object-fit: contain;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.4));
}

.section-title {
  line-height: 1.2;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.icon-btn {
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  color: var(--text-primary);
}

.icon-btn img {
  width: var(--button-icon-size);
  height: var(--button-icon-size);
  object-fit: contain;
}

.icon-btn:hover {
  transform: scale(1.05);
  border-color: var(--color-info);
}

.icon-btn.danger {
  border-color: var(--color-danger);
}

.icon-btn.success {
  border-color: var(--color-success);
}

.doc-actions {
  display: flex;
  gap: var(--spacing-xs);
}

.doc-actions .icon-btn {
  width: 32px;
  height: 32px;
}

.device-preamble {
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  background: var(--bg-secondary);
}

.preamble-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
  align-items: start;
}

.preamble-left {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.preamble-right {
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .preamble-content {
    grid-template-columns: 1fr;
  }
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-sm);
}

.header-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.header-stat {
  text-align: right;
}

.usage-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.usage-pill.ok {
  background: rgba(166, 226, 46, 0.2);
  color: var(--color-success);
}

.usage-pill.medium {
  background: rgba(253, 151, 31, 0.2);
  color: var(--color-warning);
}

.usage-pill.high {
  background: rgba(249, 38, 114, 0.2);
  color: var(--color-danger);
}

.usage-pill.muted {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.inline-form,
.links-form,
.tag-form {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.inline-form input,
.links-form input,
.tag-form input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
}

.link-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
}

/* Device list actions */
.device-list-item {
  position: relative;
}

.device-list-delete {
  background: transparent;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem;
  transition: transform 0.2s ease;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.device-list-delete:hover {
  transform: scale(1.2);
  filter: brightness(1.3);
}

/* Markdown blocks */
.markdown-block {
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm);
  white-space: pre-wrap;
  line-height: 1.5;
}

.markdown-block code {
  background: rgba(0,0,0,0.3);
  padding: 0 0.25rem;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

tbody tr {
  transition: background-color 0.2s;
}

tbody tr:hover {
  background-color: var(--bg-tertiary);
}

/* Badges */
.badge {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
}

.badge-success {
  background-color: var(--color-success);
  color: var(--bg-primary);
}

.badge-warning {
  background-color: var(--color-warning);
  color: var(--bg-primary);
}

.badge-danger {
  background-color: var(--color-danger);
  color: var(--text-primary);
}

.badge-info {
  background-color: var(--color-info);
  color: var(--bg-primary);
}

/* Score badges */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-weight: bold;
  font-size: 1rem;
}

.score-high {
  background-color: var(--color-success);
  color: var(--bg-primary);
}

.score-medium {
  background-color: var(--color-warning);
  color: var(--bg-primary);
}

.score-low {
  background-color: var(--color-danger);
  color: var(--text-primary);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

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

.btn-primary:hover {
  background-color: #8bc922;
  text-decoration: none;
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

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

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

.btn-danger:hover {
  background-color: #d81857;
}

.btn-sm {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.8rem;
}

/* Forms */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: var(--spacing-sm);
  background-color: var(--bg-tertiary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-success);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* Code block */
.code-block {
  background-color: var(--bg-tertiary);
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--color-success);
  overflow-x: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
  color: var(--color-yellow);
  position: relative;
}

.code-block code {
  color: var(--color-yellow);
}

.copy-btn {
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
}

.copy-btn:hover {
  background-color: var(--color-success);
  color: var(--bg-primary);
}

/* Grid */
.grid {
  display: grid;
  gap: var(--spacing-md);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Responsive */
@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Loading */
.loading {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-secondary);
}

.loading::after {
  content: '...';
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Error */
.error {
  background-color: var(--color-danger);
  color: var(--text-primary);
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-md);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

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