/* css/style.css */
html {
  min-height: 100%;
  background-color: #f1f5fb;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: #f1f5fb;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

  .header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
  }

  .header .top-nav {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    position: relative;
  }

  .header .nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    margin-left: auto;
  }

  .header .nav-links {
    display: flex;
    gap: 20px;
    margin-left: auto;
  }

  .header .nav-links a {
    color: white;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .header .nav-links a:hover {
    background: rgba(255,255,255,0.25);
    text-decoration: none;
  }

  .header .nav-icon-links {
    display: none;
    gap: 10px;
  }

  .header .nav-icon-links .icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
  }

  .header .nav-icon-links .icon-btn a {
    color: white;
    text-decoration: none;
    font-size: 20px;
    line-height: 1;
  }

 .header .learn-more-link {
    color: white;
    text-decoration: underline;
    font-size: 14px;
    display: inline-block;
    margin-top: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 4px;
  }

 .header .learn-more-link:hover {
    background: rgba(255,255,255,0.1);
    text-decoration: none;
    transform: translateY(-1px);
  }

.header h1 {
  margin: 0;
  font-size: 24px;
}

@media (max-width: 600px) {
  .header {
    padding-top: 20px;
  }

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

  .header .top-nav {
    justify-content: flex-end;
  }

  .header .nav-toggle {
    display: block;
    margin-left: 10px;
    order: 2;
    font-size: 24px;
  }

  .header .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    flex-direction: column;
    background: #2c3e50;
    width: 100%;
    gap: 0;
  }

  .header .nav-links a {
    padding: 12px 20px;
    border-radius: 0;
    background: transparent;
    border-top: 1px solid rgba(255,255,255,0.1);
  }

  .header .nav-links.open {
    display: flex;
  }

  .header .nav-icon-links {
    display: flex;
    align-items: center;
    order: 1;
    gap: 10px;
  }

  .header .nav-icon-links .icon-btn a {
    font-size: 24px;
  }
}

.stats-bar {
  display: flex;
  background: #34495e;
  color: white;
  padding: 15px;
  gap: 30px;
  font-size: 14px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 5px;
}

@media (max-width: 600px) {
  .stats-bar {
    font-size: 14px;
  }

  .stat-value {
    font-size: 18px;
  }
}

.controls {
  padding: 20px;
  background: #ecf0f1;
  border-bottom: 1px solid #bdc3c7;
}

.data-controls,
.auth-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  align-items: flex-start;
}

.form-row {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  min-width: 120px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.inline-form label {
  font-weight: 600;
  font-size: 12px;
  color: #2c3e50;
}

.inline-form input {
  padding: 8px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 14px;
}

.form-feedback {
  font-size: 13px;
  margin-top: 6px;
  color: #2c3e50;
}

.form-feedback.success {
  color: #27ae60;
}

.form-feedback.error {
  color: #e74c3c;
}

.form-group label {
  font-weight: bold;
  margin-bottom: 5px;
  color: #2c3e50;
  font-size: 12px;
}

.form-group input,
.form-group select {
  padding: 8px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 14px;
}

.password-hint {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.auth-link {
  margin-top: 10px;
  font-size: 14px;
}

.auth-link a {
  color: #3498db;
}

.btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-right: 10px;
}

.btn:hover {
  background: #2980b9;
}

.btn-danger {
  background: #e74c3c;
}

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

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

.btn-secondary:hover {
  background: #707b7c;
}

.danger-link {
  color: #e74c3c;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 10px;
}

.table-container {
  overflow-x: auto;
  max-height: 500px;
  overflow-y: auto;
}

.table-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
}

.pagination-page-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #2c3e50;
}

.pagination-page-size label {
  font-weight: 600;
}

.pagination-page-size select {
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #d0d7de;
  background-color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.pagination-summary {
  flex: 1;
  min-width: 160px;
  font-size: 13px;
  color: #606f7b;
}

.pagination-buttons {
  display: flex;
  gap: 6px;
}

.pagination-buttons button {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #d0d7de;
  background-color: #fff;
  cursor: pointer;
  font-size: 14px;
  color: #2c3e50;
  transition: background-color 0.2s ease;
}

.pagination-buttons button:hover:not(:disabled) {
  background-color: #ecf0f1;
}

.pagination-buttons button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: #34495e;
  color: white;
  padding: 12px 8px;
  text-align: left;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  padding: 10px 8px;
  border-bottom: 1px solid #ecf0f1;
}

