/*
 * 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.
 */

/* App shell */
:root {
  --app-bg: #f5f5f7;
  --app-panel: #ffffff;
  --app-text: #111827;
  --app-muted: #6b7280;
  --app-border: #e5e7eb;
  --app-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  --app-radius: 12px;
  --app-sidebar: #f7f7f8;
  --app-sidebar-muted: #6b7280;
  --app-sidebar-active: #111827;
  --app-accent: #3b82f6;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  color: var(--app-text);
  margin: 0;
  background-color: var(--app-bg);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 240px;
  background-color: var(--app-sidebar);
  color: var(--app-text);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--app-border);
}

.app-brand-link {
  color: var(--app-text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.app-brand-logo {
  width: 150px;
  height: auto;
  display: block;
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-nav-section {
  margin: 16px 0 4px 0;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--app-sidebar-muted);
}

.app-nav-link {
  color: var(--app-text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.app-nav-link:hover {
  background-color: #eceff3;
}

.app-nav-link.is-active {
  background-color: #e5e7eb;
  color: var(--app-sidebar-active);
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-main {
  flex: 1;
  padding: 32px 40px 48px 40px;
}

.app-main-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.app-breadcrumb {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 18px 0;
  border-bottom: 1px solid var(--app-border);
  margin-bottom: 24px;
}

.breadcrumb-left {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--app-text);
  font-weight: 600;
}

.breadcrumb-icon {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  background-color: var(--app-panel);
  font-size: 0.9em;
}

.breadcrumb-divider {
  color: #c7cad1;
}

.breadcrumb-text {
  font-size: 1.05em;
}

/* General styling */
h1 {
  color: var(--app-text);
  border: none;
  padding-bottom: 0;
  margin-bottom: 24px;
  font-size: 1.8em;
  font-weight: 600;
}

/* Table styling for index pages */
.index-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--app-panel);
  box-shadow: var(--app-shadow);
  border-radius: var(--app-radius);
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid var(--app-border);
}

.index-table th {
  background-color: #f3f4f6;
  color: var(--app-muted);
  padding: 15px;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75em;
  letter-spacing: 0.08em;
}

.index-table td {
  padding: 15px;
  border-bottom: 1px solid var(--app-border);
  vertical-align: top;
}

/* Zebra striping */
.index-table tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}

.index-table tbody tr:hover {
  background-color: #e3f2fd;
  transition: background-color 0.2s ease;
}

/* Result text styling for answers */
.result-text {
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-text:hover {
  white-space: normal;
  overflow: visible;
}

/* Action buttons */
.btn {
  display: inline-block;
  padding: 8px 16px;
  margin: 4px 2px;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.9em;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: #3498db;
  color: white;
}

.btn-primary:hover {
  background-color: #2980b9;
}

.btn-success {
  background-color: #27ae60;
  color: white;
}

.btn-success:hover {
  background-color: #229954;
}

/* Rank badge styling */
.rank-badge {
  background-color: #3498db;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 600;
  display: inline-block;
  min-width: 20px;
  text-align: center;
}

/* Timestamp styling */
.timestamp {
  color: #7f8c8d;
  font-size: 0.9em;
}

/* Show page styling */
.show-container {
  max-width: 800px;
  margin: 0 auto;
  background-color: var(--app-panel);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  overflow: hidden;
  border: 1px solid var(--app-border);
}

.show-header {
  background-color: #34495e;
  color: white;
  padding: 20px;
}

.show-header h1 {
  margin: 0;
  border: none;
  padding: 0;
  color: white;
}

.show-content {
  padding: 20px;
}

.detail-row {
  display: flex;
  margin-bottom: 15px;
  border-bottom: 1px solid #ecf0f1;
  padding-bottom: 15px;
}

.detail-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.detail-label {
  font-weight: 600;
  color: #2c3e50;
  min-width: 120px;
  margin-right: 20px;
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 0.5px;
}

.detail-value {
  flex: 1;
  color: #34495e;
  line-height: 1.6;
}

.result-content {
  background-color: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  border-left: 4px solid #3498db;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.9em;
  line-height: 1.5;
}

.actions-bar {
  background-color: #f8f9fa;
  padding: 20px;
  border-top: 1px solid #ecf0f1;
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-secondary {
  background-color: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background-color: #7f8c8d;
}

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

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

.btn-warning {
  background-color: #f39c12;
  color: white;
}

.btn-warning:hover {
  background-color: #e67e22;
}

/* Related items section */
.related-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid #ecf0f1;
}

.related-section h3 {
  color: #2c3e50;
  margin-bottom: 15px;
}

.related-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
}

.related-item {
  background-color: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  border: 1px solid #ecf0f1;
}

.related-item:hover {
  background-color: #e3f2fd;
  transition: background-color 0.2s ease;
}

/* Dashboard styling */
.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
}

