:root {
  font-family: 'Segoe UI', Roboto, sans-serif;
  color-scheme: light dark;
  --bg: #f2f4f8;
  --panel: #ffffff;
  --border: #d0d7de;
  --primary: #1f6feb;
  --primary-text: #ffffff;
  --text: #24292f;
  --success: #1a7f37;
  --error: #d1242f;
  --pending: #795548;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.tabs-container {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 3rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
}

.tab-button {
  padding: 1rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.tab-button:hover {
  background: rgba(31, 111, 235, 0.05);
}

.tab-button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: transparent;
}

.hidden {
  display: none !important;
}

main.layout {
  display: grid;
  gap: 2rem;
  padding: 3rem;
  grid-template-columns: minmax(300px, 1fr) minmax(400px, 1fr);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

h1,
h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
}

form {
  display: grid;
  gap: 1rem;
}

label {
  font-weight: 600;
}

input {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
}

button {
  padding: 0.9rem 1.2rem;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

button:hover {
  background: #1558d6;
}

.status {
  min-height: 1.5rem;
  font-weight: 600;
}

.status.success {
  color: var(--success);
}

.status.error {
  color: var(--error);
}

.status.pending {
  color: var(--pending);
}

.logs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.log-item {
  border-left: 4px solid var(--border);
  padding: 0.5rem 0.75rem;
  background: rgba(31, 111, 235, 0.05);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.log-item time {
  font-size: 0.85rem;
  color: #57606a;
}

.log-item.error {
  border-color: var(--error);
  background: rgba(209, 36, 47, 0.08);
}

.log-item.success {
  border-color: var(--success);
  background: rgba(26, 127, 55, 0.08);
}

.full-width {
  grid-column: 1 / -1;
}

.file-input-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-input-wrapper input[type="file"] {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
  cursor: pointer;
}

.file-input-wrapper .file-name {
  font-size: 0.9rem;
  color: #57606a;
  font-style: italic;
}

.services-selection {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.services-selection h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-size: 1.1rem;
}

.services-info {
  margin-bottom: 1rem;
  color: #57606a;
  font-size: 0.9rem;
}

.services-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.service-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.service-item:hover {
  border-color: var(--primary);
  background: rgba(31, 111, 235, 0.03);
}

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

.service-item label {
  flex: 1;
  cursor: pointer;
  font-weight: 500;
  margin: 0;
  min-width: 120px;
}

.image-dropdown {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  min-width: 200px;
  max-width: 300px;
  transition: border-color 0.2s ease;
}

.image-dropdown:hover {
  border-color: var(--primary);
}

.image-dropdown:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.1);
}

