/* ============================================
   Page-Specific Styles
   ============================================ */

/* === Login Screen === */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-primary);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.login-screen-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.login-screen-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
  filter: blur(2px);
}

.login-screen-overlay {
  position: absolute;
  inset: 0;
  background: rgba(21,21,30,0.5);
}

[data-theme="light"] .login-screen-overlay {
  background: rgba(245,245,248,0.5);
}

.login-card-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: var(--space-4);
}

.login-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
  animation: modalSlideIn 400ms ease both;
}

.login-card-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.login-card-logo {
  height: 28px;
  width: auto;
  margin: 0 auto var(--space-3);
  display: block;
}

.login-card-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-black);
  margin-bottom: var(--space-1);
  color: var(--color-text-primary);
}

.login-card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}


.login-form {
  margin-bottom: var(--space-4);
}

.login-error {
  background: var(--color-danger-muted);
  color: var(--color-accent-text);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  word-break: break-word;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* === Announcement Modal === */
.announcement-overlay {
  position: fixed;
  inset: 0;
  z-index: 6000;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  transition: opacity 250ms ease;
}

.announcement-overlay.active {
  opacity: 1;
}

.announcement-modal {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 440px;
  width: 100%;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform 300ms ease;
}

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

.announcement-img-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.announcement-img {
  width: 100%;
  height: auto;
  display: block;
}

.announcement-img-fade {
  display: none;
}

.announcement-body {
  padding: var(--space-5) var(--space-6) var(--space-6);
}

.announcement-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.announcement-badge-welcome {
  color: var(--color-success);
}

.announcement-badge-info {
  color: var(--color-info);
}

.announcement-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-black);
  margin-bottom: var(--space-2);
}

.announcement-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-5);
  white-space: pre-line;
}

.announcement-dismiss {
  margin-top: var(--space-2);
}

/* === Standings Page === */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.stat-card-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.stat-card-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
}

.stat-card-detail {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

/* === Results Page === */
.race-header-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  margin-bottom: var(--space-6);
  text-align: center;
}

.race-header-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-black);
  margin-bottom: var(--space-1);
}

.race-header-detail {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.race-header-img {
  width: 200px;
  height: auto;
  margin: var(--space-4) auto 0;
  border-radius: var(--radius-md);
  opacity: 0.8;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.carousel-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.carousel-btn:hover:not(:disabled) {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.carousel-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-indicator {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
}

.carousel-indicator span {
  color: var(--color-text-primary);
}

/* === Calendar Page === */
.timeline {
  position: relative;
  padding-left: var(--space-8);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-4);
}

.timeline-dot {
  position: absolute;
  left: calc(-1 * var(--space-8) + 10px);
  top: var(--space-5);
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--color-bg-tertiary);
  border: 2px solid var(--color-border-strong);
}

.timeline-item.completed .timeline-dot {
  background: var(--color-text-muted);
  border-color: var(--color-text-muted);
}

.timeline-item.next .timeline-dot {
  background: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: 0 0 8px rgba(225, 6, 0, 0.4);
}

.timeline-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: border-color var(--transition-fast);
}

.timeline-item.next .timeline-card {
  border-color: var(--color-accent);
}

.timeline-item.completed .timeline-card {
  opacity: 0.7;
}

.timeline-round {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.timeline-name {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-1);
}

.timeline-date {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.timeline-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* === Picks Page === */
.auth-card {
  max-width: 420px;
  margin: 0 auto var(--space-8);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
}

.auth-card-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-2);
}

.auth-card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.pick-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

.pick-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.pick-card-name {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
}

.pick-card-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.pick-readonly {
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.picks-save-bar {
  position: sticky;
  bottom: var(--space-4);
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: center;
  z-index: 100;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .picks-save-bar {
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
}

/* === History Page === */
.champion-banner {
  background: linear-gradient(135deg, var(--color-accent-muted) 0%, transparent 100%);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  margin-bottom: var(--space-6);
}

.champion-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-gold);
  margin-bottom: var(--space-2);
}

.champion-name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
}

.champion-points {
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

/* === Admin Page === */
.admin-layout {
  display: flex;
  gap: var(--space-6);
  min-height: calc(100vh - var(--nav-height) - var(--space-16));
}

.admin-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
}

