/* Shared Settings UI Styles */

/* Screen management */
.screen {
  display: block;
}

.screen.hidden {
  display: none;
}

/* Hidden class utility */
.hidden {
  display: none !important;
}

/* Text styling */
p {
  margin-bottom: 15px;
  line-height: 1.5;
  color: #aaa;
}

/* Button group */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
  align-items: flex-start; /* Prevent buttons from stretching full width */
}

/* Base button */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(0);
}

/* Button variants */
.btn-primary {
  background-color: #007bff;
  color: white;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #545b62;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
}

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

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  margin-top: 8px;
}

/* Input fields - scoped to settings screen */
.screen input[type="text"]:not(.vertex-note-input),
.screen input[type="password"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #383838;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 10px;
  font-family: monospace;
  background-color: #242424;
  color: #e0e0e0;
}

.screen input[type="text"]:focus,
.screen input[type="password"]:focus {
  outline: none;
  border-color: #4a9eff;
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.15);
}

/* Key display */
.key-display {
  background-color: #2e2e2e;
  border: 1px solid #383838;
  border-radius: 6px;
  padding: 15px;
  margin: 15px 0;
}

.key-display strong {
  display: block;
  margin-bottom: 8px;
  color: #888;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.key-value-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #242424;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #383838;
}

.key-value {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  word-break: break-all;
  color: #6ab0ff;
}

/* Key validation status */
.key-validation-status {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-left: 4px;
}

.key-validation-status.hidden {
  display: none;
}

.key-validation-status .validation-icon {
  width: 16px;
  height: 16px;
  display: none;
}

.key-validation-status.valid .validation-icon.valid {
  display: block;
}

.key-validation-status.invalid .validation-icon.invalid {
  display: block;
}

/* Copy button */
.btn-copy {
  flex-shrink: 0;
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #6c757d;
  transition: all 0.2s ease;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-copy:hover {
  color: #28a745;
  background-color: #2e2e2e;
}

.btn-copy:active {
  transform: scale(0.95);
}

.btn-copy.copied {
  color: #28a745;
}

.btn-copy.copied svg {
  animation: checkmark 0.3s ease;
}

@keyframes checkmark {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Messages */
.success-message {
  color: #28a745;
  font-weight: 500;
  margin-bottom: 15px;
  font-size: 16px;
}

.error-message {
  color: #ff7070;
  font-weight: 500;
  margin-bottom: 15px;
  font-size: 16px;
}

.warning-message {
  color: #e6c96a;
  background-color: #251e00;
  border: 1px solid #4a3c00;
  border-radius: 6px;
  padding: 10px;
  font-size: 13px;
  margin: 15px 0;
}

/* Loading spinner */
.spinner {
  text-align: center;
  padding: 30px;
  color: #007bff;
}

.spinner::before {
  content: '⏳';
  display: block;
  font-size: 32px;
  margin-bottom: 10px;
  animation: spin 2s linear infinite;
}

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

/* Key input row */
.key-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  max-width: 520px;
}

.key-input {
  flex: 1;
  width: auto;
  min-width: 36ch;
  margin-bottom: 0;
  font-family: monospace;
}

.key-icon-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.key-icon-btn:hover {
  color: #ccc;
}

.key-status-icon {
  flex-shrink: 0;
}

.key-validating {
  flex-shrink: 0;
  color: #666;
  font-size: 16px;
  line-height: 1;
}

.btn-create-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  margin-bottom: 4px;
}

.btn-create-key:hover:not(:disabled) {
  color: #ccc;
}

.btn-create-key:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Alias row - click to edit */
.alias-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 10px;
}

.alias-label {
  font-size: 1.2rem;
  color: #666;
  flex-shrink: 0;
}

.alias-value {
  font-size: 1.2rem;
  color: #e0e0e0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.alias-value:hover {
  background-color: #2a2a2a;
}

.alias-value .vertex-note-input {
  width: 200px;
  font-size: inherit;
}

/* Configuration section */
.config-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #383838;
}

.config-section details {
  cursor: pointer;
}

.config-section summary {
  font-size: 13px;
  color: #666;
  padding: 8px 0;
  user-select: none;
}

.config-section summary:hover {
  color: #bbb;
}

.config-content {
  padding-top: 10px;
}

.config-content label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.config-content input[type="text"] {
  margin-bottom: 0;
}

/* Settings auth status */
.settings-auth-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #aaa;
}

/* Settings action buttons */
.settings-actions {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

/* Text button */
.btn-text {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-text:hover:not(:disabled) {
  color: #aaa;
}

.btn-text:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-text.btn-danger {
  color: #b35959;
}

.btn-text.btn-danger:hover:not(:disabled) {
  color: #dc3545;
}

/* Created/rotated key display */
.created-key-display {
  background-color: #1e1e1e;
  border: 1px solid #383838;
  border-radius: 6px;
  padding: 16px;
  margin: 16px 0;
}

.created-key-label {
  margin: 0 0 10px 0;
  font-size: 13px;
}

.created-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.created-key-value {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
  color: #6ab0ff;
  word-break: break-all;
  background-color: #242424;
  padding: 8px;
  border-radius: 4px;
}

.created-key-warning {
  margin: 12px 0 0 0;
  font-size: 12px;
  color: #e6c96a;
}

/* Key rotation prompt */
.key-rotation-prompt {
  margin-top: 16px;
  padding: 16px;
  background-color: #252525;
  border: 1px solid #333;
}

.key-rotation-label {
  margin: 0 0 12px 0;
  font-size: 1.1rem;
  color: #999;
}

.key-rotation-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.key-rotation-input {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid #444;
  font-size: 1rem;
  font-family: 'Courier New', monospace;
  background-color: #1a1a1a;
  color: #e5e5e5;
}

.key-rotation-input:focus {
  outline: none;
  border-color: #6ab0ff;
}

.key-rotation-input::placeholder {
  color: #666;
}

.key-visibility-toggle {
  flex-shrink: 0;
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.key-visibility-toggle:hover {
  color: #999;
}

.key-rotation-error {
  margin: 0 0 12px 0;
  font-size: 1rem;
  color: #ff6b6b;
}

.key-rotation-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.key-rotation-buttons .btn-primary {
  padding: 8px 16px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 0.95rem;
  background-color: #e5e5e5;
  color: #1a1a1a;
  border: 1px solid #e5e5e5;
  cursor: pointer;
  transition: all 0.2s ease;
}

.key-rotation-buttons .btn-primary:hover:not(:disabled) {
  background-color: #fff;
}

.key-rotation-buttons .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
