/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
}

/* Navigation */
.navbar {
  background-color: #fff;
  border-bottom: 1px solid #e9ecef;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.nav-brand {
  font-size: 24px;
  font-weight: bold;
  color: #007bff;
  text-decoration: none;
}

.nav-brand:hover {
  color: #0056b3;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  color: #666;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
  transition: all 0.2s;
}

.nav-link:hover {
  color: #007bff;
  background-color: #f8f9fa;
}

.nav-link-primary {
  background-color: #007bff;
  color: white;
}

.nav-link-primary:hover {
  background-color: #0056b3;
  color: white;
}

.nav-user {
  color: #666;
  font-weight: 500;
}

/* Main content */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: calc(100vh - 60px);
}

/* Flash messages */
.flash {
  padding: 12px 20px;
  margin-bottom: 20px;
  border-radius: 4px;
  font-weight: 500;
}

.flash-notice {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flash-alert {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Forms */
.form-container {
  max-width: 400px;
  margin: 40px auto;
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-title {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #555;
}

.form-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.form-submit {
  width: 100%;
  padding: 12px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.form-submit:hover {
  background-color: #0056b3;
}

.form-link {
  display: block;
  text-align: center;
  margin-top: 20px;
  color: #007bff;
  text-decoration: none;
}

.form-link:hover {
  text-decoration: underline;
}

/* Error messages */
.field-error {
  color: #dc3545;
  font-size: 14px;
  margin-top: 5px;
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  padding: 30px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 24px;
  margin-bottom: 20px;
  color: #333;
}

.card-content {
  color: #666;
  line-height: 1.6;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary {
  background-color: #007bff;
  color: white;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #545b62;
}

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

.btn-danger:hover {
  background-color: #c82333;
}

/* Homepage */
.hero {
  text-align: center;
  padding: 80px 20px;
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  border-radius: 8px;
  margin-bottom: 40px;
}

.hero h1 {
  font-size: 48px;
  margin-bottom: 20px;
}

.hero p {
  font-size: 20px;
  margin-bottom: 30px;
  opacity: 0.9;
}

.hero-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-buttons .btn {
  padding: 15px 30px;
  font-size: 18px;
  background-color: white;
  color: #007bff;
  border: 2px solid white;
}

.hero-buttons .btn:hover {
  background-color: transparent;
  color: white;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    height: auto;
    padding: 15px 20px;
  }
  
  .nav-links {
    margin-top: 15px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .hero h1 {
    font-size: 36px;
  }
  
  .hero p {
    font-size: 18px;
  }
  
  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .form-container {
    margin: 20px;
    padding: 30px 20px;
  }
}

/* Feed Styles */
.feeds-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.feed-item {
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 20px;
  transition: box-shadow 0.2s ease;
}

.feed-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.feed-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
}

.feed-link {
  color: #333;
  text-decoration: none;
}

.feed-link:hover {
  color: #007bff;
}

.feed-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.feed-date {
  color: #666;
  font-size: 14px;
}

.feed-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
  font-size: 14px;
  color: #666;
}

.feed-description {
  margin-bottom: 15px;
}

.feed-description p {
  margin-bottom: 10px;
  line-height: 1.5;
}

.feed-url {
  color: #666;
  font-size: 14px;
  word-break: break-all;
}

.feed-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* Feed Group Styles */
.groups-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.group-item {
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 20px;
  transition: box-shadow 0.2s ease;
}

.group-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.group-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
}

.group-link {
  color: #333;
  text-decoration: none;
}

.group-link:hover {
  color: #007bff;
}

.group-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.group-type {
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

.group-date {
  color: #666;
  font-size: 14px;
}

.group-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
  font-size: 14px;
  color: #666;
}

.group-description {
  margin-bottom: 15px;
}

.group-description p {
  margin-bottom: 10px;
  line-height: 1.5;
}

.group-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* Pagination Styles */
.pagination-wrapper {
  margin-top: 30px;
  display: flex;
  justify-content: center;
}

.pagination {
  display: flex;
  list-style: none;
  gap: 10px;
  align-items: center;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid #e1e5e9;
  border-radius: 4px;
  color: #007bff;
  text-decoration: none;
  transition: all 0.2s;
}

.pagination a:hover {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

.pagination .current {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

.pagination .disabled {
  color: #999;
  cursor: not-allowed;
}

.feed-meta {
  color: #666;
}

.feed-url {
  margin: 5px 0;
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
}

.feed-description {
  margin: 10px 0;
  line-height: 1.5;
}

.feed-stats {
  margin: 15px 0 0 0;
  font-size: 12px;
  display: flex;
  gap: 15px;
}

.post-count {
  font-weight: 600;
}

.last-checked {
  color: #999;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.empty-state h3 {
  margin-bottom: 15px;
  color: #333;
}

/* Post Styles */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.post-item {
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 20px;
  transition: box-shadow 0.2s ease;
}

.post-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.post-header {
  margin-bottom: 15px;
}

.post-title {
  margin: 0 0 10px 0;
  font-size: 18px;
  line-height: 1.4;
}

.post-title a {
  color: #333;
  text-decoration: none;
}

.post-title a:hover {
  color: #007bff;
}

.post-meta {
  display: flex;
  gap: 15px;
  font-size: 14px;
  color: #666;
}

.post-author {
  font-weight: 500;
}

.post-content {
  margin: 15px 0;
  line-height: 1.6;
  color: #444;
}

.post-actions {
  margin-top: 15px;
}

/* Button Sizes */
.btn-sm {
  padding: 6px 12px;
  font-size: 14px;
}

/* Feed Group Styles */
.nav-tabs {
  display: flex;
  gap: 10px;
  border-bottom: 2px solid #e1e5e9;
  margin-bottom: 20px;
}

.nav-tab {
  padding: 10px 20px;
  text-decoration: none;
  color: #666;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.nav-tab:hover,
.nav-tab.active {
  color: #007bff;
  border-bottom-color: #007bff;
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.group-card {
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 20px;
  transition: box-shadow 0.2s ease;
}

.group-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.group-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
}

.group-link {
  color: #333;
  text-decoration: none;
}

.group-link:hover {
  color: #007bff;
}

.group-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.group-meta {
  color: #666;
}

.group-description {
  margin: 10px 0;
  line-height: 1.5;
  color: #444;
}

.group-stats {
  margin: 15px 0 0 0;
  font-size: 12px;
  display: flex;
  gap: 15px;
}

.feed-count {
  font-weight: 600;
}

.latest-post {
  color: #999;
}

/* Button Secondary Style */
.btn-secondary {
  background: #6c757d;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.2s ease;
}

.btn-secondary:hover {
  background: #5a6268;
  color: white;
}

/* Feed Status Styles */
.feed-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.feed-status-active {
  background: #d4edda;
  color: #155724;
}

.feed-status-failing {
  background: #fff3cd;
  color: #856404;
}

.feed-status-failed {
  background: #f8d7da;
  color: #721c24;
}

.last-failure {
  color: #dc3545;
  font-size: 12px;
}

/* Chat Styles */
.chat-container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  padding: 20px 30px;
  border-radius: 12px 12px 0 0;
}

.chat-header h1 {
  margin: 0 0 10px 0;
  font-size: 24px;
  font-weight: 600;
}

.chat-context {
  opacity: 0.9;
  font-size: 14px;
}

.chat-context strong {
  font-weight: 600;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 30px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  animation: messageSlideIn 0.3s ease-out;
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
}

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

.message-user {
  align-self: flex-end;
}

.message-llm {
  align-self: flex-start;
}

.message-system {
  align-self: flex-start;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: #666;
}

.message-user .message-header {
  flex-direction: row-reverse;
}

.sender-name {
  font-weight: 600;
  color: #333;
}

.message-time {
  opacity: 0.7;
}

.message-content {
  background: white;
  padding: 16px 20px;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  line-height: 1.5;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.message-user .message-content {
  background: #007bff;
  color: white;
  border-radius: 18px 18px 4px 18px;
}

.message-llm .message-content {
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 18px 18px 18px 4px;
}

.message-system .message-content {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  text-align: left;
  font-style: normal;
  color: #444;
}

.chat-input-container {
  padding: 20px 30px;
  background: white;
  border-top: 1px solid #e1e5e9;
  border-radius: 0 0 12px 12px;
}

.chat-form {
  display: flex;
  gap: 15px;
  align-items: flex-end;
}

       .chat-input {
         flex: 1;
         min-height: 44px;
         max-height: 120px;
         padding: 12px 16px;
         border: 2px solid #e1e5e9;
         border-radius: 22px;
         font-size: 16px;
         font-family: inherit;
         resize: none;
         transition: border-color 0.2s ease, height 0.2s ease;
         background: #f8f9fa;
         line-height: 1.4;
         overflow-y: hidden;
         box-sizing: border-box;
       }

       .chat-input:focus {
         outline: none;
         border-color: #007bff;
         background: white;
         box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
       }

       .chat-input[style*="overflow-y: auto"] {
         border-radius: 12px 12px 12px 12px;
       }

       .chat-input[style*="overflow-y: auto"]:focus {
         box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1), 0 2px 8px rgba(0, 0, 0, 0.1);
       }

.chat-send-btn {
  padding: 12px 24px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 22px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chat-send-btn:hover {
  background: #0056b3;
  transform: translateY(-1px);
}

.chat-send-btn:active {
  transform: translateY(0);
}

.chat-send-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 18px 18px 18px 4px;
  align-self: flex-start;
  margin-bottom: 10px;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #666;
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingDot {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Responsive Feed Design */
@media (max-width: 768px) {
  .feeds-grid,
  .groups-grid {
    grid-template-columns: 1fr;
  }

  .feed-header,
  .group-header {
    flex-direction: column;
    align-items: stretch;
  }

  .feed-actions,
  .group-actions {
    margin-top: 15px;
    justify-content: flex-start;
  }

  /* Chat responsive */
  .chat-container {
    height: calc(100vh - 100px);
    margin: 10px;
    border-radius: 8px;
  }

  .chat-header {
    padding: 15px 20px;
  }

  .chat-header h1 {
    font-size: 20px;
  }

  .chat-messages {
    padding: 15px 20px;
  }

  .chat-input-container {
    padding: 15px 20px;
  }

  .chat-form {
    gap: 10px;
  }

  .chat-send-btn {
    padding: 12px 20px;
    font-size: 14px;
  }
}

/* Conversations List Styles */
.conversations-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.conversation-item {
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 20px;
  transition: box-shadow 0.2s ease;
}

.conversation-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.conversation-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
}

.conversation-link {
  color: #333;
  text-decoration: none;
}

.conversation-link:hover {
  color: #007bff;
}

.conversation-meta {
  display: flex;
  gap: 15px;
  font-size: 14px;
  color: #666;
}

.conversation-type {
  font-weight: 500;
  text-transform: capitalize;
}

.conversation-date {
  opacity: 0.8;
}

.conversation-stats {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
}

.message-count {
  font-weight: 600;
}

.last-message {
  opacity: 0.8;
}

.conversation-actions {
  display: flex;
  justify-content: flex-end;
}

/* Responsive Conversations */
@media (max-width: 768px) {
  .conversation-header {
    flex-direction: column;
    align-items: stretch;
  }

  .conversation-meta {
    margin-top: 10px;
    justify-content: space-between;
  }

  .conversation-actions {
    justify-content: flex-start;
    margin-top: 15px;
  }
}

/* Bluesky Post Styles */
.bluesky-post-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.bluesky-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.bluesky-indicator-reply {
  background-color: #fef3c7;
  color: #92400e;
}

.bluesky-indicator-images {
  background-color: #d1fae5;
  color: #065f46;
}

.bluesky-indicator-external {
  background-color: #dbeafe;
  color: #1e40af;
}

.bluesky-indicator-quote {
  background-color: #e9d5ff;
  color: #6b21a8;
}

.bluesky-engagement-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: #6b7280;
}

.bluesky-embed-preview {
  margin: 16px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.bluesky-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding: 12px;
}

.bluesky-image-container {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: #f3f4f6;
}

.bluesky-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.bluesky-image:hover {
  transform: scale(1.02);
}

.bluesky-image-alt {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: white;
  padding: 8px;
  font-size: 11px;
  line-height: 1.3;
}

.bluesky-external-preview {
  padding: 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.bluesky-external-title {
  font-weight: 600;
  color: #111827;
  margin-bottom: 8px;
  line-height: 1.4;
}

.bluesky-external-description {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.bluesky-external-url {
  color: #3b82f6;
  font-size: 12px;
  text-decoration: none;
  word-break: break-all;
}

.bluesky-external-url:hover {
  text-decoration: underline;
}

.bluesky-quote-preview {
  border-left: 4px solid #8b5cf6;
  background: #faf5ff;
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  color: #6b21a8;
}

.bluesky-author-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 12px;
  color: #374151;
  font-weight: 500;
}

/* Responsive Bluesky Styles */
@media (max-width: 768px) {
  .bluesky-post-indicators {
    gap: 6px;
  }
  
  .bluesky-indicator {
    font-size: 10px;
    padding: 3px 6px;
  }
  
  .bluesky-images-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
    padding: 8px;
  }
  
  .bluesky-engagement-stats {
    gap: 8px;
    font-size: 11px;
  }
}
