.yt-summary-container {
  position: relative;
  background-color: #1a1b1e;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  margin: 16px 0;
  font-family: "Roboto", sans-serif;
  border: 1px solid #2c2d30;
  transition: all 0.3s ease;
  animation: fadeIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  overflow: hidden;
}

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

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

.error-message {
  background-color: rgba(220, 38, 38, 0.1);
  color: #ef4444;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid rgba(220, 38, 38, 0.2);
  animation: slideIn 0.3s ease-out;
}

.button-container {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 16px;
}

.summarize-button {
  background-color: #ef4444;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summarize-button:hover:not(:disabled) {
  background-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.summarize-button:active:not(:disabled) {
  transform: translateY(0);
}

.summarize-button:disabled {
  background-color: #374151;
  cursor: not-allowed;
  opacity: 0.7;
}

.settings-button {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 10px;
  color: #9ca3af;
  transition: all 0.2s ease;
  border-radius: 8px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-button:hover {
  background-color: rgba(156, 163, 175, 0.1);
  color: #f3f4f6;
}

.summary-header,
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #2c2d30;
}

.summary-header h3,
.settings-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #f3f4f6;
  letter-spacing: 0.5px;
}

.close-button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  color: #9ca3af;
  transition: all 0.2s ease;
  border-radius: 6px;
  line-height: 1;
}

.close-button:hover {
  color: #f3f4f6;
  background-color: rgba(156, 163, 175, 0.1);
}

.summary-content {
  flex: 1;
  overflow-y: auto;
  padding: 2px 16px;
  font-size: 15px;
  line-height: 1.6;
  color: #d1d5db;
}

/* Markdown Styles */
.summary-content > *:first-child {
  margin-top: 0 !important;
}

.summary-content > *:last-child {
  margin-bottom: 0 !important;
}

.summary-content h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 10px 0 12px;
  color: #f3f4f6;
  border-bottom: 1px solid #2c2d30;
  padding-bottom: 8px;
}

.summary-content h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 7px 0 10px;
  color: #f3f4f6;
}

.summary-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 7px 0 8px;
  color: #f3f4f6;
}

.summary-content p {
  margin: 0 0 12px;
}

.summary-content ul,
.summary-content ol {
  margin: 0 0 12px;
  padding-left: 24px;
}

.summary-content li {
  margin: 4px 0;
}

.summary-content li > p {
  margin: 0;
}

.summary-content strong {
  color: #f3f4f6;
  font-weight: 600;
}

.summary-content em {
  color: #ef4444;
  font-style: italic;
}

.summary-content blockquote {
  border-left: 4px solid #ef4444;
  margin: 12px 0;
  padding: 8px 16px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 4px;
  font-style: italic;
}

.summary-content blockquote > *:last-child {
  margin-bottom: 0;
}

.summary-content code {
  background: #2c2d30;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Menlo", "Monaco", "Courier New", monospace;
  font-size: 14px;
  color: #ef4444;
}

.summary-content pre {
  background: #2c2d30;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
}

.summary-content pre code {
  background: none;
  padding: 0;
  color: #d1d5db;
}

.summary-content a {
  color: #ef4444;
  text-decoration: none;
  border-bottom: 1px dashed #ef4444;
  transition: all 0.2s ease;
}

.summary-content a:hover {
  border-bottom-style: solid;
}

.summary-content hr {
  border: none;
  border-top: 1px solid #2c2d30;
  margin: 16px 0;
}

/* Chat Panel Styles */
.chat-panel {
  border-top: 1px solid #2c2d30;
  background: #1a1b1e;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 40vh;
  min-height: 200px;
}

.chat-messages {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  flex: 1;
}

.chat-message {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 80%;
  line-height: 1.4;
}

.user-message {
  background: #ef4444;
  color: white;
  align-self: flex-end;
  margin-left: 20%;
}

.assistant-message {
  background: #2c2d30;
  color: #d1d5db;
  align-self: flex-start;
  margin-right: 20%;
}

.chat-input-form {
  display: flex;
  gap: 8px;
  padding: 16px;
  background: #1a1b1e;
  border-top: 1px solid #2c2d30;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #2c2d30;
  border-radius: 24px;
  background: #2c2d30;
  color: #f3f4f6;
  font-size: 14px;
}

.chat-input:focus {
  outline: none;
  border-color: #ef4444;
}

