/* Card Component - Glass Effect */
.card {
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  padding: 1.5rem;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08),
              inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.card:hover {
  border-color: var(--primary-600);
  box-shadow: 0 8px 32px var(--primary-shadow),
              inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transform: translateY(-2px);
}

.card-name {
  font-size: 1rem;
  font-weight: 500;
  color: #1d1d1f;
  word-break: break-word;
  text-align: center;
}

.card-type-label {
  position: absolute;
  bottom: 0.5rem;
  right: 0.6rem;
  font-size: 0.65rem;
  font-weight: 400;
  color: #d1d5db;
  text-transform: capitalize;
}

.card-checkbox {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 20px;
  height: 20px;
  cursor: pointer;
  display: none;
}

.card-checkbox.visible {
  display: block;
}

.card.selected {
  border-color: var(--primary-600);
  background: rgba(255, 140, 0, 0.15);
}

/* Side Panel - Glass Effect */
.side-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.side-panel.open {
  transform: translateX(0);
}

.side-panel-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.side-panel-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1d1d1f;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  padding: 0.25rem;
}

.close-btn:hover {
  color: #1d1d1f;
}

.side-panel-menu {
  flex: 1;
  padding: 1rem 0;
}

.menu-item {
  padding: 1rem 1.5rem;
  color: #1d1d1f;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s;
}

.menu-item:hover {
  background: #f9fafb;
}

.menu-item.disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

.menu-item.disabled:hover {
  background: transparent;
}

.menu-item.signout {
  color: #ef4444;
}

.menu-item.signout:hover {
  background: #fef2f2;
}

.side-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
  display: none;
}

.side-panel-overlay.visible {
  display: block;
}

/* Modal - Glass Effect */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  display: none;
}

.modal-overlay.visible {
  display: flex;
}

.modal {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.6);
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s;
}

.modal-close-btn:hover {
  background: #f3f4f6;
}

.modal-close-btn img {
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

.modal-close-btn:hover img {
  opacity: 1;
}

.modal-back-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s;
}

.modal-back-btn:hover {
  background: #f3f4f6;
}

.modal-back-btn img {
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

.modal-back-btn:hover img {
  opacity: 1;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 1.5rem;
  text-align: center;
}

.modal-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.modal-input:focus {
  outline: none;
  border-color: var(--primary-600);
}

.modal-error {
  color: #ef4444;
  font-size: 0.75rem;
  margin-bottom: 1rem;
  display: none;
}

.modal-error.visible {
  display: block;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.modal-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.modal-btn-primary {
  background: var(--primary-600);
  color: white;
}

.modal-btn-primary:hover {
  background: var(--primary-hover);
}

.modal-btn-secondary {
  background: white;
  color: #1d1d1f;
  border: 1px solid #e5e7eb;
}

.modal-btn-secondary:hover {
  background: #f9fafb;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1d1d1f;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  font-size: 0.875rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  z-index: 3000;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Login Page Specific - Glass Effect */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-login-bg);
  position: relative;
  z-index: 1;
}

.login-card {
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  padding: 2.5rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1),
              inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.login-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1d1d1f;
  margin-bottom: 2rem;
  text-align: center;
  background: var(--gradient-login-title);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.form-input {
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.875rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-600);
}

.form-error {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 0.5rem;
  display: none;
}

.form-error.visible {
  display: block;
}

.form-hint {
  color: #6b7280;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  line-height: 1.4;
}

.login-btn {
  background: var(--primary-600);
  color: white;
  border: none;
  padding: 0.875rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}

.login-btn:hover {
  background: var(--primary-hover);
}

.login-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

/* Selection Mode */
.selection-actions {
  display: none;
  gap: 0.75rem;
}

.selection-actions.visible {
  display: flex;
}

.selection-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

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

.rename-btn {
  background: white;
  color: #1d1d1f;
  border: 1px solid #e5e7eb;
}

.rename-btn:hover:not(:disabled) {
  background: #f9fafb;
}

.duplicate-btn {
  background: white;
  color: #1d1d1f;
  border: 1px solid #e5e7eb;
}

.duplicate-btn:hover:not(:disabled) {
  background: #f9fafb;
}

.delete-btn {
  background: #ef4444;
  color: white;
}

.delete-btn:hover:not(:disabled) {
  background: #dc2626;
}

.publish-btn {
  background: #f97316;
  color: white;
}

.publish-btn:hover:not(:disabled) {
  background: #ea580c;
}

.cancel-btn {
  background: white;
  color: #1d1d1f;
  border: 1px solid #e5e7eb;
}

.cancel-btn:hover {
  background: #f9fafb;
}

/* Icon Button */
.icon-btn {
  padding: 0.5rem;
  border-radius: 6px;
  background: white;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: #f9fafb;
  border-color: var(--primary-600);
}

.icon-btn img {
  opacity: 0.6;
}

.icon-btn:hover img {
  opacity: 1;
}

/* Settings Menu (Tippy dropdown) */
.settings-menu {
  padding: 0.25rem 0;
  min-width: 180px;
}

.settings-menu-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  font-size: 0.875rem;
  color: #1d1d1f;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}

.settings-menu-item:hover {
  background: #f9fafb;
}

.settings-menu-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.25rem 0;
}

