:root {
  --primary-color: #0052cc;
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #253858;
  background: white;
  margin: 0;
  padding: 24px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* ===========================
   Common Layout Components
   =========================== */

.simple-container {
  width: 100%;
  max-width: 670px;
  background: white;
  border: 1px solid #c1c7d0;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-top: 40px;
}

/* Header */
.simple-header {
  padding: 16px 24px 12px;
  border-bottom: 1px solid #c1c7d0;
  background: #fafbfc;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.simple-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  color: var(--primary-color);
}

/* Service Icon */
.service-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.service-icon svg,
.service-icon img {
  width: 100%;
  height: 100%;
  display: block;
}

/* Header auth info */
.header-auth-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #505f79;
}

.header-auth-info .user-icon {
  width: 16px;
  height: 16px;
}

.header-auth-info .username {
  color: #172b4d;
  font-weight: 500;
}

.header-logout-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.header-logout-btn:hover {
  background: rgba(220, 38, 38, 0.1);
}

.header-logout-btn img {
  width: 14px;
  height: 14px;
}

/* Status badges */
.status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status.online {
  background: rgba(0, 102, 68, 0.1);
  color: #006644;
}

.status.offline {
  background: rgba(191, 38, 0, 0.1);
  color: #bf2600;
}

/* Main Content */
.simple-main {
  padding: 24px 24px;
}

/* Footer */
.simple-footer {
  padding: 16px 32px;
  background: #fafbfc;
  border-top: 1px solid #c1c7d0;
  border-radius: 0 0 6px 6px;
}

.simple-footer p {
  margin: 0;
  font-size: 12px;
  color: #505f79;
  text-align: center;
}

.simple-footer a {
  color: #0065ff;
  text-decoration: none;
}

.simple-footer a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.MCPServer {
  color: #dddddd;
}

/* ===========================
   Forms (Token Generator)
   =========================== */

.tab-container {
  margin-bottom: 0;
}

.tabs {
  display: flex;
  border-bottom: 1px solid #c1c7d0;
  margin-bottom: 24px;
}

.tab {
  background: none;
  border: none;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #505f79;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

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

.tab:hover {
  color: #253858;
  background: #fafbfc;
}

.tab-content {
  display: none;
}

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

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

.form-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: #42526e;
  font-size: 14px;
}

input, select, textarea {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #c1c7d0;
  border-radius: 3px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: white;
}

select {
  padding: 3px 6px;
}

.tool-prompt-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tool-prompt-select {
  vertical-align: middle;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #0065ff;
  box-shadow: 0 0 0 2px rgba(0, 101, 255, 0.1);
}

input::placeholder, textarea::placeholder {
  color: #cecece;
}

.time-input {
  flex: 1;
}

.time-unit {
  flex: 0 0 120px;
}

.key-value-pair {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.key-value-pair input {
  margin-bottom: 0;
}

.key-value-pair input[name="keys"] {
  width: 180px;
  flex-shrink: 0;
}

.key-value-pair input[name="values"] {
  flex: 1;
}

.remove-btn {
  background: white;
  color: #bf2600;
  border: 0px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.remove-btn:hover {
  background: #bf2600;
  color: white;
  border-color: #bf2600;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type='checkbox'] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.checkbox-label code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  background: #f4f5f7;
  padding: 1px 4px;
  border-radius: 3px;
}

.add-btn {
  background: #d7ffd4;
  color: #089300;
  border: none;
  border-radius: 14px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 24px;
  font-weight: 500;
  align-items: center;
  transition: background 0.2s ease;
}

.add-btn:hover {
  background: #c9ffc4;
}

.btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-bottom: 16px;
}

.btn:hover {
  background: #0065ff;
  box-shadow: 0 1px 1px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.31);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* Result messages */
.result {
  margin-top: 24px;
  padding: 24px;
  border-radius: 3px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

.result.success {
  background: rgba(0, 102, 68, 0.1);
  color: #006644;
  border: 1px solid rgba(0, 102, 68, 0.2);
}

.result.error {
  background: rgba(191, 38, 0, 0.1);
  color: #bf2600;
  border: 1px solid rgba(255, 86, 48, 0.2);
}

/* Token output */
.token-output {
  background: #ebecf0;
  border: 1px solid #c1c7d0;
  border-radius: 3px;
  padding: 16px;
  font-family: ui-monospace, 'SF Mono', 'Consolas', 'Roboto Mono', 'Ubuntu Mono', monospace;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-all;
  min-height: 100px;
  resize: vertical;
  color: #172b4d;
  position: relative;
}

.token-info {
  background: rgba(0, 102, 68, 0.05);
  border: 1px solid rgba(0, 102, 68, 0.1);
  border-radius: 3px;
  padding: 16px;
  margin-top: 12px;
}

.token-info h4 {
  margin-bottom: 8px;
  color: #006644;
  font-weight: 600;
  font-size: 14px;
}

.token-info p {
  margin: 4px 0;
  font-family: ui-monospace, 'SF Mono', 'Consolas', 'Roboto Mono', 'Ubuntu Mono', monospace;
  font-size: 14px;
  color: #172b4d;
}

/* ===========================
   Modals (Home page)
   =========================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(9, 30, 66, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 8px -2px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.31);
  max-width: 90vw;
  max-height: 90vh;
  width: 900px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: #fafbfc;
  border-bottom: 1px solid #c1c7d0;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--primary-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  font-weight: 300;
  color: #505f79;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #dfe1e6;
  color: #253858;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Admin auth tabs (token-gen login modal) */
.admin-auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid #dfe1e6;
}

.admin-auth-tab {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #6b778c;
  transition: color 0.15s, border-color 0.15s;
}

.admin-auth-tab:hover {
  color: #172b4d;
}

.admin-auth-tab.active {
  color: var(--primary-color, #0f65dc);
  border-bottom-color: var(--primary-color, #0f65dc);
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 3px;
  border: 1px solid #c1c7d0;
}

.details-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 12px;
}

.details-table th {
  background: #dfe1e6;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #253858;
  border-bottom: 2px solid #c1c7d0;
  white-space: nowrap;
}

.details-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #dfe1e6;
  vertical-align: top;
}

.details-table tr:hover {
  background: #fafbfc;
}

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

/* Detail row styles */
.detail-row {
  background: #fafbfc;
}

.detail-row td {
  padding: 0;
}

.detail-content {
  padding: 16px;
  position: relative;
}

/* Loading spinner */
.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #c1c7d0;
  border-top: 2px solid #0065ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px auto;
}

