/* Encryption Setup Message Component - Interactive E2EE setup in chat */
/* Following Cookbook Domain-Driven OOP pattern */

.encryption-setup-message {
  display: block;
  margin: 0.75rem 0; /* More condensed */
  padding: 1.25rem; /* More condensed */
  border-radius: 16px;
  background: linear-gradient(135deg, #00091E 0%, rgba(85, 93, 255, 0.08) 100%);
  border: 2px solid rgba(85, 93, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: translateY(10px);
  position: relative;
  overflow: visible; /* Changed from hidden to visible */
  min-height: auto; /* Ensure no height constraints */
  width: 100%;
  box-sizing: border-box;
}

.encryption-setup-message.visible {
  opacity: 1;
  transform: translateY(0);
}

.encryption-setup-message.transitioning {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.encryption-setup-message::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #555DFF, #444DEE);
  border-radius: 16px 16px 0 0;
}

/* State-specific styles */
.encryption-setup-message.encryption-setup-idle::before {
  background: linear-gradient(90deg, #555DFF, #444DEE);
}

.encryption-setup-message.encryption-setup-processing::before {
  background: linear-gradient(90deg, #FFA726, #FB8C00);
}

.encryption-setup-message.encryption-setup-success::before {
  background: linear-gradient(90deg, #00B894, #00A085);
}

.encryption-setup-message.encryption-setup-error::before {
  background: linear-gradient(90deg, #FF5558, #E64C4F);
}

/* Header section */
.encryption-setup-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.encryption-setup-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.encryption-setup-message.encryption-setup-idle .encryption-setup-icon {
  background: #e3f2fd;
  color: #1976d2;
}

.encryption-setup-message.encryption-setup-processing .encryption-setup-icon {
  background: #fff3e0;
  color: #f57c00;
}

.encryption-setup-message.encryption-setup-success .encryption-setup-icon {
  background: #e8f5e8;
  color: #388e3c;
}

.encryption-setup-message.encryption-setup-error .encryption-setup-icon {
  background: #ffebee;
  color: #d32f2f;
}

.encryption-setup-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
  flex: 1;
}

/* Description */
.encryption-setup-description {
  font-size: 0.95rem;
  color: #666;
  line-height: 1.5;
  margin-bottom: 1rem;
}

/* Benefits section */
.encryption-setup-benefits {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 480px) {
  .encryption-setup-benefits {
    grid-template-columns: 1fr 1fr;
  }
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #555;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.benefit-item i {
  color: #2196f3;
  width: 16px;
  flex-shrink: 0;
}

/* Progress bar for processing state */
.encryption-setup-progress {
  margin: 1rem 0;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #FFA726, #FB8C00);
  border-radius: 3px;
  animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% { width: 30%; }
  50% { width: 70%; }
}

/* Status section for success state */
.encryption-setup-status {
  margin-top: 1rem;
}

.encryption-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #e8f5e8;
  border: 1px solid #c8e6c9;
  border-radius: 20px;
  font-size: 0.9rem;
  color: #2e7d32;
  font-weight: 500;
}

.encryption-status-indicator i {
  color: #4caf50;
}

/* Status indicator variants */
.encryption-status-indicator.encryption-status-secure {
  background: #e8f5e8;
  border-color: #c8e6c9;
  color: #2e7d32;
}

.encryption-status-indicator.encryption-status-secure i {
  color: #4caf50;
}

/* Actions section */
.encryption-setup-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
}

/* Button styles */
.encryption-setup-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 25px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  min-width: 140px;
  justify-content: center;
}

.encryption-setup-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.encryption-setup-btn:active:not(:disabled) {
  transform: translateY(0);
}

.encryption-setup-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.encryption-setup-btn-primary {
  background: linear-gradient(135deg, #555DFF, #444DEE);
  color: white;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.encryption-setup-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #555DFF, #444DEE);
  box-shadow: 0 4px 16px rgba(33, 150, 243, 0.4);
}

.encryption-setup-btn-secondary {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.encryption-setup-btn-secondary:hover:not(:disabled) {
  background: #e8e8e8;
  border-color: #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Notification styles */
.encryption-setup-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #2196f3;
  z-index: 1000;
  max-width: 300px;
  animation: slideIn 0.3s ease-out;
}

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

.encryption-setup-notification.success {
  border-left-color: #4caf50;
}

.encryption-setup-notification.error {
  border-left-color: #f44336;
}

.encryption-setup-notification.warning {
  border-left-color: #ff9800;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .encryption-setup-message {
    margin: 0.75rem 0;
    padding: 1rem;
  }

  .encryption-setup-header {
    margin-bottom: 0.75rem;
  }

  .encryption-setup-icon {
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
  }

  .encryption-setup-title {
    font-size: 1rem;
  }

  .encryption-setup-description {
    font-size: 0.9rem;
  }

  .benefit-item {
    font-size: 0.85rem;
    padding: 0.4rem;
  }

  .encryption-setup-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    min-width: 120px;
  }

  .encryption-setup-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .encryption-setup-actions .encryption-setup-btn {
    width: 100%;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .encryption-setup-message {
    background: linear-gradient(135deg, #555DFF 0%, #00091E 100%);
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .encryption-setup-description {
    color: #a0aec0;
  }

  .benefit-item {
    background: rgba(85, 93, 255, 0.1);
    border-color: rgba(85, 93, 255, 0.2);
    color: #cbd5e0;
  }

  .encryption-setup-btn-secondary {
    background: #4a5568;
    color: #e2e8f0;
    border-color: #718096;
  }

  .encryption-setup-btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #00091E 0%, rgba(85, 93, 255, 0.03) 100%);
    border-color: #a0aec0;
  }
}

/* Accessibility improvements */
.encryption-setup-message:focus-within {
  outline: 2px solid #2196f3;
  outline-offset: 2px;
}

.encryption-setup-btn:focus {
  outline: 2px solid #2196f3;
  outline-offset: 2px;
}

/* Specific styles for private chat messages area */
.private-chat-messages-area .encryption-setup-message {
  margin: 1rem 0;
  width: calc(100% - 32px); /* Account for padding */
  flex-shrink: 0; /* Prevent flex shrinking */
}

/* Ensure proper display in chat context */
.encryption-setup-message.encryption-setup-idle,
.encryption-setup-message.encryption-setup-processing,
.encryption-setup-message.encryption-setup-success,
.encryption-setup-message.encryption-setup-error {
  display: block !important;
  visibility: visible !important;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .encryption-setup-message,
  .encryption-setup-btn,
  .progress-fill {
    transition: none;
    animation: none;
  }

  .encryption-setup-message.visible {
    opacity: 1;
    transform: none;
  }
}