/* Tippy light-border theme override for white background */
.tippy-box[data-theme~='light-border'] {
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: #1d1d1f;
}

.tippy-box[data-theme~='light-border'] .tippy-content {
  padding: 0;
}

.tippy-box[data-theme~='light-border'] .tippy-arrow {
  color: #ffffff;
}

.tippy-box[data-theme~='light-border'] .tippy-arrow::before {
  border-bottom-color: #ffffff;
}

/* Skeleton Loading - Glass Effect */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.skeleton-card {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05),
              inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.skeleton-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.8),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Updating Card - applies shimmer to regular cards */
.card.updating {
  position: relative;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.7;
}

.card.updating::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
  animation: shimmer 1.5s infinite;
  z-index: 1;
}

/* Account Modal */
.account-modal {
  max-width: 450px;
}

.account-info {
  margin-bottom: 2rem;
}

.account-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 250px; /* Match approximate height of loaded content */
}

.collab-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px; /* Match approximate height of collab list */
}

.account-info-item {
  padding: 1rem 0;
  border-bottom: 1px solid #e5e7eb;
}

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

.account-info-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.account-info-value {
  font-size: 1rem;
  color: #1d1d1f;
  word-break: break-word;
}

.account-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.account-action-btn {
  width: 100%;
  padding: 0.875rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: white;
  color: #1d1d1f;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.account-action-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.account-action-btn.danger {
  color: #ef4444;
  border-color: #fecaca;
}

.account-action-btn.danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

/* Delete Account Modal */
.delete-modal {
  max-width: 450px;
}

.delete-title {
  color: #ef4444;
}

.delete-warning {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #991b1b;
  line-height: 1.5;
}

.delete-warning strong {
  display: block;
  margin-bottom: 0.5rem;
  color: #dc2626;
}

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

.modal-btn-danger:hover {
  background: #dc2626;
}

.modal-btn-danger:disabled {
  background: #fca5a5;
  cursor: not-allowed;
}

/* ==================== TWO-FACTOR AUTHENTICATION STYLES ==================== */

/* 2FA Button Status */
.btn-status {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 12px;
  background: #10b981;
  color: white;
  font-weight: 500;
}

/* Modal 1: Enable 2FA Intro */
.twofa-intro {
  padding: 1rem 0;
}

.twofa-intro-text {
  font-size: 0.9375rem;
  color: #4b5563;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.twofa-intro-features {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.twofa-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 8px;
}

.twofa-feature-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.twofa-feature-text {
  font-size: 0.875rem;
  color: #374151;
  line-height: 1.5;
}