.loading-cell {
  text-align: center;
  padding: 40px 20px;
  color: #505f79;
  font-size: 14px;
}

.loading-cell .loading-spinner {
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Error message styles */
.error-message {
  padding: 16px;
  background: #ffebe9;
  color: #bf2600;
  border: 1px solid #ff5630;
  border-radius: 3px;
  font-family: ui-monospace, 'SF Mono', 'Consolas', 'Roboto Mono', 'Ubuntu Mono', monospace;
  font-size: 12px;
  text-align: center;
}

/* ===========================
   Info Section (Home page)
   =========================== */

.info-section {
  margin-bottom: 0;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #dfe1e6;
}

.info-row:last-child {
  border-bottom: none;
}

.label {
  font-weight: 500;
  color: #42526e;
  min-width: 100px;
}

.value {
  text-align: right;
  color: #172b4d;
  font-family: ui-monospace, 'SF Mono', 'Consolas', 'Roboto Mono', 'Ubuntu Mono', monospace;
  font-size: 14px;
}

.value.link {
  color: #0065ff;
  text-decoration: none;
}

.value.link:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.value.connected {
  color: #006644;
}

.value.disconnected, .value.error {
  color: #bf2600;
}

/* ===========================
   Links
   =========================== */

.clickable {
  color: #0065ff !important;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.clickable:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.detail-link {
  color: #0065ff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.detail-link:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

/* ===========================
   Copy Button & Notification
   =========================== */

.copy-button, .validate-token-button {
  position: absolute;
  bottom: 5px;
  right: 35px;
  background: #ffffff73;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  transition: all 0.2s ease;
  z-index: 10;
}

.validate-token-button {
  right: 5px;
}

.copy-button:hover, .validate-token-button:hover {
  background: #ffffff;
  transform: scale(1.05);
}

.copy-notification {
  position: absolute;
  top: 8px;
  right: 42px;
  background: #006644;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 11;
  white-space: nowrap;
}

.copy-notification.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===========================
   Code/JSON Content
   =========================== */

.json-content {
  font-family: ui-monospace, 'SF Mono', 'Consolas', 'Roboto Mono', 'Ubuntu Mono', monospace;
  font-size: 11px;
  line-height: 1.4;
  color: #172b4d;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
  background: #ebecf0;
  padding: 16px;
  padding-right: 48px;
  border-radius: 3px;
  border: 1px solid #c1c7d0;
  position: relative;
}

.prompt-content {
  font-family: ui-monospace, 'SF Mono', 'Consolas', 'Roboto Mono', 'Ubuntu Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #172b4d;
  max-height: 400px;
  overflow-y: auto;
  position: relative;
}

.prompt-content pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 16px;
  padding-right: 48px;
  background: #ebecf0;
  border-radius: 3px;
  border: 1px solid #c1c7d0;
  position: relative;
}

.resource-content {
  font-family: ui-monospace, 'SF Mono', 'Consolas', 'Roboto Mono', 'Ubuntu Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #172b4d;
  max-height: 400px;
  overflow-y: auto;
  position: relative;
}

.resource-content pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 16px;
  padding-right: 48px;
  background: #ebecf0;
  border-radius: 3px;
  border: 1px solid #c1c7d0;
  position: relative;
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 640px) {
  body {
    padding: 16px;
  }

  .simple-container {
    margin-top: 24px;
    max-width: 100%;
  }

  .simple-header {
    padding: 16px 20px 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .simple-header h1 {
    font-size: 20px;
  }

  .header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-title {
    gap: 12px;
  }

  .service-icon {
    width: 32px;
    height: 32px;
  }

  .simple-main {
    padding: 20px 20px;
  }

  .simple-footer {
    padding: 12px 24px;
  }

  .form-row {
    flex-direction: column;
    gap: 8px;
  }

  .key-value-pair {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .key-value-pair input[name="keys"] {
    width: 100%;
  }

  .remove-btn {
    width: 100%;
    margin-top: 8px;
  }

  .info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 0;
  }

  .label {
    min-width: auto;
  }

  .value {
    text-align: left;
  }

  .copy-button {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .copy-notification {
    font-size: 11px;
    right: 32px;
  }

  .json-content,
  .prompt-content pre,
  .resource-content pre {
    padding-right: 40px;
  }
}
