/* Presentation Component Styles */

/* Container - Perfect fit between chat header and input area */
.presentation-container {
  width: 100%;
  max-width: var(--chat-max-width, 1200px); /* Use full chat area width */
  height: calc(100vh - var(--header-height, 64px) - var(--chat-header-height, 48px) - var(--input-container-height, 70px) - 140px); /* 50px shorter: increased margin from 60px to 110px */
  min-height: 400px;
  max-height: none; /* Remove restriction for perfect fit */
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg-primary, #ffffff);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color, #e2e8f0);
  position: relative;
  margin: 8px auto; /* Small margin for visual breathing room */
}

/* Dark mode container */
.dark-mode .presentation-container {
  background-color: #1e1e2e;
  border-color: #3f3f56;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Header - Ultra compact for maximum iframe space */
.presentation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background-color: var(--color-bg-secondary, #f8f9fa);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  min-height: 40px;
  flex-shrink: 0;
}

.dark-mode .presentation-header {
  background-color: #2a2a3e;
  border-bottom-color: #3f3f56;
}

/* Header info */
.presentation-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.presentation-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color, #333333);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.presentation-title i {
  color: var(--primary-color, #4a6cf7);
}

.dark-mode .presentation-title {
  color: #ffffff;
}

.presentation-subtitle {
  font-size: 0.85rem;
  color: var(--secondary-text-color, #666666);
  margin: 0;
}

.dark-mode .presentation-subtitle {
  color: #a1a1aa;
}

/* Controls */
.presentation-controls {
  display: flex;
  gap: 0.5rem;
}

.control-button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-primary, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-color, #333333);
}

.control-button:hover {
  background-color: var(--color-bg-hover, #f1f5f9);
  border-color: var(--border-color-hover, #cbd5e0);
}

.control-button:active {
  transform: scale(0.95);
}

.dark-mode .control-button {
  background-color: #3a3a4e;
  border-color: #4f4f66;
  color: #e4e4e7;
}

.dark-mode .control-button:hover {
  background-color: #4a4a5e;
  border-color: #5f5f76;
}

/* Content area */
.presentation-content {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: var(--color-bg-primary, #ffffff);
}

.dark-mode .presentation-content {
  background-color: #1e1e2e;
}

/* iframe */
.presentation-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background-color: #ffffff;
}

/* Loading state */
.presentation-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
}

.loading-spinner {
  font-size: 2rem;
  color: var(--primary-color, #4a6cf7);
  animation: spin 1s linear infinite;
}

.presentation-loading p {
  font-size: 1rem;
  color: var(--secondary-text-color, #666666);
  margin: 0;
}

.dark-mode .presentation-loading p {
  color: #a1a1aa;
}

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

/* Error state */
.presentation-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
}

.presentation-error i {
  font-size: 3rem;
  color: #ef4444;
}

.presentation-error h4 {
  font-size: 1.25rem;
  color: var(--text-color, #333333);
  margin: 0;
}

.dark-mode .presentation-error h4 {
  color: #ffffff;
}

.presentation-error p {
  color: var(--secondary-text-color, #666666);
  margin: 0;
}

.dark-mode .presentation-error p {
  color: #a1a1aa;
}

.retry-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--primary-color, #4a6cf7);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}

.retry-button:hover {
  background-color: var(--primary-color-hover, #3b5ce6);
}

/* Status bar - Minimal for more iframe space */
.presentation-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  background-color: var(--color-bg-secondary, #f8f9fa);
  border-top: 1px solid var(--border-color, #e2e8f0);
  min-height: 32px;
  flex-shrink: 0;
}

.dark-mode .presentation-status {
  background-color: #2a2a3e;
  border-top-color: #3f3f56;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #6b7280;
  transition: background-color 0.3s ease;
}

.status-dot.status-loading {
  background-color: #f59e0b;
  animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.status-connected,
.status-dot.status-ready {
  background-color: #10b981;
}

.status-dot.status-error {
  background-color: #ef4444;
}

.status-dot.status-editing {
  background-color: #3b82f6;
}

.status-dot.status-saved {
  background-color: #10b981;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-text {
  font-size: 0.85rem;
  color: var(--secondary-text-color, #666666);
}

.dark-mode .status-text {
  color: #a1a1aa;
}

/* Fullscreen mode */
.presentation-container:fullscreen {
  height: 100vh;
  border-radius: 0;
  border: none;
}

.presentation-container:-webkit-full-screen {
  height: 100vh;
  border-radius: 0;
  border: none;
}

.presentation-container:-moz-full-screen {
  height: 100vh;
  border-radius: 0;
  border: none;
}

.presentation-container:-ms-fullscreen {
  height: 100vh;
  border-radius: 0;
  border: none;
}

/* Component message integration - Full width utilization */
.component-message .presentation-container {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color, #e2e8f0);
  margin: 0;
  width: 100%;
}

/* Override message bubble width restrictions for presentation - More specific selectors */
.message-container.component-message .message-bubble,
.message-container.agent-message.component-message .message-bubble,
div.message-container.component-message div.message-bubble {
  max-width: 100% !important;
  width: 100% !important;
  padding: 0 !important;
  background-color: transparent !important;
  overflow: visible !important;
  margin: 0 !important;
  /* Override the default message-max-width constraint */
  --message-max-width: 100% !important;
  box-shadow: none !important;
  border: none !important;
}

/* Ensure the message container itself uses full width */
.message-container.component-message,
.message-container.agent-message.component-message,
div.message-container.component-message {
  max-width: 100% !important;
  width: 100% !important;
  margin: 8px 0 !important;
  display: block !important;
}

/* Message content within component messages */
.message-container.component-message .message-content,
.message-container.agent-message.component-message .message-content {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Remove any chat area padding when presentation is active and maximize width */
.chat-messages {
  padding-left: 0 !important;
  padding-right: 0 !important;
  max-width: none !important; /* Remove any width constraints */
}

/* Ensure presentation uses full available width within chat constraints */
.message-container.component-message {
  max-width: var(--chat-max-width, 1200px) !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Force full width for the entire chat area when component is present */
#chat-area {
  max-width: 100% !important;
  width: 100% !important;
}

/* Ensure the component container itself uses full width */
.component-container {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Responsive adjustments - Perfect mobile fit */
@media (max-width: 768px) {
  .presentation-container {
    height: calc(100vh - var(--header-height, 64px) - var(--chat-header-height, 48px) - var(--input-container-height, 70px) - 100px); /* 50px shorter mobile: increased margin from 50px to 100px */
    min-height: 350px;
    max-height: none;
    border-radius: 6px;
  }
  
  .presentation-header {
    padding: 0.4rem 0.6rem;
    min-height: 36px;
  }
  
  .presentation-title {
    font-size: 0.95rem;
  }
  
  .presentation-subtitle {
    font-size: 0.75rem;
  }
  
  .control-button {
    width: 30px;
    height: 30px;
  }
  
  .presentation-status {
    padding: 0.3rem 0.6rem;
    min-height: 28px;
  }
  
  /* Mobile full width */
  .chat-messages:has(.presentation-container) {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
}

@media (max-width: 480px) {
  .presentation-container {
    height: calc(100vh - var(--header-height, 64px) - var(--chat-header-height, 48px) - var(--input-container-height, 70px) - 110px); /* 50px shorter small screen: increased margin from 60px to 110px */
    min-height: 300px;
    max-height: none;
    border-radius: 4px;
    margin: 4px auto;
  }
  
  .presentation-header {
    flex-direction: row;
    align-items: center;
    padding: 0.3rem 0.5rem;
    min-height: 32px;
  }
  
  .presentation-title {
    font-size: 0.9rem;
  }
  
  .presentation-subtitle {
    display: none; /* Hide subtitle on very small screens */
  }
  
  .control-button {
    width: 28px;
    height: 28px;
  }
  
  .presentation-status {
    padding: 0.25rem 0.5rem;
    min-height: 24px;
  }
  
  /* Ultra-minimal padding on small screens */
  .chat-messages:has(.presentation-container) {
    padding-left: 2px !important;
    padding-right: 2px !important;
  }
}

/* Animations */
.presentation-container {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Ensure iframe can receive pointer events and fills all available space */
.presentation-iframe {
  pointer-events: auto;
  display: block;
  min-height: 100%;
  object-fit: cover;
}

/* Remove any default margins/padding that might interfere */
.presentation-content * {
  box-sizing: border-box;
}

/* Optimize for maximum space utilization */
.presentation-container.maximized {
  height: calc(100vh - 100px) !important;
  min-height: 800px !important;
}

.presentation-container.maximized .presentation-header {
  min-height: 32px !important;
  padding: 0.3rem 0.5rem !important;
}

.presentation-container.maximized .presentation-status {
  min-height: 24px !important;
  padding: 0.2rem 0.5rem !important;
}

/* Prevent selection of UI elements */
.presentation-header,
.presentation-status {
  user-select: none;
}

/* Focus states for accessibility */
.control-button:focus,
.retry-button:focus {
  outline: 2px solid var(--primary-color, #4a6cf7);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .presentation-container {
    border-width: 2px;
  }
  
  .control-button {
    border-width: 2px;
  }
}

/* Print styles */
@media print {
  .presentation-controls,
  .presentation-status {
    display: none;
  }
  
  .presentation-container {
    box-shadow: none;
    border: 1px solid #000;
  }
} 