/**
 * @file
 * Corporate-themed WebSocket styles for YT to Article module.
 * Professional, clean design matching the agent_corpo corporate aesthetic.
 */

/* CSS Variables for corporate theming */
:root {
  --corp-primary: #2c5282;
  --corp-primary-light: #4a7db7;
  --corp-primary-dark: #1a365d;
  --corp-success: #38a169;
  --corp-warning: #d69e2e;
  --corp-error: #e53e3e;
  --corp-gray-100: #f7fafc;
  --corp-gray-200: #edf2f7;
  --corp-gray-300: #e2e8f0;
  --corp-gray-400: #cbd5e0;
  --corp-gray-500: #a0aec0;
  --corp-gray-600: #718096;
  --corp-gray-700: #4a5568;
  --corp-gray-800: #2d3748;
  --corp-gray-900: #1a202c;
  --corp-border-radius: 6px;
  --corp-transition: all 0.2s ease;
}

/* Progress Wrapper - Main Container */
.yt-to-article-progress-wrapper {
  background: #ffffff;
  border: 1px solid var(--corp-gray-300);
  border-radius: var(--corp-border-radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: var(--corp-transition);
}

.yt-to-article-progress-wrapper:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Hide separate connection status (integrated into messages) */
.yt-to-article-connection-status {
  display: none;
}

/* Progress Container */
.yt-to-article-progress {
  margin-bottom: 1.5rem;
}

.yt-to-article-progress-container {
  width: 100%;
  height: 24px;
  background: var(--corp-gray-200);
  border: 1px solid var(--corp-gray-300);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

/* Progress Bar */
.yt-to-article-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--corp-primary), var(--corp-primary-light));
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

/* Subtle shine effect */
.yt-to-article-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.1) 100%);
  border-radius: 12px 12px 0 0;
}

/* Progress Text */
.yt-to-article-progress-text {
  text-align: center;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--corp-gray-700);
  letter-spacing: 0.025em;
}

/* Messages Container */
.yt-to-article-messages-container {
  margin-top: 1.5rem;
}

.yt-to-article-messages {
  background: var(--corp-gray-100);
  border: 1px solid var(--corp-gray-300);
  border-radius: var(--corp-border-radius);
  padding: 1rem;
  height: 320px;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.875rem;
  line-height: 1.6;
  position: relative;
}

