/* Mind Quest Score Management - Brand Theme */
/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;700&family=Lato:wght@300;400&display=swap');

/* CSS Variables - Brand Colors */
:root {
  --oxford-blue: #0A2155;
  --minion-yellow: #F9D84B;
  --slate-gray: #4F4F4F;
  --white: #FFFFFF;
  --sky-blue: #B3D4FC;
  --green-success: #22c55e;
  --red-error: #ef4444;
}

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

body {
  font-family: 'Lato', sans-serif;
  font-size: 28px;
  color: var(--slate-gray);
  background-color: var(--white);
  overflow-x: hidden;
}

/* Header Styling */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--oxford-blue);
  color: var(--white);
  padding: 2rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.logo {
  height: 80px;
  width: auto;
}

.header-title {
  display: flex;
  flex-direction: column;
}

.title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 64px;
  line-height: 1;
}

.tagline {
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: 22px;
  font-style: italic;
  opacity: 0.9;
}

/* Menu Button (three dots) */
.menu-button {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--white);
  font-size: 36px;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  border-radius: 6px;
  opacity: 0.3;
  transition: opacity 0.3s ease, background 0.3s ease;
}

.menu-button:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

/* Dropdown Menu */
.menu-dropdown {
  position: fixed;
  top: 4rem;
  right: 1rem;
  z-index: 199;
  background: var(--oxford-blue);
  border: 1px solid var(--sky-blue);
  border-radius: 8px;
  padding: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
}

.menu-dropdown.active {
  display: block;
}

.menu-dropdown button {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--white);
  padding: 1.25rem 2rem;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s ease;
  font-size: 24px;
  white-space: nowrap;
}

.menu-dropdown button:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Main Container */
.container {
  max-width: 100%;
  margin: 2rem auto;
  /* padding: 0 1rem; */
  overflow-x: visible;
}

/* Score Table */
.score-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-radius: 0;
  overflow: hidden;
  table-layout: auto;
}

.score-table thead {
  background-color: var(--oxford-blue);
  color: var(--white);
}

.score-table th {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 38px;
  padding: 1.5rem 1rem;
  text-align: center;
  white-space: nowrap;
}

.score-table th:first-child {
  text-align: left;
  padding-left: 1.5rem;
}

.score-table td {
  padding: 1.5rem 1rem;
  text-align: center;
  border: 1px solid #e5e7eb;
  font-size: 48px;
  font-weight: 400;
  transition: all 0.3s ease;
  min-width: 100px;
  white-space: nowrap;
}

.score-table tbody tr:nth-child(even) {
  background-color: #f9fafb;
}

.score-table tbody tr:hover {
  background-color: var(--sky-blue);
}

.score-table .round-label {
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: 36px;
  background-color: #f3f4f6;
  text-align: left;
  padding-left: 1.5rem;
  min-width: 160px;
  white-space: nowrap;
}

