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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
}

h1, h2 {
  color: #ffffff;
}

a {
  color: #4fc3f7;
}

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

.error {
  color: #ef5350;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

/* ===== Login View ===== */
#login-view {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-card {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 2rem;
  width: 340px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.login-card h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  color: #4fc3f7;
}

.login-card label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  color: #b0bec5;
}

.login-card input {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid #0f3460;
  border-radius: 4px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 0.95rem;
}

.login-card input:focus {
  outline: none;
  border-color: #4fc3f7;
}

.login-card button {
  width: 100%;
  padding: 0.6rem;
  border: none;
  border-radius: 4px;
  background: #4fc3f7;
  color: #1a1a2e;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.login-card button:hover {
  background: #29b6f6;
}

/* ===== Topbar ===== */
#topbar {
  display: flex;
  align-items: center;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  padding: 0.5rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: #4fc3f7;
  margin-right: auto;
}

#topbar-user {
  margin-right: 1rem;
  font-size: 0.9rem;
  color: #b0bec5;
}

#logout-btn {
  padding: 0.3rem 0.8rem;
  border: 1px solid #ef5350;
  border-radius: 4px;
  background: transparent;
  color: #ef5350;
  cursor: pointer;
  font-size: 0.85rem;
}

#logout-btn:hover {
  background: #ef5350;
  color: #fff;
}

/* ===== Player View ===== */
#player-view {
  padding: 1.5rem;
  max-width: 700px;
  margin: 0 auto;
}

#player-view h2 {
  margin-bottom: 1rem;
}

#player-server-list .player-server {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

#player-server-list .player-server span {
  font-weight: 600;
}

#player-server-list .player-server button {
  padding: 0.3rem 0.8rem;
  border: none;
  border-radius: 4px;
  background: #66bb6a;
  color: #1a1a2e;
  font-weight: 600;
  cursor: pointer;
}

#player-server-list .player-server button:hover {
  background: #43a047;
}

#player-message {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 4px;
  background: #1b5e20;
  color: #a5d6a7;
}

#player-message.error-msg {
  background: #b71c1c;
  color: #ef9a9a;
}

/* ===== Server Cards Row ===== */
.server-cards-row {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  padding: 1rem;
  overflow-x: auto;
  white-space: nowrap;
}

.card {
  flex: 0 0 auto;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  min-width: 150px;
  text-align: center;
  transition: border-color 0.15s;
}

.card:hover {
  border-color: #4fc3f7;
}

.card.selected {
  border-color: #4fc3f7;
  background: #0f3460;
}

.card .card-name {
  font-weight: 700;
  font-size: 1rem;
  display: block;
  margin-bottom: 0.25rem;
}

.card .card-port {
  font-size: 0.8rem;
  color: #b0bec5;
}

.add-card {
  border-style: dashed;
  color: #4fc3f7;
  font-weight: 600;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Badge (status) ===== */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge.running {
  background: #1b5e20;
  color: #66bb6a;
}

.badge.stopped {
  background: #b71c1c;
  color: #ef5350;
}

/* ===== Server Panel ===== */
#server-panel {
  margin: 0 1rem 1rem;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 1rem;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.panel-header h2 {
  margin-right: 0.5rem;
}

.panel-actions {
  margin-left: auto;
  display: flex;
  gap: 0.4rem;
}

.panel-actions button {
  padding: 0.3rem 0.7rem;
  border: none;
  border-radius: 4px;
  background: #4fc3f7;
  color: #1a1a2e;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}

.panel-actions button:hover {
  background: #29b6f6;
}

.panel-actions button.danger {
  background: #ef5350;
  color: #fff;
}

.panel-actions button.danger:hover {
  background: #c62828;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #0f3460;
  margin-bottom: 1rem;
}

.tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: #b0bec5;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab:hover {
  color: #e0e0e0;
}

.tab.active {
  color: #4fc3f7;
  border-bottom-color: #4fc3f7;
}

.tab-content {
  min-height: 200px;
}

/* ===== Console ===== */
#console-log {
  background: #0d1117;
  border: 1px solid #0f3460;
  border-radius: 4px;
  padding: 0.75rem;
  font-family: "Fira Code", "Cascadia Code", "Consolas", monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  height: 350px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: #c9d1d9;
}

