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

:root {
  /* Light theme (default) */
  --bg-gradient-start: #667eea;
  --bg-gradient-end: #764ba2;
  --card-bg: #ffffff;
  --text-primary: #333;
  --text-secondary: #555;
  --text-tertiary: #666;
  --text-muted: #888;
  --text-disabled: #999;
  --border-color: #e0e0e0;
  --input-bg: #ffffff;
  --input-border: #e0e0e0;
  --input-focus: #667eea;
  --button-bg: #667eea;
  --button-hover: #5568d3;
  --command-header-bg: #f8f9fa;
  --command-header-hover: #e9ecef;
  --command-body-bg: #ffffff;
  --scrollbar-track: #f1f1f1;
  --scrollbar-thumb: #667eea;
  --code-bg: #1e1e1e;
  --code-text: #d4d4d4;
  --link-color: #667eea;
}

body.dark-theme {
  /* Dark theme - Modern Teal Palette */
  --bg-gradient-start: #101216;
  --bg-gradient-end: #1b1e22;
  --card-bg: #1a1d22;
  --text-primary: #eeeeee;
  --text-secondary: #eeeeee;
  --text-tertiary: #d4d4d4;
  --text-muted: #666666;
  --text-disabled: #d4d4d4;
  --border-color: #343b43;
  --input-bg: #2d343c;
  --input-border: #343b43;
  --input-focus: #27ae60;
  --button-bg: #27ae60;
  --button-hover: #2edb76;
  --command-header-bg: #2d343c;
  --command-header-hover: #343b44;
  --command-body-bg: #393e46;
  --scrollbar-track: #232931;
  --scrollbar-thumb: #27ae60;
  --code-bg: #151f2c;
  --code-text: #eeeeee;
  --link-color: #27ae60;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(
    135deg,
    var(--bg-gradient-start) 0%,
    var(--bg-gradient-end) 100%
  );
  min-height: 100vh;
  padding: 15px;
  transition: background 0.3s ease;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--text-primary);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: background 0.3s ease;
}

.card:first-child {
  padding: 33px;
  margin-bottom: 10px;
}

h1 {
  color: var(--text-primary);
  margin-bottom: 5px;
  font-size: 1.5em;
}

h2 {
  color: var(--text-secondary);
  margin-bottom: 15px;
  font-size: 1.3em;
  flex-shrink: 0;
}

h3 {
  color: var(--text-tertiary);
  font-size: 1.1em;
  margin-bottom: 10px;
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 0;
  font-size: 13px;
}

.privacy-badge {
  font-size: 12px;
  color: var(--text-disabled);
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  cursor: help;
  white-space: nowrap;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
  box-sizing: border-box;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
}

.privacy-badge::after {
  content: attr(title);
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: var(--card-bg);
  color: var(--text-primary);
  border-radius: 6px;
  border: 2px solid var(--border-color);
  font-size: 11px;
  white-space: normal;
  width: 280px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  line-height: 1.4;
}

.privacy-badge::before {
  content: "";
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: var(--card-bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 9999;
}

.privacy-badge:hover::after,
.privacy-badge:hover::before {
  opacity: 1;
  visibility: visible;
}

.privacy-badge:hover {
  color: var(--text-primary);
  border-color: var(--input-border);
  background: var(--command-header-hover);
}

.github-link {
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 600;
  transition: opacity 0.2s;
}

.github-link:hover {
  opacity: 0.7;
}

.version-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 10px 0 10px;
  margin-top: 10px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-disabled);
  gap: 10px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer-left strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-link {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s;
  font-size: 11px;
}

.footer-link:hover {
  color: var(--text-primary);
}

.footer-separator {
  color: var(--text-disabled);
  opacity: 0.5;
}

#appVersion {
  font-weight: 500;
}

.privacy-note {
  color: var(--text-disabled);
  font-size: 11px;
  font-style: italic;
  margin: 0;
  line-height: 1.3;
}

.form-group {
  margin-bottom: 15px;
}

.connect-form .form-group {
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 5px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--input-bg);
  color: var(--text-primary);
  transition: border-color 0.3s, background 0.3s;
}

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

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

button {
  background: var(--button-bg);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}