.loading-row td {
  padding: 10px 8px;
}

.loading-placeholder {
  background-color: #e0e0e0;
  height: 14px;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.loading-placeholder::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.6), rgba(255,255,255,0));
  animation: loadingShimmer 1.5s infinite;
}

@keyframes loadingShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

@media (min-width: 1000px) {
  table {
    font-size: 14px;
  }

  th {
    padding: 18px 05px;
  }

  td {
    padding: 18px 05px;
  }
}

@media (max-width: 768px) {
  .pagination-summary {
    order: 3;
  }
}

.note-cell .note-content,
.event-cell .event-content,
.description-cell .description-content {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

tr:hover {
  background-color: #f8f9fa;
}

.win {
  background-color: #d4edda !important;
  color: #155724;
}

.loss {
  background-color: #f8d7da !important;
  color: #721c24;
}

.pending {
  background-color: #fff3cd !important;
  color: #856404;
}

.push {
  background-color: #e2e3e5 !important;
  color: #383d41;
}

.positive {
  color: #27ae60;
  font-weight: bold;
}

.negative {
  color: #e74c3c;
  font-weight: bold;
}

.empty-state td {
  text-align: center;
  padding: 20px;
  color: #7f8c8d;
  font-style: italic;
}

.muted {
  color: #6b7a8f;
  font-size: 13px;
}

.form-help {
  font-size: 12px;
  color: #6b7a8f;
  margin-top: 6px;
}

.button-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.ai-controls {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #dfe4ea;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-page .ai-layout {
  display: flex;
  gap: 24px;
  margin: 30px 0 60px;
  flex-wrap: wrap;
}

.ai-chat {
  flex: 1 1 58%;
  min-width: 320px;
  background: #ffffff;
  border: 1px solid #dfe4ea;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(0,0,0,0.05);
}

.ai-thread {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  background: linear-gradient(180deg, #f6f9fc 0%, #ffffff 100%);
}

.message {
  display: flex;
  width: 100%;
}

.message.user {
  justify-content: flex-end;
}

.message.assistant {
  justify-content: flex-start;
}

.message.system {
  justify-content: center;
}

.bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.message.user .bubble {
  background: #1f78d1;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.message.assistant .bubble {
  background: #eef4ff;
  color: #1f2a37;
  border-bottom-left-radius: 4px;
}

.message.system .bubble {
  background: #ecf0f1;
  color: #4a4a4a;
  border-radius: 8px;
  font-style: italic;
}

.ai-input {
  padding: 16px 20px 20px;
  border-top: 1px solid #e1e5ea;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #ffffff;
}

.ai-input textarea {
  width: 100%;
  border: 1px solid #ccd6e0;
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  resize: vertical;
  min-height: 60px;
}

.ai-input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.ai-input-row textarea {
  flex: 1;
}

.scope-selector {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 13px;
  color: #34495e;
}

.scope-selector label {
  display: flex;
  gap: 6px;
  align-items: center;
}

.filter-controls {
  background: #f1f5fb;
  border: 1px solid #d7e2f2;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-row label {
  font-size: 12px;
  font-weight: 600;
  color: #2c3e50;
  display: flex;
  flex-direction: column;
}

.filter-row input,
.filter-row select {
  min-width: 150px;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #cdd6e1;
  font-size: 13px;
}

.ai-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hint-chip {
  background: #ecf0f1;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 12px;
  color: #34495e;
}

.hint-chip:hover {
  background: #d7dde2;
}

.ai-context {
  flex: 1 1 32%;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.context-card {
  background: #ffffff;
  border: 1px solid #dfe4ea;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.04);
}

.context-card h2,
.context-card h3,
.context-card h4 {
  margin-top: 0;
  margin-bottom: 10px;
  color: #2c3e50;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 6px;
}

.metric-label {
  color: #5f6c7b;
}

.metric-value {
  font-weight: 600;
  color: #1f2a37;
}

.issue-list {
  margin-top: 10px;
  padding-left: 18px;
  color: #d35400;
  font-size: 12px;
}

.context-breakdowns ul {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.context-breakdowns li {
  font-size: 13px;
  margin-bottom: 6px;
}

.follow-ups {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.follow-ups button {
  background: #ecf0f1;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}

.follow-ups button:hover {
  background: #d7dde2;
}

#ai-chart {
  width: 100%;
  background: #f7f9fb;
  border: 1px solid #e0e6ee;
  border-radius: 10px;
}

.chart-caption {
  font-size: 12px;
  color: #6b7a8f;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .ai-page .ai-layout {
    flex-direction: column;
  }

  .ai-chat,
  .ai-context {
    flex: 1 1 100%;
  }

  .bubble {
    max-width: 100%;
  }

  /* On small screens, keep thread above input (default order) */
  .ai-thread { order: 0; }
  .ai-input { order: 1; }
}

/* On wider screens, show input/filter box above the chat thread */
@media (min-width: 901px) {
  .ai-input { order: 0; }
  .ai-thread { order: 1; }
}

.download-section {
  padding: 20px;
  text-align: center;
  background: #ecf0f1;
}

/* Enhanced Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 24px 32px 16px;
  border-bottom: 1px solid #e8ecf0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #3498db, #2980b9);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.modal-close {
  background: #f8f9fa;
  border: 1px solid #e8ecf0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  color: #6c757d;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #e9ecef;
  color: #495057;
  border-color: #dee2e6;
  transform: scale(1.05);
}

.modal-body {
  padding: 24px 32px 32px;
  overflow-y: auto;
  flex: 1;
  font-size: 15px;
  line-height: 1.6;
  color: #495057;
}

.text-content {
  white-space: pre-wrap;
  word-wrap: break-word;
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  border-left: 4px solid #3498db;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.bet-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-bottom: 20px;
  grid-column: 1 / -1;
}

.modal-actions select {
  padding: 8px 12px;
  border: 1px solid #e8ecf0;
  border-radius: 6px;
  background: #fff;
  color: #2c3e50;
  font-size: 14px;
}

.modal-actions .btn {
  padding: 8px 16px;
  font-size: 14px;
}

.detail-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #e8ecf0;
  transition: all 0.2s ease;
}

.detail-card.full-width {
  grid-column: 1 / -1;
}

.detail-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.detail-label {
  font-size: 12px;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.detail-value {
  font-size: 15px;
  font-weight: 500;
  color: #2c3e50;
  word-wrap: break-word;
}

.detail-value.positive {
  color: #27ae60;
}

.detail-value.negative {
  color: #e74c3c;
}

.detail-value.status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.detail-value.status.win {
  background: #d4edda;
  color: #155724;
}

.detail-value.status.loss {
  background: #f8d7da;
  color: #721c24;
}

.detail-value.status.push {
  background: #fff3cd;
  color: #856404;
}

.detail-value.status.pending {
  background: #d1ecf1;
  color: #0c5460;
}

/* Learn More Modal Styles */
.learn-more-content {
  max-width: 600px;
  margin: 0 auto;
}

.learn-more-content h3 {
  color: #2c3e50;
  font-size: 18px;
  font-weight: 600;
  margin: 24px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e8ecf0;
}

.learn-more-content h3:first-child {
  margin-top: 0;
}

.learn-more-content p {
  margin: 16px 0;
  line-height: 1.7;
  color: #495057;
}

.learn-more-content ul {
  margin: 16px 0;
  padding-left: 24px;
}

.learn-more-content li {
  margin: 8px 0;
  line-height: 1.6;
  color: #495057;
}

.learn-more-content strong {
  color: #2c3e50;
  font-weight: 600;
}

.learn-more-footer {
  text-align: center;
  font-weight: 600;
  color: #3498db !important;
  margin-top: 32px !important;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 4px solid #3498db;
}

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

.modal.active .modal-body {
  animation: slideInContent 0.4s ease 0.1s both;
}

@media (max-width: 600px) {
  .modal-content {
    width: 95%;
    max-height: 90vh;
    border-radius: 12px;
  }

  .modal-header {
    padding: 20px 24px 12px;
  }

  .modal-body {
    padding: 16px 24px 24px;
  }

  .modal-title {
    font-size: 18px;
  }

  .bet-details-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .detail-card {
    padding: 14px;
  }
}

.modal[aria-hidden="true"] {
  display: none;
}

.modal-content:focus {
  outline: 2px solid #3498db;
  outline-offset: -2px;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
