/* Main CSS file - imports all components and themes */

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Theme variables */
: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: #919090;
  --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: #838383;
  --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: #2d343c;
  --command-body-bg: #393e46;
  --scrollbar-track: #232931;
  --scrollbar-thumb: #27ae60;
  --code-bg: #151f2c;
  --code-text: #eeeeee;
  --link-color: #27ae60;
}

/* Base body and layout styles */
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%
  );
  height: 100vh;
  padding: 15px;
  margin: 0;
  transition: background 0.3s ease;
  overflow-x: hidden; /* Prevent horizontal scroll that might affect width */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 320px; /* Minimum supported width */
}

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

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

/* Layout containers */
.container {
  max-width: 1400px;
  width: 100%; /* Use responsive width by default */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

/* Only use fixed width on large screens */
@media (min-width: 1441px) {
  .container {
    width: 1400px; /* Fixed width only on very large screens */
  }
}

.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;
  flex-shrink: 0;
}

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

.card:last-child {
  margin-bottom: 0;
}

/* Typography */
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 */
.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 and version */
.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;
}

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

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);
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Interface card wrapper */
#interfaceCard {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* Enforce consistent width for all content */
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  /* Prevent content from affecting layout */
  overflow: hidden;
}

/* Grid layout */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 20px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  height: 100%;
  transition: all 0.3s ease;
  /* Ensure consistent width regardless of content */
  width: 100%;
  box-sizing: border-box;
  /* Force grid to maintain column ratios regardless of content */
  overflow: hidden;
  /* Prevent content from affecting grid sizing */
  grid-auto-columns: minmax(0, 1fr);
}

.grid > .card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
  /* Force content to stay within grid column bounds */
  min-width: 0; /* Allow content to shrink if needed */
  max-width: 100%; /* Don't exceed column width */
}

/* Players view specific - styles moved to players.css */

/* Header layout */
.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;
}

/* Responsive design - already handled above */

@media (max-width: 1024px) {
  .grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 15px;
    max-width: 100%;
  }

  .grid > .card {
    min-height: 300px;
  }

  /* Players card responsive behavior handled in players.css */

  .header-wrapper {
    gap: 15px;
  }
}

@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;
  }

  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;
  }

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

  label {
    font-size: 12px;
  }

  .grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    max-width: 100%;
  }

  .grid > .card {
    min-height: 250px;
  }

  /* Players card responsive behavior handled in players.css */

  .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;
  }

  .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;
  }
}

@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;
  }

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

  .grid > .card {
    min-height: 220px;
  }

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

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