button:hover {
  background: var(--button-hover);
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

button.danger {
  background: #e74c3c;
}

button.danger:hover {
  background: #c0392b;
}

.rcon-spec-button,
.theme-toggle {
  background: transparent;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  height: 32px;
  box-sizing: border-box;
}

.rcon-spec-button {
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
}

.theme-toggle {
  padding: 6px;
  width: 32px;
}

.rcon-spec-button:hover {
  background: var(--command-header-hover);
}

.theme-toggle:hover {
  background: var(--command-header-hover);
  transform: rotate(20deg);
}

button.small {
  padding: 6px 12px;
  font-size: 12px;
}

.copy-button {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-disabled);
  padding: 6px 12px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  font-weight: 600;
}

.copy-button:hover {
  background: var(--command-header-hover);
  color: var(--text-primary);
  border-color: var(--input-border);
}

.copy-button.copied {
  background: var(--button-bg);
  color: white;
  border-color: var(--button-bg);
}

.connection-badge {
  font-size: 12px;
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  background: #27ae60;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.disconnect-button {
  background: #e74c3c;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
}

.disconnect-button:hover {
  background: #c0392b;
}

.status {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.status.connected {
  background: #27ae60;
  color: white;
}

.status.disconnected {
  background: #e74c3c;
  color: white;
}

.hidden {
  display: none !important;
}

.response-header,
.commands-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-shrink: 0;
  min-height: 44px;
  overflow: visible;
}

.commands-header h2,
.response-header h2 {
  margin: 0;
  line-height: 1.2;
}

.header-actions,
#commandsConnectionStatus {
  display: flex;
  gap: 10px;
  align-items: center;
}

.response {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 6px;
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  font-family: "Courier New", monospace;
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.5;
  transition: background 0.3s, color 0.3s;
}

.response.error {
  color: #f48771;
}

.response pre {
  margin: 0;
  font-family: inherit;
}

.response code {
  font-family: inherit;
  background: none;
  padding: 0;
}

.response::-webkit-scrollbar {
  width: 8px;
}

.response::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 10px;
}

.response::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  align-items: stretch;
  max-height: calc(100vh - 240px);
  height: calc(100vh - 240px);
  min-height: 500px;
  transition: height 0.3s ease, max-height 0.3s ease;
}

body.connected .grid {
  max-height: calc(100vh - 160px);
  height: calc(100vh - 160px);
}

.grid > .card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

@media (max-width: 1024px) {
  .grid {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
  }

  .grid > .card {
    height: 60vh;
    max-height: 60vh;
  }

  .commands-list,
  .response {
    min-height: 400px;
  }
}

.masked {
  cursor: pointer;
  user-select: none;
}

.masked:hover {
  opacity: 0.7;
}

.command-item {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.3s;
}

.command-header {
  padding: 12px 15px;
  background: var(--command-header-bg);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.command-header:hover {
  background: var(--command-header-hover);
}

.command-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.command-method {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
  font-weight: 600;
}

.method-get {
  background: #27ae60;
  color: white;
}

.method-post {
  background: #3498db;
  color: white;
}

.method-delete {
  background: #e74c3c;
  color: white;
}

.method-put {
  background: #f39c12;
  color: white;
}

.command-body {
  padding: 15px;
  background: var(--command-body-bg);
  display: none;
  transition: background 0.3s;
}

.command-body.expanded {
  display: block;
}

.command-section {
  margin-bottom: 20px;
}

.command-section h3 {
  color: var(--button-bg);
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--button-bg);
}

.command-button-wrapper {
  margin-top: 15px;
}

.command-button {
  width: 100%;
  display: block;
}

.commands-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 10px;
}

.commands-list::-webkit-scrollbar {
  width: 8px;
}

.commands-list::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 10px;
}

.commands-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}

.header-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.header-left {
  flex: 1;
}

.header-center {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.header-menu {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
  height: 34px;
}

.header-right {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}

.connect-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 15px;
  align-items: center;
}