.no-services {
  color: #57606a;
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

.result-box {
  position: relative;
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.action-buttons {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.5rem;
  z-index: 1;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

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

.action-btn svg {
  flex-shrink: 0;
}

.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1;
}

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

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

.copy-btn svg {
  flex-shrink: 0;
}

.code-output {
  margin: 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.compose-output {
  margin: 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: #f6f8fa;
  padding: 1rem;
  border-radius: 6px;
}

/* Parsed Images Styles */
#parsed-images-container {
  padding: 0.5rem 0;
  overflow-x: auto;
}

.images-table-container {
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.images-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.images-table th {
  background: #f6f8fa;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.images-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e1e4e8;
  vertical-align: top;
}

.images-table tr:hover {
  background: rgba(31, 111, 235, 0.03);
}

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

/* Cell-specific styling */
.image-name-cell {
  font-weight: 600;
  color: var(--primary);
  min-width: 200px;
}

.image-id-cell {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  min-width: 120px;
  word-break: break-all;
}

.sha256-cell {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  min-width: 300px;
  word-break: break-all;
}

.cmd-cell {
  font-family: 'Courier New', Courier, monospace;
  min-width: 120px;
}

.elf-cell {
  font-family: 'Courier New', Courier, monospace;
  min-width: 120px;
}

.date-cell {
  min-width: 120px;
}

.eth-cell {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  min-width: 150px;
  word-break: break-all;
}

.uuid-cell {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  min-width: 200px;
  word-break: break-all;
}

.loading-message,
.no-images,
.error-message {
  text-align: center;
  color: #57606a;
  font-style: italic;
  padding: 2rem;
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.error-message {
  color: var(--error);
  background: rgba(209, 36, 47, 0.08);
  border-color: var(--error);
}

/* Responsive design for mobile and tablet */
@media (max-width: 1200px) {
  .images-table {
    font-size: 0.8rem;
  }

  .images-table th,
  .images-table td {
    padding: 0.5rem 0.75rem;
  }
}

@media (max-width: 768px) {
  .images-table {
    font-size: 0.75rem;
  }

  .images-table th,
  .images-table td {
    padding: 0.4rem 0.5rem;
  }

  .image-name-cell {
    min-width: 150px;
  }

  .sha256-cell {
    min-width: 200px;
  }

  .eth-cell,
  .uuid-cell {
    min-width: 120px;
  }
}

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

  .tabs-container {
    padding: 0 1rem;
  }
}

/* Architecture Selection Styles */
.architecture-selection {
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
}

.architecture-selection h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.architecture-info {
  margin: 0 0 16px 0;
  font-size: 13px;
  color: var(--text);
  opacity: 0.8;
}

.radio-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  transition: all 0.2s ease;
}

.radio-option:hover {
  border-color: var(--primary);
  background: var(--bg);
}

.radio-option input[type="radio"] {
  margin: 0;
  cursor: pointer;
}

.radio-option input[type="radio"]:checked+.radio-label {
  color: var(--primary);
  font-weight: 600;
}

.radio-option input[type="radio"]:checked {
  accent-color: var(--primary);
}

.radio-label {
  font-size: 14px;
  color: var(--text);
  user-select: none;
}

/* Responsive for architecture selection */
@media (max-width: 768px) {
  .radio-group {
    flex-direction: column;
    gap: 8px;
  }

  .radio-option {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Wrap Dockerfile Tab Styles */
textarea {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  font-family: 'Courier New', Courier, monospace;
  resize: vertical;
  min-height: 150px;
  line-height: 1.5;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.1);
}

.form-description {
  margin-bottom: 1.5rem;
  color: #57606a;
  font-size: 0.95rem;
  line-height: 1.5;
}

.measure-selection {
  margin-top: 1rem;
  padding: 1rem;
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.measure-selection label {
  display: block;
  margin-bottom: 0.5rem;
}

.measure-selection select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: var(--panel);
  cursor: pointer;
}

.measure-selection select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.1);
}

.measure-info {
  margin-top: 0.5rem;
  margin-bottom: 0;
  font-size: 0.85rem;
  color: #57606a;
  font-style: italic;
}

.result-section {
  margin-bottom: 2rem;
}

.result-section:last-child {
  margin-bottom: 0;
}

.result-section h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  color: var(--text);
  font-weight: 600;
}

.results-panel {
  max-height: 80vh;
  overflow-y: auto;
}

/* WireGuard Option Styles */
.wireguard-option {
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
}

.wireguard-option h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.wireguard-info {
  margin: 0 0 16px 0;
  font-size: 13px;
  color: var(--text);
  opacity: 0.8;
}

.checkbox-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  transition: all 0.2s ease;
}

.checkbox-option:hover {
  border-color: var(--primary);
  background: var(--bg);
}

.checkbox-option input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-label {
  font-size: 14px;
  color: var(--text);
  user-select: none;
}

/* Class Filter Controls for Java Upload */
.class-filter-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.class-filter-controls input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}

.class-count {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 600;
}

/* Make the class list scrollable */
#java-class-list {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Disabled button state */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tree structure for Java class selection */
.tree-node {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.tree-node:hover {
  background: rgba(31, 111, 235, 0.05);
}

.tree-toggle {
  display: inline-block;
  width: 12px;
  font-size: 0.8rem;
  color: #57606a;
  transition: transform 0.2s ease;
}

.tree-children {
  border-left: 1px solid #e1e4e8;
  margin-left: 10px;
}

.tree-node label {
  margin: 0;
  font-size: 0.9rem;
}

.tree-node input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}