.dashboard-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 40px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.dashboard-header h1 {
  margin: 0;
  font-size: 2.5em;
  font-weight: 600;
  border: none;
  padding: 0;
  color: white;
}

.subtitle {
  font-size: 1.2em;
  opacity: 0.9;
  margin: 10px 0 0 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  padding: 0 20px;
}

.dashboard-card {
  background: var(--app-panel);
  border-radius: var(--app-radius);
  padding: 30px;
  box-shadow: var(--app-shadow);
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--app-border);
  /* Use flex to keep actions aligned at the bottom regardless of content */
  display: flex;
  flex-direction: column;
}

.dashboard-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-icon {
  font-size: 3em;
  margin-bottom: 15px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-content h2 {
  font-size: 3em;
  font-weight: 700;
  margin: 0;
  color: #2c3e50;
  line-height: 1;
}

/* Ensure title/description align whether or not a number exists */
.card-content {
  display: grid;
  grid-template-rows: 48px auto auto; /* reserve space for the optional number */
}

.card-content > h2 { grid-row: 1; }
.card-content > h3 { grid-row: 2; }
.card-content > p  { grid-row: 3; }

.card-content h3 {
  font-size: 1.4em;
  font-weight: 600;
  color: #34495e;
  margin: 10px 0 5px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-content p {
  color: #7f8c8d;
  margin: 0 0 20px 0;
  font-size: 0.95em;
}

.card-actions {
  /* Push actions to the bottom; maintain breathing room above */
  margin-top: auto;
  padding-top: 20px;
}

.card-actions .btn {
  padding: 12px 24px;
  font-size: 1em;
  font-weight: 600;
  width: 100%;
  max-width: 200px;
}

/* Color variations for different cards */
.dashboard-card:nth-child(1) .card-content h2 {
  color: #3498db;
}

.dashboard-card:nth-child(2) .card-content h2 {
  color: #27ae60;
}

.dashboard-card:nth-child(3) .card-content h2 {
  color: #e74c3c;
}

.dashboard-card:nth-child(1):hover {
  border-color: #3498db;
}

.dashboard-card:nth-child(2):hover {
  border-color: #27ae60;
}

.dashboard-card:nth-child(3):hover {
  border-color: #e74c3c;
}

/* Filter bar styling */
.filter-bar {
  background-color: var(--app-panel);
  padding: 20px;
  margin-bottom: 20px;
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  border: 1px solid var(--app-border);
}

.filter-form {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 320px;
  min-width: 0;
}

.filter-label {
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
  white-space: nowrap;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  background-color: white;
  font-size: 0.9em;
  min-width: 0;
  width: 100%;
}

.filter-select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.filter-search {
  padding: 8px 12px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  background-color: white;
  font-size: 0.9em;
  min-width: 200px;
  margin-right: 10px;
}

.filter-search:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background-color: #e3f2fd;
  border: 1px solid #3498db;
  border-radius: 4px;
  color: #2c3e50;
  font-size: 0.85em;
  margin-right: 8px;
  margin-bottom: 4px;
}

.brand-link {
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.brand-link:hover {
  color: #2980b9;
  text-decoration: underline;
}

.filter-active {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background-color: #e3f2fd;
  border: 1px solid #3498db;
  border-radius: 4px;
  color: #2c3e50;
  font-size: 0.9em;
}

.btn-small {
  padding: 4px 8px;
  font-size: 0.8em;
}

.results-info {
  margin: 15px 0 20px 0;
  color: #7f8c8d;
  font-size: 0.9em;
  font-style: italic;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 16px 0 20px 0;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--app-border);
  background: var(--app-panel);
  color: var(--app-text);
  text-decoration: none;
  font-size: 0.9em;
}

.pagination-link:hover {
  background-color: #eceff3;
}

.pagination-link.is-active {
  background-color: #e5e7eb;
  font-weight: 600;
}

.pagination-link.is-disabled {
  color: var(--app-muted);
  background-color: #f3f4f6;
  border-color: #e5e7eb;
}

/* Brands display styling */
.brands-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.brand-item {
  background-color: #e3f2fd;
  border: 1px solid #3498db;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-number {
  font-weight: 600;
  color: #2980b9;
}

.brand-name {
  color: #2c3e50;
}

.no-brands {
  color: #7f8c8d;
  font-style: italic;
}

/* Brands in table styling */
.brands-cell {
  max-width: 150px;
}

.brands-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.brand-tag {
  background-color: #e8f5e8;
  border: 1px solid #27ae60;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75em;
  color: #27ae60;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.brand-tag .rank-badge {
  font-size: 0.7em;
  padding: 2px 6px;
  min-width: 16px;
}

.brand-more {
  background-color: #f0f0f0;
  border: 1px solid #95a5a6;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75em;
  color: #7f8c8d;
  font-style: italic;
}

.no-brands-text {
  color: #95a5a6;
  font-size: 0.85em;
  font-style: italic;
}

/* Question styling */
.query-content {
  background-color: #f8f9fa;
  border-left: 4px solid #3498db;
  padding: 15px;
  border-radius: 4px;
  font-size: 1.1em;
  line-height: 1.5;
}

.query-text {
  font-weight: 500;
  color: #2c3e50;
}

/* Answer preview styling */
.answer-preview {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
  background-color: #fafafa;
}

.answer-preview .model-name {
  color: #7f8c8d;
  font-size: 0.9em;
}

.answer-preview .answer-text {
  margin: 8px 0;
  color: #555;
  font-size: 0.95em;
  line-height: 1.4;
}

/* Brands table styling */
.brands-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #f8f9fa;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #ecf0f1;
}