.admin-sidebar-nav {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-8));
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.admin-sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.admin-sidebar-link:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-hover);
}

.admin-sidebar-link.active {
  color: var(--color-text-primary);
  background: var(--color-accent-muted);
}

.admin-sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.admin-content {
  flex: 1;
  min-width: 0;
}

.admin-section-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-6);
}

/* === Admin Nav === */
.admin-sidebar-title {
  font-size: var(--text-md);
  font-weight: var(--weight-black);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  padding: 0 var(--space-3);
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  position: sticky;
  top: calc(var(--nav-height) + var(--space-8));
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background var(--transition-fast);
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.admin-nav-item:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-hover);
}

.admin-nav-item.active {
  color: var(--color-text-primary);
  background: var(--color-accent-muted);
}

.admin-nav-icon {
  font-size: var(--text-md);
}

/* === Chat Page === */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height) - var(--space-16));
  min-height: 400px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.chat-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

.chat-tabs {
  display: flex;
  gap: var(--space-2);
}

.chat-tab {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chat-tab:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-hover);
}

.chat-tab.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #ffffff;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  scroll-behavior: smooth;
}

.chat-loading,
.chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.chat-date-divider {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: var(--space-2) 0;
  position: relative;
}

.chat-date-divider::before,
.chat-date-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: var(--color-border);
}

.chat-date-divider::before { left: 0; }
.chat-date-divider::after { right: 0; }

.chat-bubble {
  display: flex;
  gap: var(--space-2);
  max-width: 80%;
}

.chat-bubble-own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-bubble-other {
  align-self: flex-start;
}

.chat-bubble-avatar {
  font-size: var(--text-lg);
  flex-shrink: 0;
  margin-top: var(--space-1);
}

.chat-bubble-content {
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  min-width: 60px;
}

.chat-bubble-own .chat-bubble-content {
  background: var(--color-accent);
  color: #ffffff;
}

.chat-bubble-own .chat-bubble-content a {
  color: #ffffff;
  text-decoration: underline;
}

.chat-bubble-name {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--color-accent);
  margin-bottom: var(--space-1);
}

.chat-bubble-text {
  font-size: var(--text-sm);
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-bubble-text a {
  color: var(--color-accent);
  text-decoration: underline;
}

.chat-bubble-time {
  font-size: 10px;
  color: var(--color-text-muted);
  text-align: right;
  margin-top: var(--space-1);
}

.chat-bubble-own .chat-bubble-time {
  color: rgba(255, 255, 255, 0.7);
}

.chat-image {
  margin-bottom: var(--space-2);
}

.chat-image img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.chat-input-bar {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
}

.chat-input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--color-accent);
}

.chat-send {
  border-radius: var(--radius-full) !important;
  padding: var(--space-3) var(--space-5) !important;
}

/* === Avatar === */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-bg-tertiary);
  border: 2px solid var(--color-border);
}

.avatar-sm { width: 28px; height: 28px; font-size: 14px; }
.avatar-md { width: 36px; height: 36px; font-size: 18px; }
.avatar-lg { width: 48px; height: 48px; font-size: 24px; }
.avatar-xl { width: 64px; height: 64px; font-size: 32px; }

/* === User Profile Modal === */
.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.profile-avatar {
  font-size: 48px;
}

.profile-avatar-initials {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  font-weight: var(--weight-black);
  letter-spacing: var(--tracking-wide);
  flex-shrink: 0;
}

.profile-avatar-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

.profile-avatar-icon:hover {
  opacity: 0.8;
}

/* Icon Picker */
.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.icon-picker-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--color-border);
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin: 0 auto;
}

.icon-picker-item:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-muted);
}

.icon-picker-item.active {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: white;
}

.profile-info {
  flex: 1;
}

.profile-display-name {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

.profile-real-name {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.profile-stat {
  text-align: center;
  padding: var(--space-3);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
}

.profile-stat-value {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-accent);
}

.profile-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* === History Page — Champion Banner === */
.champion-banner-year {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.champion-banner-title {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

.champion-banner-name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
  color: var(--color-gold);
}

.champion-banner-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

/* === Login Page === */
.login-container {
  max-width: 400px;
  margin: var(--space-16) auto;
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-logo-text {
  font-size: var(--text-xl);
  font-weight: var(--weight-black);
  letter-spacing: var(--tracking-wide);
}
