/* One Play a Day - Modern Sports Analytics Design */

:root {
  --navy: #1e3a5f;
  --slate: #334155;
  --light-gray: #f8fafc;
  --white: #ffffff;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-hover: rgba(0, 0, 0, 0.15);
  --accent: #3b82f6;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --tag-bg: #f1f5f9;
  --tag-border: #cbd5f5;
  --tag-text: #1f2937;
  --tag-selected: #1d4ed8;
  --tag-selected-bg: #dbeafe;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--light-gray);
  color: var(--text-dark);
  line-height: 1.6;
}

/* Header */
header {
  position: relative;
  background: linear-gradient(135deg, var(--navy) 0%, var(--slate) 100%);
  color: var(--white);
  padding: 2rem 1rem;
  box-shadow: 0 2px 8px var(--shadow);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  height: 44px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.play-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Main Container */
main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Play Cards Grid */
.plays-grid {
  display: grid;
  gap: 2rem;
  margin-bottom: 2rem;
}

.play-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 4px 6px var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.play-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px var(--shadow-hover);
}

/* Card Header */
.card-header {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  padding: 1.5rem;
  border-bottom: 3px solid var(--accent);
}

.play-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.play-number {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--white);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
}

.play-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.play-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.4;
}

/* Play Details Grid */
.play-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
  background: var(--white);
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
}

/* Video Section */
.video-section {
  padding: 1.5rem;
  background: var(--white);
}

.videos-container {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.videos-container-two {
  grid-template-columns: repeat(2, 1fr);
}

.videos-container-multi {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (max-width: 768px) {
  .videos-container-two,
  .videos-container-multi {
    grid-template-columns: 1fr;
  }
}

.video-wrapper {
  position: relative;
}

.video-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  display: block;
}

video {
  width: 100%;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 2px 4px var(--shadow);
}

/* Diagram */
.diagram-wrapper {
  margin-top: 1.5rem;
}

.diagram-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  display: block;
}

.play-diagram {
  width: 100%;
  max-width: 600px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 4px var(--shadow);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 4px 6px var(--shadow);
}

.pagination button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--white);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.pagination button:hover:not(:disabled) {
  background: #2563eb;
  transform: scale(1.05);
}

.pagination button:disabled {
  background: var(--text-muted);
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  font-weight: 600;
  color: var(--text-dark);
}

/* Floating Badge */
.floating-badge {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 9999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.08);
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.floating-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.floating-badge span {
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 500;
}

.floating-badge img {
  height: 22px;
  width: auto;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
  h1 {
    font-size: 1.5rem;
  }

  .play-title {
    font-size: 1.1rem;
  }

  .play-details {
    grid-template-columns: 1fr;
  }

  .pagination {
    flex-direction: column;
  }
}

/* Lazy Loading Animation */
.lazy-load {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.lazy-load.loaded {
  opacity: 1;
}

/* Filters Section */
.filters-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.filters-container {
  background: var(--white);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 8px var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 200px;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-group select {
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--white);
  cursor: pointer;
  min-width: 130px;
  transition: border-color 0.2s;
}

.filter-group select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Date Filter Group */
.date-filter-group {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.date-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.date-input-wrapper label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.date-input-wrapper input[type="date"] {
  padding: 0.65rem 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.2s;
  min-width: 130px;
}

.date-input-wrapper input[type="date"]:focus {
  outline: none;
  border-color: var(--accent);
}

.clear-btn {
  padding: 0.75rem 1.25rem;
  background: var(--slate);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.clear-btn:hover {
  background: var(--navy);
}

.filter-count {
  max-width: 1200px;
  margin: 0.5rem auto 0;
  padding: 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: none;
}

/* Tag Filters */
.tag-filter {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  background: #f8fafc;
  display: grid;
  gap: 0.75rem;
}

.tag-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-filter-label {
  font-weight: 700;
  color: var(--text-dark);
}

.tag-filter-helper {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tag-filter-selected {
  min-height: 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-filter-controls {
  display: grid;
  gap: 0.75rem;
}

.tag-filter-controls input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--white);
}

.tag-filter-controls input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.tag-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 140px;
  overflow-y: auto;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--tag-text);
  font-size: 0.8rem;
  font-weight: 600;
}

.tag-pill button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tag-option {
  border: 1px dashed transparent;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.tag-option:hover {
  border-color: var(--accent);
  background: var(--white);
}

.tag-option.active {
  border-color: var(--tag-selected);
  background: var(--tag-selected-bg);
  color: var(--tag-selected);
}

.tag-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Team Badge */
.team-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--white);
  background: var(--accent);
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
}