/* Modal 2: QR Code Setup */
.twofa-qr-container {
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.twofa-instruction {
  font-size: 0.9375rem;
  color: #4b5563;
  text-align: center;
  margin-bottom: 1.5rem;
}

.twofa-qr-code {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.twofa-qr-code canvas {
  display: block;
  max-width: 200px;
  height: auto;
}

.twofa-manual-entry {
  width: 100%;
  text-align: center;
}

.twofa-manual-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

.twofa-secret-key {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.twofa-secret-key code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.875rem;
  color: #1d1d1f;
  background: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  word-break: break-all;
}

.copy-btn {
  padding: 0.5rem 0.75rem;
  background: var(--primary-600);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.copy-btn:hover {
  background: var(--primary-700);
}

/* Modal 3: Verify TOTP Code */
.twofa-verify-container {
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.twofa-code-inputs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  justify-content: center;
}

.twofa-code-input {
  width: 3rem;
  height: 3.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  color: #1d1d1f;
  transition: all 0.2s;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.twofa-code-input:focus {
  outline: none;
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px var(--primary-shadow);
}

.twofa-code-input::-webkit-outer-spin-button,
.twofa-code-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Modal 4: Recovery Codes */
.twofa-recovery-container {
  padding: 1rem 0;
}

.twofa-recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.recovery-code-item {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1d1d1f;
  background: white;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  text-align: center;
}

.twofa-recovery-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.twofa-action-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.twofa-action-btn:hover {
  background: #f9fafb;
  border-color: var(--primary-600);
}

.twofa-recovery-warning {
  padding: 1rem;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #92400e;
  line-height: 1.5;
}

.twofa-recovery-warning strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #78350f;
}

.twofa-recovery-confirm {
  margin-bottom: 1rem;
}

.twofa-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.twofa-checkbox-label input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
}

.twofa-checkbox-label span {
  font-size: 0.9375rem;
  color: #374151;
}

/* Modal 5: 2FA Management */
.twofa-manage-container {
  padding: 1rem 0;
}

.twofa-status-section {
  padding: 1.5rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.twofa-status-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.twofa-status-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #374151;
}

.twofa-status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.twofa-status-enabled {
  background: #10b981;
  color: white;
}

.twofa-status-detail {
  font-size: 0.875rem;
  color: #6b7280;
}

.twofa-manage-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.twofa-manage-actions .account-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.twofa-manage-info {
  padding: 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.twofa-info-text {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.6;
  margin: 0;
}

/* Modal 6: Disable 2FA */
.twofa-disable-container {
  padding: 1rem 0;
}

.twofa-disable-warning {
  padding: 1rem;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #991b1b;
  line-height: 1.5;
}

.twofa-disable-warning strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #7f1d1d;
}

/* Responsive adjustments for 2FA components */
@media (max-width: 640px) {
  .twofa-code-input {
    width: 2.5rem;
    height: 3rem;
    font-size: 1.25rem;
  }

  .twofa-recovery-codes {
    grid-template-columns: 1fr;
  }

  .recovery-code-item {
    font-size: 0.8125rem;
  }

  .twofa-recovery-actions {
    flex-direction: column;
  }
}

/* ============================================================================
   COLLABORATION COMPONENTS
   ============================================================================ */

/* Collab button styling */
.collab-btn {
  background: var(--primary-600);
  color: white;
}

.collab-btn:hover:not(:disabled) {
  background: var(--primary-700);
}

.leave-btn {
  background: #f97316;
  color: white;
}

.leave-btn:hover:not(:disabled) {
  background: #ea580c;
}

/* Collab icon badge on project cards */
.card-collab-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

.card-collab-badge img {
  width: 100%;
  height: 100%;
  filter: invert(50%) sepia(90%) saturate(1500%) hue-rotate(360deg) brightness(100%) contrast(101%);
}

/* Collaboration modal (larger than standard) */
.collab-modal {
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.collab-invite-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e5e7eb;
}

.collab-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1d1d1f;
  margin-bottom: 0.5rem;
}

.collab-invite-input {
  margin-bottom: 0.5rem;
  min-height: 80px;
  font-family: inherit;
  resize: vertical;
}

.collab-hint {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

.collab-list-section {
  margin-bottom: 2rem;
}

.collab-section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 0.75rem;
}

/* Collab list with scrolling */
.collab-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.collab-list-empty {
  padding: 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: #9ca3af;
}

.collab-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  transition: background 0.2s;
}

.collab-list-item:last-child {
  border-bottom: none;
}

.collab-list-item:hover {
  background: #f9fafb;
}

.collab-list-item-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.collab-list-item-username {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1d1d1f;
}

.collab-list-item-pending {
  opacity: 0.6;
}

.collab-list-item-pending .collab-list-item-username {
  font-style: italic;
}

.collab-list-item-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.collab-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.6;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.collab-delete-btn:hover {
  opacity: 1;
}

.collab-delete-btn img {
  width: 16px;
  height: 16px;
  filter: invert(37%) sepia(85%) saturate(5092%) hue-rotate(349deg) brightness(96%) contrast(96%);
}

.collab-pending-icon {
  width: 16px;
  height: 16px;
  opacity: 0.4;
}

