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

body {
  width: 400px;
  min-height: 500px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #1a1a1a;
  color: #e0e0e0;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #16a75a 0%, #0d8045 100%);
  border-bottom: 2px solid #0d8045;
}

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

.logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.title {
  font-size: 18px;
  font-weight: 700;
  color: white;
  margin: 0;
}

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

.header-button {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  color: white;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.header-button:hover {
  background: rgba(255, 255, 255, 0.25);
}

.settings-button {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  color: white;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-button:hover {
  background: rgba(255, 255, 255, 0.25);
}

.settings-button.danger {
  background: rgba(220, 53, 69, 0.2);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.3);
}

.settings-button.danger:hover {
  background: rgba(220, 53, 69, 0.3);
  border-color: rgba(220, 53, 69, 0.5);
}

/* Tab Bar */
.tabs {
  display: flex;
  background: #2a2a2a;
  border-bottom: 2px solid #333;
  overflow-x: auto;        /* horizontal-scroll fallback when tabs don't fit */
  scrollbar-width: thin;
}

.tab-button {
  flex: 1 1 0;
  min-width: 0;            /* allow tabs to shrink so all four fit */
  padding: 10px 6px;
  background: transparent;
  border: none;
  color: #888;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

.tab-button:hover {
  background: #333;
  color: #aaa;
}

.tab-button.active {
  color: #fff;
  background: #1a1a1a;
  border-bottom: 2px solid #16a75a;
}

.tab-icon {
  font-size: 16px;
}

.tab-icon-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Tab Content */
.tab-content {
  flex: 1;
  overflow-y: auto;
}

.tab-pane {
  display: none;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading State */
.loading {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-style: italic;
}

/* Shared Styles for Adapters */
.character-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.character-item {
  background: #2a2a2a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.character-item:hover {
  background: #333;
  border-color: #ff6b35;
}

.character-name {
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.character-details {
  font-size: 12px;
  color: #888;
}

.error {
  background: #3a1a1a;
  border: 1px solid #5a2a2a;
  border-radius: 8px;
  padding: 12px;
  color: #ff6b6b;
  margin-bottom: 12px;
}

.btn {
  background: #ff6b35;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn:hover {
  background: #ff8555;
}

.btn:disabled {
  background: #444;
  color: #666;
  cursor: not-allowed;
}

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

/* Settings Modal */
#settings-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

#settings-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #2a2a2a;
  border-radius: 12px;
  width: 90%;
  max-width: 350px;
  max-height: 90%;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: linear-gradient(135deg, #16a75a 0%, #0d8045 100%);
  border-bottom: 2px solid #0d8045;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  max-height: 400px;
}

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

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

.settings-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: #16a75a;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settings-description {
  color: #aaa;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 12px 0;
}

.settings-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: #333;
  border-radius: 6px;
}

.info-label {
  color: #888;
  font-size: 13px;
}

.info-value {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}

.settings-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-link {
  padding: 10px 12px;
  background: #333;
  border-radius: 6px;
  color: #16a75a;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: center;
}

.settings-link:hover {
  background: #3a3a3a;
  color: #1bc76b;
}

/* DiceCloud Auth Modal */
#dicecloud-auth-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

#dicecloud-auth-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-description {
  color: #aaa;
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 20px 0;
  text-align: center;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #16a75a;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #333;
  border-radius: 6px;
  font-size: 14px;
  background: #1a1a1a;
  color: #e0e0e0;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: #16a75a;
}

/* Password field with toggle button */
.password-field-container {
  position: relative;
  width: 100%;
}

.password-field-container input {
  padding-right: 40px;
}

.password-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.password-toggle-btn:hover {
  color: #16a75a;
}

.password-toggle-btn:focus {
  outline: 2px solid #16a75a;
  outline-offset: 2px;
  border-radius: 4px;
}

.help-text {
  font-size: 13px;
  color: #b0b0b0;
  line-height: 1.4;
}

.error-message {
  background: #2a1a1a;
  color: #ff6b6b;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #5a2a2a;
  margin-top: 12px;
  font-size: 13px;
}

.error-message.hidden {
  display: none;
}

.auth-success {
  padding: 10px 0;
}

.btn-primary {
  background: #16a75a;
  color: #000000;
  font-weight: 700;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
  width: 100%;
}

.btn-primary:hover {
  background: #1bc76b;
}

.btn-primary:disabled {
  background: #0d8045;
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-danger {
  background: #dc3545;
  color: white;
  font-weight: 700;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-danger:hover {
  background: #c82333;
}