/* Tag display on cards */
.play-tags {
  padding: 0 1.5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.play-tags .tag-pill {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3730a3;
}

.play-tags .tag-pill.is-user {
  background: #ecfeff;
  border-color: #a5f3fc;
  color: #155e75;
}

.tag-action-row {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  justify-content: flex-end;
}

.tag-action-btn {
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.tag-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(37, 99, 235, 0.15);
}

/* Responsive filters */
@media (max-width: 768px) {
  .filters-container {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-box {
    width: 100%;
  }
  
  .filter-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  .filter-group select {
    min-width: 0;
  }
  
  .date-filter-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  .date-input-wrapper {
    width: 100%;
  }
  
  .date-input-wrapper input[type="date"] {
    width: 100%;
    min-width: 0;
  }
  
  .clear-btn {
    width: 100%;
  }
  
  .play-meta {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .team-badge {
    order: 3;
    flex-basis: 100%;
  }

  .tag-filter {
    padding: 0.75rem;
  }
}

/* Twitter/X source styling */
.play-card.source-twitter {
  border-left: 4px solid #1da1f2;
}

.play-card.source-twitter .play-number {
  background: linear-gradient(135deg, #1da1f2, #0d8ecf);
}

.twitter-link {
  font-size: 0.9rem;
  text-decoration: none;
  margin-left: 8px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.twitter-link:hover {
  opacity: 1;
}

.play-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
}

.modal-backdrop.active {
  display: flex;
}

.tag-modal {
  width: min(720px, 95vw);
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-height: 90vh;
  overflow: hidden;
}

.tag-modal-header {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  background: linear-gradient(135deg, #e2e8f0, #f8fafc);
}

.tag-modal-header h3 {
  font-size: 1.25rem;
  color: var(--text-dark);
}

.tag-modal-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.tag-modal-close {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
}

.tag-modal-body {
  padding: 1.5rem;
  display: grid;
  gap: 1.5rem;
  overflow-y: auto;
}

.tag-modal-section {
  display: grid;
  gap: 0.75rem;
}

.tag-modal-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.tag-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 28px;
}

.tag-modal-section input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
}

.tag-modal-section input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.tag-modal-add {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid #cbd5f5;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 600;
  cursor: pointer;
}

.tag-modal-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 180px;
  overflow-y: auto;
}

.tag-modal-footnote {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tag-modal-footer {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: #f8fafc;
}

.tag-modal-primary,
.tag-modal-secondary {
  padding: 0.65rem 1.3rem;
  border-radius: 999px;
  border: none;
  font-weight: 700;
  cursor: pointer;
}

.tag-modal-primary {
  background: var(--accent);
  color: var(--white);
}

.tag-modal-secondary {
  background: #e2e8f0;
  color: var(--text-dark);
}

@media (max-width: 640px) {
  .tag-modal {
    width: 100%;
    max-height: 95vh;
  }

  .tag-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ========== Additional Tagging Styles ========== */

.tag-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.tag-btn:hover {
  opacity: 1;
}

.tag-pill-small {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
}

.tag-pill-selected {
  background: var(--accent) !important;
  color: var(--white) !important;
  border-color: var(--accent) !important;
}

.tag-remove {
  cursor: pointer;
  opacity: 0.7;
  font-size: 0.9em;
}

.tag-remove:hover {
  opacity: 1;
}

.tag-filter-empty,
.tag-modal-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

.play-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