/* Messages header label */
.yt-to-article-messages::before {
  content: 'GENERATE STATUS MESSAGES';
  position: absolute;
  top: 15px;
  left: 1rem;
  background: var(--corp-gray-100);
  padding: 0 0.5rem;
  color: var(--corp-gray-600);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* Message Wrapper */
.yt-to-article-messages .messages__wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

/* Individual Messages */
.yt-to-article-message {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: white;
  border-left: 3px solid var(--corp-gray-400);
  border-radius: 4px;
  transition: var(--corp-transition);
  opacity: 0;
  animation: messageSlideIn 0.3s ease forwards;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.yt-to-article-message:hover {
  background: var(--corp-gray-50);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateX(2px);
}

/* Message Timestamps */
.yt-to-article-message-time {
  color: var(--corp-gray-500);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  min-width: 75px;
  font-family: 'Courier New', Courier, monospace;
}

/* Message Text */
.yt-to-article-message-text {
  flex: 1;
  color: var(--corp-gray-800);
  word-break: break-word;
}

/* Status-specific message styles */
.yt-to-article-message--status {
  border-left-color: var(--corp-primary);
  background: linear-gradient(90deg, rgba(44, 82, 130, 0.03) 0%, white 100%);
}

.yt-to-article-message--status .yt-to-article-message-text {
  color: var(--corp-primary-dark);
}

.yt-to-article-message--warning {
  border-left-color: var(--corp-warning);
  background: linear-gradient(90deg, rgba(214, 158, 46, 0.05) 0%, white 100%);
}

.yt-to-article-message--warning .yt-to-article-message-text {
  color: #975a16;
}

.yt-to-article-message--error {
  border-left-color: var(--corp-error);
  background: linear-gradient(90deg, rgba(229, 62, 62, 0.05) 0%, white 100%);
}

.yt-to-article-message--error .yt-to-article-message-text {
  color: #c53030;
  font-weight: 600;
}

/* Special stage messages */
.yt-to-article-message[data-message-stage="connected"] {
  border-left-color: var(--corp-success);
  background: linear-gradient(90deg, rgba(56, 161, 105, 0.05) 0%, white 100%);
}

.yt-to-article-message[data-message-stage="connected"] .yt-to-article-message-text {
  color: #22543d;
  font-weight: 600;
}

.yt-to-article-message[data-message-stage="finished"] {
  border-left-color: var(--corp-success);
  background: linear-gradient(90deg, rgba(56, 161, 105, 0.08) 0%, rgba(56, 161, 105, 0.02) 100%);
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(56, 161, 105, 0.2);
}

.yt-to-article-message[data-message-stage="finished"] .yt-to-article-message-text {
  color: #22543d;
}

/* Custom Scrollbar */
.yt-to-article-messages::-webkit-scrollbar {
  width: 8px;
}

.yt-to-article-messages::-webkit-scrollbar-track {
  background: var(--corp-gray-200);
  border-radius: 4px;
}

.yt-to-article-messages::-webkit-scrollbar-thumb {
  background: var(--corp-gray-400);
  border-radius: 4px;
  transition: background 0.2s;
}

.yt-to-article-messages::-webkit-scrollbar-thumb:hover {
  background: var(--corp-gray-500);
}

/* Actions Container */
.yt-to-article-actions {
  margin-top: 1.25rem;
  text-align: center;
}

.yt-to-article-actions .button {
  display: inline-block;
  padding: 0.625rem 1.5rem;
  background: var(--corp-primary);
  color: white;
  text-decoration: none;
  border-radius: var(--corp-border-radius);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.025em;
  transition: var(--corp-transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.yt-to-article-actions .button:hover {
  background: var(--corp-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.yt-to-article-actions .button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Loading state */
.yt-to-article-loading {
  color: var(--corp-gray-600);
  font-size: 0.875rem;
  font-style: italic;
}

.yt-to-article-loading::before {
  content: '⟳ ';
  display: inline-block;
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Submit button states */
.yt-to-article-submit {
  background: var(--corp-primary);
  color: white;
  padding: 0.75rem 2rem;
  border: none;
  border-radius: var(--corp-border-radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--corp-transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.yt-to-article-submit:hover:not(:disabled) {
  background: var(--corp-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.yt-to-article-submit:disabled {
  background: var(--corp-gray-400);
  cursor: not-allowed;
  opacity: 0.7;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .yt-to-article-progress-wrapper {
    padding: 1rem;
    margin: 1rem 0;
  }

  .yt-to-article-messages {
    height: 250px;
    font-size: 0.8125rem;
    padding: 0.75rem;
  }

  .yt-to-article-message {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .yt-to-article-message-time {
    font-size: 0.7rem;
    min-width: 65px;
  }

  .yt-to-article-message-text {
    font-size: 0.8125rem;
  }

  .yt-to-article-progress-text {
    font-size: 0.8125rem;
  }

  .yt-to-article-actions .button {
    padding: 0.5rem 1.25rem;
    font-size: 0.8125rem;
  }

  .yt-to-article-submit {
    padding: 0.625rem 1.5rem;
    font-size: 0.9375rem;
    width: 100%;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .yt-to-article-messages {
    height: 200px;
    font-size: 0.75rem;
  }

  .yt-to-article-message-time {
    display: none; /* Hide timestamps on very small screens */
  }

  .yt-to-article-message {
    padding: 0.375rem 0.5rem;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .yt-to-article-messages {
    /* Smoother scrolling on touch devices */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  .yt-to-article-actions .button {
    /* Larger touch targets */
    padding: 0.75rem 1.75rem;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .yt-to-article-message {
    border: 1px solid var(--corp-gray-600);
  }

  .yt-to-article-progress-bar {
    background: var(--corp-primary-dark);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .yt-to-article-message,
  .yt-to-article-submit,
  .yt-to-article-actions .button {
    animation: none;
    transition: none;
  }
}

/* Print styles */
@media print {
  .yt-to-article-progress-wrapper {
    box-shadow: none;
    border: 1px solid #000;
  }

  .yt-to-article-messages {
    height: auto;
    max-height: none;
  }
}