/* Total Row */
.total-row {
  background-color: var(--sky-blue) !important;
  font-weight: 700;
  position: sticky;
  bottom: 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.total-row td {
  font-family: 'Montserrat', sans-serif;
  font-size: 56px;
  padding: 1.5rem 1rem;
  border-top: 4px solid var(--oxford-blue);
}

/* Winner Highlight */
.winner-cell {
  background-color: var(--minion-yellow) !important;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(249, 216, 75, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(249, 216, 75, 0.8);
  }
}

/* Score Cell Animation */
.score-cell {
  position: relative;
  transition: all 0.3s ease-in-out;
  will-change: transform, background-color;
}

.score-cell.updated {
  animation: score-zoom-in 1s ease-in-out !important;
  animation-fill-mode: both !important;
}

@keyframes score-zoom-in {
  0% {
    transform: scale(1);
    background-color: var(--white);
  }
  15% {
    transform: scale(1.4);
    background-color: var(--sky-blue);
    box-shadow: 0 0 20px rgba(179, 212, 252, 0.8);
  }
  30% {
    transform: scale(1.5);
    background-color: var(--minion-yellow);
    box-shadow: 0 0 30px rgba(249, 216, 75, 0.9);
  }
  60% {
    transform: scale(1.3);
    background-color: var(--sky-blue);
    box-shadow: 0 0 25px rgba(179, 212, 252, 0.7);
  }
  100% {
    transform: scale(1);
    background-color: var(--white);
    box-shadow: none;
  }
}

/* Total Cell Animation */
.total-cell-updated {
  animation: total-zoom-in 1s ease-in-out !important;
  animation-fill-mode: both !important;
  will-change: transform, box-shadow;
}

@keyframes total-zoom-in {
  0% {
    transform: scale(1);
  }
  15% {
    transform: scale(1.3);
    box-shadow: 0 0 20px rgba(179, 212, 252, 0.8);
  }
  30% {
    transform: scale(1.4);
    box-shadow: 0 0 30px rgba(249, 216, 75, 0.9);
  }
  60% {
    transform: scale(1.2);
    box-shadow: 0 0 25px rgba(179, 212, 252, 0.7);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  }
}

/* Switch Cell */
.switch-cell {
  padding: 0.75rem !important;
  vertical-align: middle;
  background-color: #fafafa;
}

.switch-cell:hover {
  background-color: #f0f0f0;
}

/* Switch Buttons Container */
.switch-buttons {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
}

/* Button Styling */
.btn {
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-primary {
  background-color: var(--minion-yellow);
  color: var(--oxford-blue);
}

.btn-success {
  background-color: var(--green-success);
  color: var(--white);
  font-size: 14px;
  padding: 0.6rem 1rem;
  min-width: 70px;
  white-space: nowrap;
}

.btn-danger {
  background-color: var(--red-error);
  color: var(--white);
  font-size: 14px;
  padding: 0.6rem 1rem;
  min-width: 70px;
  white-space: nowrap;
}

.btn-success.active {
  animation: flip-glow 0.5s ease-in-out;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.6);
}

.btn-danger.active {
  animation: flip-glow 0.5s ease-in-out;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}

@keyframes flip-glow {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(180deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}

/* Hidden Link for Switch Page Access */
.hidden-link {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  opacity: 0.1;
  transition: opacity 0.3s ease;
  z-index: 100;
  font-size: 12px;
  color: var(--slate-gray);
  text-decoration: none;
}

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

/* TV Mode Styles */
body.tv-mode {
  cursor: none;
}

body.tv-mode .menu-button {
  opacity: 0;
}

body.tv-mode .menu-button:hover {
  opacity: 0.3;
}

body.tv-mode .hidden-link {
  opacity: 0;
}

body.tv-mode .container {
  max-width: 100%;
  /* padding: 1rem 1rem; */
}

body.tv-mode .score-table th {
  font-size: 44px;
  padding: 1.5rem 1rem;
  white-space: nowrap;
}

body.tv-mode .score-table td {
  font-size: 56px;
  padding: 2rem 1rem;
  white-space: nowrap;
}

body.tv-mode .total-row td {
  font-size: 64px;
  padding: 2rem 1rem;
}

body.tv-mode .score-table .round-label {
  font-size: 42px;
  padding-left: 1.5rem;
}

/* TV Mode Enhanced Animations */
body.tv-mode .score-cell.updated {
  animation: score-zoom-in-tv 1.2s ease-in-out !important;
  animation-fill-mode: both !important;
}

body.tv-mode .total-cell-updated {
  animation: total-zoom-in-tv 1.2s ease-in-out !important;
  animation-fill-mode: both !important;
}

@keyframes score-zoom-in-tv {
  0% {
    transform: scale(1);
    background-color: var(--white);
  }
  15% {
    transform: scale(1.5);
    background-color: var(--sky-blue);
    box-shadow: 0 0 40px rgba(179, 212, 252, 1), 0 0 80px rgba(179, 212, 252, 0.6);
  }
  30% {
    transform: scale(1.6);
    background-color: var(--minion-yellow);
    box-shadow: 0 0 60px rgba(249, 216, 75, 1), 0 0 120px rgba(249, 216, 75, 0.8);
  }
  60% {
    transform: scale(1.4);
    background-color: var(--sky-blue);
    box-shadow: 0 0 50px rgba(179, 212, 252, 0.9), 0 0 100px rgba(179, 212, 252, 0.5);
  }
  100% {
    transform: scale(1);
    background-color: var(--white);
    box-shadow: none;
  }
}

@keyframes total-zoom-in-tv {
  0% {
    transform: scale(1);
    background-color: var(--sky-blue);
  }
  15% {
    transform: scale(1.4);
    background-color: var(--sky-blue);
    box-shadow: 0 0 40px rgba(179, 212, 252, 1), 0 -2px 10px rgba(0, 0, 0, 0.1);
  }
  30% {
    transform: scale(1.5);
    background-color: var(--minion-yellow);
    box-shadow: 0 0 60px rgba(249, 216, 75, 1), 0 0 120px rgba(249, 216, 75, 0.8);
  }
  60% {
    transform: scale(1.3);
    background-color: var(--sky-blue);
    box-shadow: 0 0 50px rgba(179, 212, 252, 0.9), 0 -2px 10px rgba(0, 0, 0, 0.1);
  }
  100% {
    transform: scale(1);
    background-color: var(--sky-blue);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .title {
    font-size: 36px;
  }

  .score-table th {
    font-size: 20px;
    padding: 0.75rem;
  }

  .score-table td {
    font-size: 24px;
    padding: 1rem;
  }

  .total-row td {
    font-size: 28px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0.75rem 1rem;
  }

  .header-left {
    gap: 0.75rem;
  }

  .logo {
    height: 40px;
  }

  .title {
    font-size: 24px;
  }

  .tagline {
    font-size: 12px;
  }

  .container {
    /* padding: 0 0.5rem; */
    margin: 1rem auto;
  }

  .score-table {
    table-layout: fixed;
  }

  .score-table th {
    font-size: 14px;
    padding: 0.5rem 0.25rem;
  }

  .score-table th:first-child {
    width: 18%;
  }

  .score-table th:not(:first-child) {
    width: 13.66%;
  }

  .score-table td {
    font-size: 16px;
    padding: 0.6rem 0.25rem;
  }

  .score-table .round-label {
    font-size: 14px;
    padding: 0.6rem 0.5rem;
  }

  .total-row td {
    font-size: 18px;
    padding: 0.8rem 0.25rem;
  }

  .switch-buttons {
    flex-direction: row;
    gap: 0.25rem;
    flex-wrap: nowrap;
  }

  .btn-success, .btn-danger {
    font-size: 10px;
    padding: 0.4rem 0.4rem;
    min-width: 40px;
    flex: 1;
  }

  .menu-button {
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.4rem 0.8rem;
    font-size: 20px;
  }

  .menu-dropdown {
    top: 3.5rem;
    right: 0.75rem;
  }

  .menu-dropdown button {
    padding: 0.6rem 1.2rem;
    font-size: 14px;
  }
}

/* Mobile Phones - iPhone 12 and similar (390px - 480px) */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .header {
    padding: 0.5rem 0.75rem;
  }

  .header-left {
    gap: 0.5rem;
  }

  .logo {
    height: 32px;
  }

  .title {
    font-size: 18px;
  }

  .tagline {
    font-size: 10px;
  }

  .container {
    padding: 0 0.25rem;
    margin: 0.5rem auto;
  }

  /* Make table fit viewport without scrolling */
  .score-table {
    font-size: 12px;
    table-layout: fixed;
    width: 100%;
  }

  .score-table th {
    font-size: 10px;
    padding: 0.4rem 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .score-table th:first-child {
    width: 15%;
  }

  .score-table th:not(:first-child) {
    width: 14.16%;
  }

  .score-table td {
    font-size: 14px;
    padding: 0.4rem 0.1rem;
    overflow: hidden;
  }

  .score-table .round-label {
    font-size: 11px;
    padding: 0.4rem 0.2rem;
    text-align: left;
    white-space: nowrap;
  }

  .total-row td {
    font-size: 15px;
    padding: 0.6rem 0.1rem;
    font-weight: 700;
  }

  /* Switch cell buttons for mobile */
  .switch-cell {
    padding: 0.25rem 0.1rem !important;
  }

  .switch-buttons {
    flex-direction: row;
    gap: 0.15rem;
    justify-content: center;
    flex-wrap: nowrap;
  }

  .btn-success, .btn-danger {
    font-size: 8px;
    padding: 0.35rem 0.25rem;
    min-width: 36px;
    min-height: 32px;
    flex: 1;
    white-space: nowrap;
  }

  /* Menu optimizations for mobile */
  .menu-button {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.3rem 0.6rem;
    font-size: 18px;
  }

  .menu-dropdown {
    top: 3rem;
    right: 0.5rem;
    max-width: calc(100vw - 1rem);
  }

  .menu-dropdown button {
    padding: 0.5rem 1rem;
    font-size: 13px;
  }

  .hidden-link {
    bottom: 0.5rem;
    left: 0.5rem;
    font-size: 10px;
  }

  /* Improve animation performance on mobile */
  .score-cell.updated {
    animation-duration: 0.8s !important;
  }

  @keyframes score-zoom-in {
    0% {
      transform: scale(1);
      background-color: var(--white);
    }
    20% {
      transform: scale(1.2);
      background-color: var(--sky-blue);
      box-shadow: 0 0 10px rgba(179, 212, 252, 0.6);
    }
    40% {
      transform: scale(1.25);
      background-color: var(--minion-yellow);
      box-shadow: 0 0 15px rgba(249, 216, 75, 0.7);
    }
    70% {
      transform: scale(1.15);
      background-color: var(--sky-blue);
      box-shadow: 0 0 12px rgba(179, 212, 252, 0.5);
    }
    100% {
      transform: scale(1);
      background-color: var(--white);
      box-shadow: none;
    }
  }

  .total-cell-updated {
    animation-duration: 0.8s !important;
  }

  @keyframes total-zoom-in {
    0% {
      transform: scale(1);
    }
    20% {
      transform: scale(1.15);
      box-shadow: 0 0 10px rgba(179, 212, 252, 0.6);
    }
    40% {
      transform: scale(1.2);
      box-shadow: 0 0 15px rgba(249, 216, 75, 0.7);
    }
    70% {
      transform: scale(1.1);
      box-shadow: 0 0 12px rgba(179, 212, 252, 0.5);
    }
    100% {
      transform: scale(1);
      box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }
  }

  /* Winner cell adjustments */
  .winner-cell {
    animation: pulse-glow-mobile 2s infinite;
  }

  @keyframes pulse-glow-mobile {
    0%, 100% {
      box-shadow: 0 0 5px rgba(249, 216, 75, 0.4);
    }
    50% {
      box-shadow: 0 0 10px rgba(249, 216, 75, 0.6);
    }
  }

  /* Update notification for mobile */
  .update-notification {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: calc(100vw - 20px);
    padding: 1rem;
  }

  .update-content strong {
    font-size: 1rem;
  }

  .update-content p {
    font-size: 0.85rem;
  }

  .update-content button {
    padding: 0.5rem 1rem;
    font-size: 13px;
  }
}

/* Extra small devices - iPhone SE and similar (320px - 375px) */
@media (max-width: 375px) {
  .title {
    font-size: 16px;
  }

  .tagline {
    font-size: 9px;
  }

  .logo {
    height: 28px;
  }

  .container {
    padding: 0 0.15rem;
  }

  .score-table th {
    font-size: 9px;
    padding: 0.3rem 0.05rem;
  }

  .score-table td {
    font-size: 12px;
    padding: 0.35rem 0.05rem;
  }

  .score-table .round-label {
    font-size: 10px;
    padding: 0.35rem 0.15rem;
  }

  .total-row td {
    font-size: 14px;
    padding: 0.5rem 0.05rem;
  }

  .btn-success, .btn-danger {
    font-size: 7px;
    padding: 0.3rem 0.2rem;
    min-width: 32px;
    min-height: 30px;
  }

  .menu-dropdown button {
    font-size: 12px;
    padding: 0.45rem 0.9rem;
  }
}

/* Loading State */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  font-family: 'Montserrat', sans-serif;
  font-size: 24px;
  color: var(--oxford-blue);
}

/* Error Message */
.error-message {
  background-color: var(--red-error);
  color: var(--white);
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  text-align: center;
}

/* Update Notification */
.update-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: linear-gradient(135deg, var(--oxford-blue), #1a3a7a);
  color: var(--white);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: slideInRight 0.5s ease-out;
  max-width: 350px;
}

.update-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.update-content strong {
  font-size: 1.1rem;
  color: var(--minion-yellow);
}

.update-content p {
  margin: 0;
  font-size: 0.95rem;
}

.update-content button {
  margin-top: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

.update-content .btn-primary {
  background-color: var(--minion-yellow);
  color: var(--oxford-blue);
}

.update-content .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(249, 216, 75, 0.4);
}

.update-content .btn-secondary {
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.update-content .btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Success Message */
.success-message {
  background-color: var(--green-success);
  color: var(--white);
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  text-align: center;
}