.brands-table th {
  background-color: #34495e;
  color: white;
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 0.5px;
}

.brands-table td {
  padding: 10px 15px;
  border-bottom: 1px solid #ecf0f1;
  vertical-align: middle;
}

.brands-table tbody tr:nth-child(even) {
  background-color: white;
}

.brands-table tbody tr {
  transition: all 0.3s ease;
}

.brands-table tbody tr:hover {
  background-color: #e3f2fd;
  transition: background-color 0.2s ease;
}

.mention-count {
  font-weight: 600;
  color: #3498db;
}

.rank-cell {
  text-align: center;
  width: 80px;
}

.rank-count {
  font-weight: 500;
  color: #2c3e50;
  display: inline-block;
  min-width: 20px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.85em;
}

/* Color coding for different ranks */
.brands-table td:nth-child(3) .rank-count {
  background-color: #f1c40f;
  color: #2c3e50;
  font-weight: 600;
}

.brands-table td:nth-child(4) .rank-count {
  background-color: #95a5a6;
  color: white;
  font-weight: 600;
}

.brands-table td:nth-child(5) .rank-count {
  background-color: #cd7f32;
  color: white;
  font-weight: 600;
}

.brands-table td:nth-child(6) .rank-count {
  background-color: #ecf0f1;
  color: #2c3e50;
}

.brands-table th:nth-child(3),
.brands-table th:nth-child(4),
.brands-table th:nth-child(5),
.brands-table th:nth-child(6) {
  text-align: center;
  width: 80px;
}

.brands-toggle-container {
  margin-top: 15px;
  text-align: center;
}

.brands-toggle {
  font-size: 0.9em;
  padding: 8px 16px;
  border: 1px solid #95a5a6;
  background-color: #95a5a6;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.brands-toggle:hover {
  background-color: #7f8c8d;
  color: white;
}