.collab-transfer-section {
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.collab-transfer-btn {
  width: 100%;
  padding: 0.75rem;
  background: white;
  color: #1d1d1f;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.collab-transfer-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

/* Transfer ownership modal */
.transfer-list-container {
  margin: 1.5rem 0;
}

.transfer-instruction {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

.transfer-list {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.transfer-list-item {
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background 0.2s;
}

.transfer-list-item:last-child {
  border-bottom: none;
}

.transfer-list-item:hover {
  background: #f9fafb;
}

.transfer-list-item-username {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1d1d1f;
}

.transfer-confirm-content {
  padding: 1rem 0;
  text-align: center;
}

.transfer-confirm-text {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

.transfer-confirm-username {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 6px;
}

.transfer-confirm-warning {
  font-size: 0.875rem;
  color: #dc2626;
  line-height: 1.5;
  padding: 1rem;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
}

/* Collaborative toasts (separate from regular toasts) */
.collab-toasts-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 400px;
  pointer-events: none;
}

.collab-toast {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideInFromRight 0.3s ease;
  pointer-events: auto;
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.collab-toast-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.collab-toast-icon {
  font-size: 1.25rem;
}

.collab-toast-message {
  font-size: 0.875rem;
  color: #1d1d1f;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.collab-toast-message strong {
  font-weight: 600;
}

.collab-toast-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.collab-toast-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.collab-toast-btn-accept {
  background: var(--primary-600);
  color: white;
}

.collab-toast-btn-accept:hover {
  background: var(--primary-700);
}

.collab-toast-btn-decline {
  background: #f3f4f6;
  color: #1d1d1f;
}

.collab-toast-btn-decline:hover {
  background: #e5e7eb;
}

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

/* More invitations indicator */
.collab-toast-more {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .collab-modal {
    max-width: 90%;
  }

  .collab-toasts-container {
    right: 10px;
    max-width: calc(100% - 20px);
  }
}

/* ============================================================================
   SETTINGS MODALS (Edit Agents / Edit Environment)
   ============================================================================ */

/* Settings Modal - Larger than standard */
.settings-modal {
  max-width: 1050px;
  width: 95%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.settings-modal-medium {
  max-width: 700px;
}

.settings-modal-content {
  display: flex;
  gap: 1.5rem;
  flex: 1;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

/* Node Types Sidebar */
.node-types-sidebar {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.node-types-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.node-types-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
}

.add-node-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--primary-600);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.add-node-btn:hover {
  background: var(--primary-700);
}

.node-types-list {
  flex: 1;
  overflow-y: auto;
}

.node-type-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid #f3f4f6;
}

.node-type-item:hover {
  background: #f9fafb;
}

.node-type-item.selected {
  background: var(--primary-50);
  border-left: 3px solid var(--primary-600);
}

.node-type-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.node-type-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.node-type-name {
  font-size: 0.875rem;
  color: #1d1d1f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Node Editor */
.node-editor {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
}

.node-editor-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  color: #9ca3af;
  font-size: 0.875rem;
}

.node-editor-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Editor Sections */
.editor-section {
  padding-bottom: 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.editor-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.editor-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.editor-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
}

.editor-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.editor-row:last-child {
  margin-bottom: 0;
}

.editor-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.editor-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
}

.editor-input,
.editor-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.875rem;
  background: white;
  transition: border-color 0.2s;
}

.editor-input:focus,
.editor-select:focus {
  outline: none;
  border-color: var(--primary-600);
}

.editor-input[readonly] {
  background: #f9fafb;
  color: #6b7280;
}

.editor-color {
  width: 60px;
  height: 36px;
  padding: 2px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
}

.editor-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  resize: vertical;
  min-height: 60px;
}

.editor-textarea:focus {
  outline: none;
  border-color: var(--primary-600);
}

/* Parameters Table */
.params-table-container {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.params-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.params-table th {
  background: #f9fafb;
  padding: 0.5rem;
  text-align: left;
  font-weight: 500;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.params-table td {
  padding: 0.375rem;
  border-bottom: 1px solid #f3f4f6;
}

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

.params-table input,
.params-table select {
  width: 100%;
  padding: 0.375rem 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 0.8125rem;
  background: white;
}

.params-table input:focus,
.params-table select:focus {
  outline: none;
  border-color: var(--primary-600);
}

/* Column widths for params table */
.params-table th:nth-child(3),
.params-table td:nth-child(3),
.params-table th:nth-child(4),
.params-table td:nth-child(4),
.params-table th:nth-child(5),
.params-table td:nth-child(5),
.params-table th:nth-child(6),
.params-table td:nth-child(6) {
  width: 100px; /* Type, Min, Max, Default columns */
}

.params-table th:nth-child(7),
.params-table td:nth-child(7) {
  width: 30px; /* Delete button column */
}

.param-delete-btn {
  padding: 0.25rem 0.5rem;
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.param-delete-btn:hover {
  opacity: 1;
}

.remove-param-btn {
  padding: 0.25rem 0.5rem;
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.remove-param-btn:hover {
  opacity: 1;
}

.add-param-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: white;
  color: var(--primary-600);
  border: 1px solid var(--primary-600);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.add-param-btn:hover {
  background: var(--primary-50);
}

/* Script Editor */
.script-editor-container {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}

.script-editor-container .CodeMirror {
  height: 200px;
  font-size: 0.8125rem;
}

.script-editor-large .CodeMirror {
  height: 350px;
}

/* Delete Node Button */
.delete-node-btn {
  padding: 0.625rem 1rem;
  background: white;
  color: #ef4444;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.delete-node-btn:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

/* Environment Editor */
.env-editor-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  .settings-modal {
    max-width: 95%;
  }

  .settings-modal-content {
    flex-direction: column;
  }

  .node-types-sidebar {
    width: 100%;
    max-height: 150px;
  }
}

/* Fullscreen Script Editor Modal */
.fullscreen-editor-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.fullscreen-editor-overlay.active {
  display: flex;
}

.fullscreen-editor-container {
  width: 100%;
  max-width: 1200px;
  height: 90vh;
  background: #1e1e1e;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.fullscreen-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #252526;
  border-bottom: 1px solid #3c3c3c;
}

.fullscreen-editor-title {
  font-size: 14px;
  font-weight: 500;
  color: #cccccc;
}

.fullscreen-editor-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: #cccccc;
  font-size: 20px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.fullscreen-editor-close:hover {
  background: #3c3c3c;
  color: #ffffff;
}

.fullscreen-editor-body {
  flex: 1;
  overflow: hidden;
}

.fullscreen-editor-body .CodeMirror {
  height: 100%;
  font-size: 14px;
}

/* Expand button for script editors */
.script-editor-wrapper {
  position: relative;
}

.expand-editor-btn {
  position: absolute;
  top: 8px;
  right: 20px;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 4px;
  color: #cccccc;
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.expand-editor-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.expand-editor-btn img {
  width: 16px;
  height: 16px;
  filter: invert(1);
  opacity: 0.7;
}

.expand-editor-btn:hover img {
  opacity: 1;
}

/* ============================================================================
   PUBLISH MODAL
   ============================================================================ */

.publish-modal {
  max-width: 480px;
}

/* File count under title */
.publish-file-count {
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
  margin: -0.5rem 0 1rem;
}

/* File list in confirmation state */
.publish-file-list {
  margin: 0 0 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.publish-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.publish-file-item:last-child {
  border-bottom: none;
}

.publish-file-name {
  flex: 1;
  font-size: 0.875rem;
  color: #1d1d1f;
}

.publish-file-type {
  font-size: 0.75rem;
  color: #6b7280;
  padding: 0.125rem 0.5rem;
  background: #f3f4f6;
  border-radius: 4px;
}

/* Hint text under file list */
.publish-hint {
  font-size: 0.75rem;
  color: #9ca3af;
  text-align: center;
  margin: 0 0 1.5rem;
}

/* Spinner container */
.publish-spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}

.publish-spinner-container .loading-spinner {
  width: 40px;
  height: 40px;
  border-width: 3px;
  margin-bottom: 1rem;
}

.publish-spinner-text {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

/* Results list */
.publish-results-list {
  margin: 1rem 0 1.5rem;
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.publish-result-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.publish-result-item:last-child {
  border-bottom: none;
}

.publish-result-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.publish-result-icon.success {
  color: #10b981;
}

.publish-result-icon.error {
  color: #ef4444;
}

.publish-result-content {
  flex: 1;
  min-width: 0;
}

.publish-result-name {
  font-size: 0.875rem;
  color: #1d1d1f;
  font-weight: 500;
}

.publish-result-status {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.125rem;
}

.publish-result-status.error {
  color: #ef4444;
}

/* Results summary */
.publish-results-summary {
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
  margin: 0 0 1.5rem;
}

/* Modal not closable state */
.publish-modal.publishing .modal-close-btn {
  display: none;
}

/* Download button for testing exports */
.publish-download-btn {
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: var(--primary-600);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.publish-download-btn:hover {
  background: var(--primary-hover);
}