.connect-button {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

.connection-bar {
  padding: 15px 30px;
}

#connectForm {
  margin-top: 0;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tablet adjustments */
@media (max-width: 1024px) {
  .header-wrapper {
    gap: 15px;
  }

  .commands-header,
  .response-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-actions {
    flex-wrap: wrap;
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  body {
    padding: 8px;
  }

  .card {
    padding: 15px;
    margin-bottom: 8px;
  }

  .card:first-child {
    padding: 18px 15px;
  }

  .header-wrapper {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
  }

  .header-left {
    flex-basis: 100%;
    width: 100%;
    order: 1;
  }

  .header-center {
    order: 2;
    flex: 1 1 auto;
    justify-content: flex-start;
  }

  .header-right {
    order: 3;
    flex: 0 1 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
  }

  .header-menu {
    padding: 2px;
    flex: 0 0 auto;
  }

  .rcon-spec-button {
    font-size: 12px;
    padding: 6px 10px;
  }

  h1 {
    font-size: 1.2em;
    line-height: 1.3;
  }

  h2 {
    font-size: 1.1em;
  }

  .subtitle {
    font-size: 11px;
    line-height: 1.4;
  }

  .github-link {
    font-size: 14px;
  }

  .connection-bar {
    padding: 12px 15px;
  }

  .connect-form {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .connect-form .form-group {
    margin-bottom: 0;
  }

  input,
  select,
  textarea {
    padding: 10px;
    font-size: 14px;
  }

  button {
    padding: 10px 16px;
    font-size: 14px;
  }

  .connect-button {
    padding: 10px;
  }

  .commands-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-height: auto;
  }

  .response-header {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-height: auto;
  }

  .commands-header h2,
  .response-header h2 {
    margin: 0;
    flex-shrink: 0;
  }

  #commandsConnectionStatus {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-actions {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
  }

  .connection-badge {
    font-size: 10px;
    padding: 4px 8px;
    white-space: normal;
    word-break: break-all;
    line-height: 1.2;
  }

  .disconnect-button {
    padding: 4px 8px;
    font-size: 10px;
  }

  #commandsConnectionStatus {
    gap: 6px;
  }

  .privacy-badge {
    font-size: 10px;
    padding: 5px 8px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    font-weight: 600;
  }

  .privacy-badge::after {
    width: 240px;
    font-size: 10px;
  }

  .copy-button {
    padding: 5px 8px;
    font-size: 10px;
    height: 28px;
    display: inline-flex;
    align-items: center;
  }

  .status {
    font-size: 11px;
    padding: 6px 10px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: none;
    height: auto;
    min-height: auto;
  }

  .grid > .card {
    height: 50vh;
    min-height: 300px;
    max-height: none;
  }

  .commands-list,
  .response {
    min-height: 250px;
  }

  .command-item {
    margin-bottom: 6px;
  }

  .command-header {
    padding: 10px 12px;
  }

  .command-title {
    font-size: 13px;
  }

  .command-method {
    font-size: 10px;
    padding: 2px 6px;
  }

  .command-body {
    padding: 12px;
  }

  .command-section h3 {
    font-size: 0.85em;
  }

  .command-button-wrapper {
    margin-top: 12px;
  }

  label {
    font-size: 12px;
  }

  .response {
    padding: 12px;
    font-size: 12px;
  }

  .version-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 9px;
    padding: 8px 0 0 0;
    flex-wrap: wrap;
  }

  .footer-left {
    flex: 1 1 auto;
    min-width: max-content;
  }

  .footer-right {
    flex: 0 1 auto;
    gap: 6px;
    justify-content: flex-end;
  }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
  body {
    padding: 6px;
  }

  .card {
    padding: 12px;
    border-radius: 8px;
  }

  .card:first-child {
    padding: 15px 12px;
  }

  h1 {
    font-size: 1.1em;
  }

  h2 {
    font-size: 1em;
  }

  .subtitle {
    font-size: 10px;
  }

  .github-link {
    font-size: 13px;
  }

  .github-link svg {
    width: 20px;
    height: 20px;
  }

  .connection-bar {
    padding: 10px 12px;
  }

  input,
  select,
  textarea {
    padding: 8px;
    font-size: 14px;
  }

  .grid > .card {
    height: 45vh;
    min-height: 280px;
  }

  .command-header {
    padding: 8px 10px;
  }

  .command-title {
    font-size: 12px;
  }

  .command-body {
    padding: 10px;
  }

  .response {
    padding: 10px;
    font-size: 11px;
  }

  .version-footer {
    font-size: 9px;
  }

  .footer-link {
    font-size: 9px;
  }
}