.chat-submit-button {
  padding: 8px 24px;
  border: none;
  border-radius: 24px;
  background: #ef4444;
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.chat-submit-button:hover:not(:disabled) {
  background: #dc2626;
}

.chat-submit-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Settings Styles */
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.provider-option {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #d1d5db;
  background-color: #2c2d30;
  border: 1px solid transparent;
  margin-bottom: 8px;
}

.provider-option:last-child {
  margin-bottom: 0;
}

.provider-option:hover {
  background-color: #374151;
  transform: translateX(4px);
}

.provider-option.selected {
  background-color: #374151;
  color: #f3f4f6;
  font-weight: 600;
  border-color: #ef4444;
  position: relative;
}

.provider-option.selected::before {
  content: "✓";
  position: absolute;
  right: 16px;
  color: #ef4444;
}

/* Scrollbar Styles */
.summary-content::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.summary-content::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: #2c2d30;
  border-radius: 4px;
}

.summary-content::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.summary-content::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* Loading Animation */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

.summary-skeleton {
  padding: 16px;
  animation: shimmer 2s infinite linear;
  background: linear-gradient(90deg, #2c2d30 0%, #374151 50%, #2c2d30 100%);
  background-size: 200% 100%;
  border-radius: 8px;
}

.skeleton-line {
  height: 12px;
  margin-bottom: 12px;
  border-radius: 4px;
  background: #374151;
}

.skeleton-line:nth-child(2) {
  width: 95%;
}
.skeleton-line:nth-child(3) {
  width: 85%;
}
.skeleton-line:nth-child(4) {
  width: 90%;
}
.skeleton-line:nth-child(5) {
  width: 80%;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Model Selection Styles */
.settings-section {
  margin-bottom: 20px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #d1d5db;
  font-size: 14px;
}

.api-key-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #2c2d30;
  border-radius: 8px;
  font-size: 14px;
  background-color: #2c2d30;
  color: #f3f4f6;
  transition: all 0.2s ease;
  margin-bottom: 16px;
  font-family: "Menlo", "Monaco", "Courier New", monospace;
  box-sizing: border-box;
}

.api-key-input:focus {
  outline: none;
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.api-key-input::placeholder {
  color: #6b7280;
}

.select-wrapper {
  position: relative;
  width: 100%;
}

.select-wrapper::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1 3L5 7L9 3' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}

.model-select {
  width: 100%;
  padding: 8px 32px 8px 12px;
  font-size: 14px;
  line-height: 1.4;
  color: #f3f4f6;
  background-color: #2c2d30;
  border: 1px solid #4b5563;
  border-radius: 6px;
  appearance: none;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-select:hover:not(:disabled) {
  border-color: #ef4444;
  background-color: #374151;
}

.model-select:focus {
  outline: none;
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.model-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #1f2937;
}

.model-select option {
  padding: 8px;
  background-color: #1f2937;
  color: #f3f4f6;
}

/* Chat Section Styles */
.chat-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #2c2d30;
}

.chat-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px;
  color: #f3f4f6;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-message {
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 80%;
  line-height: 1.4;
}

.chat-message > div > *:last-child {
  margin-bottom: 0;
}

.chat-message > div > *:first-child {
  margin-top: 0;
}

.user-message {
  background: #ef4444;
  color: white;
  align-self: flex-end;
  margin-left: 20%;
}

.assistant-message {
  background: #2c2d30;
  color: #d1d5db;
  align-self: flex-start;
  margin-right: 20%;
}

.chat-input-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.chat-input {
  flex: 1;
  padding: 8px 16px;
  border: 1px solid #2c2d30;
  border-radius: 24px;
  background: #2c2d30;
  color: #f3f4f6;
  font-size: 14px;
}

.chat-input:focus {
  outline: none;
  border-color: #ef4444;
}

.chat-submit-button {
  padding: 8px 16px;
  border: none;
  border-radius: 24px;
  background: #ef4444;
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.chat-submit-button:hover:not(:disabled) {
  background: #dc2626;
}

.chat-submit-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-input.loading {
  color: #6b7280;
  background: #1f2937;
  cursor: wait;
}

.chat-input.loading::placeholder {
  color: #4b5563;
}

.base-url-input,
.model-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #2c2d30;
  border-radius: 8px;
  font-size: 14px;
  background-color: #2c2d30;
  color: #f3f4f6;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  font-family: "Menlo", "Monaco", "Courier New", monospace;
  box-sizing: border-box;
}

.base-url-input:focus,
.model-input:focus {
  outline: none;
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.base-url-input::placeholder,
.model-input::placeholder {
  color: #6b7280;
}

.help-text {
  font-size: 12px;
  color: #9ca3af;
  margin-top: -4px;
  margin-bottom: 16px;
  font-style: italic;
}

.popup-container {
  width: 400px;
  min-height: 300px;
  padding: 16px;
  background-color: #1f2937;
  color: #f3f4f6;
}

.popup-settings {
  width: 100%;
  height: 100%;
}

.popup-settings .settings-content {
  padding: 0;
}