.console-input {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.console-input input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #0f3460;
  border-radius: 4px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-family: "Fira Code", "Cascadia Code", "Consolas", monospace;
  font-size: 0.85rem;
}

.console-input input:focus {
  outline: none;
  border-color: #4fc3f7;
}

.console-input button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  background: #4fc3f7;
  color: #1a1a2e;
  font-weight: 600;
  cursor: pointer;
}

.console-input button:hover {
  background: #29b6f6;
}

/* ===== Data Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #0f3460;
}

th {
  color: #b0bec5;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  font-size: 0.9rem;
}

/* ===== IP / User Actions ===== */
.ip-actions,
.user-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.ip-actions input,
.user-actions input,
.user-actions select {
  padding: 0.4rem 0.6rem;
  border: 1px solid #0f3460;
  border-radius: 4px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 0.9rem;
}

.ip-actions input:focus,
.user-actions input:focus,
.user-actions select:focus {
  outline: none;
  border-color: #4fc3f7;
}

.ip-actions button,
.user-actions button {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 4px;
  background: #4fc3f7;
  color: #1a1a2e;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}

.ip-actions button:hover,
.user-actions button:hover {
  background: #29b6f6;
}

/* Table action buttons */
td button {
  padding: 0.2rem 0.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: 0.25rem;
}

td button.btn-toggle {
  background: #ff9800;
  color: #1a1a2e;
}

td button.btn-toggle:hover {
  background: #f57c00;
}

td button.btn-reset {
  background: #ab47bc;
  color: #fff;
}

td button.btn-reset:hover {
  background: #8e24aa;
}

td button.btn-delete {
  background: #ef5350;
  color: #fff;
}

td button.btn-delete:hover {
  background: #c62828;
}

td button.btn-remove {
  background: #ef5350;
  color: #fff;
}

td button.btn-remove:hover {
  background: #c62828;
}

/* ===== Users Section ===== */
.users-section {
  margin: 1rem;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 1rem;
}

.users-section h2 {
  margin-bottom: 1rem;
}

/* ===== Dialog Overlay ===== */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.dialog {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 1.5rem;
  width: 400px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.dialog h2 {
  margin-bottom: 1rem;
  color: #4fc3f7;
}

.dialog label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  color: #b0bec5;
}

.dialog input,
.dialog textarea,
.dialog select {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.75rem;
  border: 1px solid #0f3460;
  border-radius: 4px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 0.9rem;
  font-family: inherit;
}

.dialog textarea {
  font-family: "Fira Code", "Cascadia Code", "Consolas", monospace;
  font-size: 0.85rem;
  resize: vertical;
}

.dialog input:focus,
.dialog textarea:focus,
.dialog select:focus {
  outline: none;
  border-color: #4fc3f7;
}

.dialog-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.dialog-buttons button {
  flex: 1;
  padding: 0.5rem;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

.dialog-buttons button[type="submit"] {
  background: #4fc3f7;
  color: #1a1a2e;
}

.dialog-buttons button[type="submit"]:hover {
  background: #29b6f6;
}

.dialog-buttons button[type="button"] {
  background: #37474f;
  color: #e0e0e0;
}

.dialog-buttons button[type="button"]:hover {
  background: #455a64;
}

/* ===== Dialog Enhancements ===== */
.dialog-wide {
  width: 480px;
}

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

.form-group {
  flex: 1;
}

.label-hint {
  font-size: 0.75rem;
  color: #607d8b;
  font-weight: normal;
}

.advanced-toggle {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: #4fc3f7;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
}

.advanced-toggle:hover {
  text-decoration: underline;
}

.loading-text {
  color: #4fc3f7;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

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

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
  background: #0f3460;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4fc3f7;
}
