/* ============================================================
   AUTHENTICATION STYLES
   ============================================================ */

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 400px;
  padding: 40px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
    text-shadow: 0 0 5px rgba(30, 58, 138, 0.3);
  }
  50% {
    opacity: 0.9;
    text-shadow: 0 0 15px rgba(59, 130, 246, 0.6), 0 0 25px rgba(30, 58, 138, 0.4);
  }
}

.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 40px;
}

.auth-header svg {
  margin-bottom: 15px;
}

.auth-header h1 {
  font-size: 28px;
  color: #1e3a8a;
  margin: 0;
}

.auth-form {
  width: 100%;
}

.auth-form h2 {
  font-size: 20px;
  margin-bottom: 25px;
  color: #1e293b;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #334155;
  font-size: 14px;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.password-requirements {
  margin-top: 10px;
  padding: 10px;
  background-color: #f1f5f9;
  border-radius: 6px;
  font-size: 12px;
}

.req-item {
  margin: 4px 0;
  color: #64748b;
}

.req-item.met {
  color: #16a34a;
}

.auth-toggle {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: #64748b;
}

.auth-toggle a {
  color: #667eea;
  font-weight: 600;
  cursor: pointer;
}

.auth-toggle a:hover {
  text-decoration: underline;
}

.animated-text {
  animation: pulse-glow 2s ease-in-out infinite;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
}

.admin-info {
  margin-top: 30px;
  padding: 15px;
  background-color: #fef3c7;
  border: 2px solid #fbbf24;
  border-radius: 8px;
  text-align: center;
}

.admin-info h3 {
  color: #78350f;
  margin-bottom: 12px;
  font-size: 16px;
}

.admin-info p {
  color: #92400e;
  font-size: 13px;
  margin: 6px 0;
}

.admin-info-note {
  font-style: italic;
  color: #b45309;
  margin-top: 10px !important;
}

.hidden {
  display: none !important;
}

/* Admin-only elements */
.admin-only-button {
  display: none;
}

.admin-only-button:not(.hidden) {
  display: inline-block;
}

/* ============================================================
   GLOBAL STYLES & RESET
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f8fafc;
  color: #1e293b;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: none;
  cursor: pointer;
  font-family: inherit;
}

/* ============================================================
   LAYOUT STRUCTURE
   ============================================================ */

.container-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   FOOTER FRAME
   ============================================================ */

.footer-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  height: auto;
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.main-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Mobile: Allow overflow for scrolling */
@media (max-width: 768px) {
  .main-wrapper {
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* ============================================================
   HEADER FRAME
   ============================================================ */

.header-frame {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 70px;
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e3a8a;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

.logo-text {
  letter-spacing: -0.5px;
}

.logo-username {
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 2px solid #1e3a8a;
  color: #475569;
  font-size: 0.95rem;
  font-weight: 500;
}

.logo-logout-btn {
  background-color: #dc2626;
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-left: 0.5rem;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  min-height: auto;
}

.logo-logout-btn:hover {
  background-color: #b91c1c;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

/* Hide footer logout button */
.footer-logout-btn {
  display: none;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: #475569;
  transition: color 0.3s ease;
  position: relative;
}

.nav-link:hover {
  color: #1e3a8a;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #1e3a8a;
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* Hide navigation menu */
.header-center {
  display: none !important;
}

/* Hide search bar */
.search-bar {
  display: none !important;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-bar {
  padding: 0.6rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background-color: #ffffff;
  font-size: 0.9rem;
  width: 200px;
  transition: all 0.3s ease;
}

.search-bar:focus {
  outline: none;
  border-color: #1e3a8a;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.search-bar::placeholder {
  color: #cbd5e1;
}

.profile-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e0e7ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 0.3s ease;
}

.profile-icon:hover {
  background-color: #c7d2fe;
  transform: scale(1.1);
}

/* ============================================================
   MAIN WRAPPER & SIDEBAR
   ============================================================ */

.sidebar-frame {
  width: 240px;
  background-color: #ffffff;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  flex-shrink: 0;
  display: none;
}

.sidebar-content {
  padding: 2rem 1.5rem;
}

.sidebar-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1.5rem;
}

.sidebar-menu {
  list-style: none;
}

.sidebar-item {
  margin-bottom: 0.5rem;
}

.sidebar-item a {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: #475569;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.sidebar-item a:hover {
  background-color: #f1f5f9;
  color: #1e3a8a;
  padding-left: 1.25rem;
}

.sidebar-item.active a {
  background-color: #e0e7ff;
  color: #1e3a8a;
  font-weight: 600;
  padding-left: 1.25rem;
}

/* ============================================================
   MAIN CONTENT FRAME
   ============================================================ */

.content-frame {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2rem 2.5rem;
  background-color: #f8fafc;
}

/* Mobile: Allow horizontal scroll for matrix */
@media (max-width: 768px) {
  .content-frame {
    overflow-x: auto;
    overflow-y: auto;
    padding: 1rem;
  }
}

.content-header {
  margin-bottom: 3rem;
}

.content-header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1.05rem;
  color: #64748b;
  font-weight: 400;
}

.content-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 2rem;
}

/* Tablet and smaller: Stack sections */
@media (max-width: 768px) {
  .content-sections {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* ============================================================
   CARDS & COMPONENTS
   ============================================================ */

.card {
  background-color: #ffffff;
  border-radius: 0.75rem;
  padding: 2rem;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.card h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 1.5rem;
}

.card p {
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: #ffffff;
  transition: all 0.3s ease;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(30, 58, 138, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.2);
}

.btn-full {
  width: 100%;
  padding: 12px !important;
  font-size: 16px;
}

.logout-btn {
  background-color: #dc2626;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-left: 0;
  min-height: auto;
  white-space: nowrap;
}

.logout-btn:hover {
  background-color: #b91c1c;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.session-tabs {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: 0;
  margin-right: 0;
  flex-wrap: nowrap;
}

.session-tab {
  background-color: #f1f5f9;
  color: #475569;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  min-height: auto;
}

.session-tab:hover {
  background-color: #e2e8f0;
}

.session-tab.active {
  background-color: #1e3a8a;
  color: white;
  border-color: #1e3a8a;
}

.session-tab.admin-tab {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #78350f;
  font-weight: 600;
}

.session-tab.admin-tab:hover {
  background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);
}

.session-tab.admin-tab.active {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: white;
  border-color: #b45309;
}

.session-tab-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  margin-left: 4px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.session-tab-close:hover {
  opacity: 1;
}

/* Footer session tabs and button */
.footer-session-tabs {
  margin-left: 0;
  margin-right: auto;
}

.footer-logout-btn {
  margin-left: 0;
}

/* ============================================================
   STATISTICS GRID
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.stat-item {
  background: linear-gradient(135deg, #e0e7ff 0%, #f0f4ff 100%);
  padding: 1.5rem;
  border-radius: 0.5rem;
  text-align: center;
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.85rem;
  color: #475569;
  font-weight: 500;
}

.users-table-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.users-table-container {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #ffffff;
}

.users-table thead {
  background-color: #f1f5f9;
  border-bottom: 2px solid #e2e8f0;
}

.users-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #1e293b;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.users-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  color: #475569;
  font-size: 0.95rem;
}

.users-table tbody tr:hover {
  background-color: #f8fafc;
}

.users-table tbody tr:last-child td {
  border-bottom: none;
}

.cell-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cell-badge {
  display: inline-block;
  background-color: #e0e7ff;
  color: #1e3a8a;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 500;
}

.delete-user-btn {
  background-color: #dc2626;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.delete-user-btn:hover {
  background-color: #b91c1c;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

.delete-user-btn:active {
  transform: scale(0.95);
}

.no-users-message {
  padding: 20px;
  text-align: center;
  color: #64748b;
  font-style: italic;
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */

.admin-section {
  background: linear-gradient(135deg, #fef3c7 0%, #fef9e7 100%);
  border: 2px solid #f59e0b;
}

.admin-section.hidden {
  display: none;
}

.admin-section h2 {
  color: #92400e;
  margin-bottom: 20px;
}

.admin-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.admin-add-user {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #fed7aa;
}

.admin-add-user h3 {
  color: #92400e;
  margin-bottom: 15px;
  font-size: 16px;
}

.admin-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.admin-form-group {
  display: flex;
  flex-direction: column;
}

.admin-form-group label {
  margin-bottom: 6px;
  font-weight: 600;
  color: #78350f;
  font-size: 13px;
}

.admin-form-group input {
  padding: 10px;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  font-size: 14px;
  background-color: #fffbeb;
}

.admin-form-group input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.admin-users-list {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #fed7aa;
}

.admin-users-list h3 {
  color: #92400e;
  margin-bottom: 15px;
  font-size: 16px;
}

.admin-users-table-container {
  overflow-x: visible;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-users-table thead {
  background-color: #fbbf24;
}

.admin-users-table th {
  padding: 10px;
  text-align: left;
  font-weight: 600;
  color: #78350f;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #f59e0b;
}

.admin-users-table td {
  padding: 10px;
  border-bottom: 1px solid #fed7aa;
  color: #78350f;
}

.admin-users-table tbody tr:hover {
  background-color: #fef9e7;
}

.admin-delete-btn {
  background-color: #dc2626;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-delete-btn:hover {
  background-color: #b91c1c;
}

@media (max-width: 1200px) {
  .admin-content {
    grid-template-columns: 1fr;
  }
  .admin-users-list {
    overflow-x: auto;
  }
}

/* ============================================================
   ACTIVITY LIST
   ============================================================ */

.activity-list {
  list-style: none;
}

.activity-list li {
  padding: 0.75rem 0;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.95rem;
}

.activity-list li:last-child {
  border-bottom: none;
}

/* ============================================================
   FOOTER FRAME
   ============================================================ */

.footer-frame {
  background-color: #1e293b;
  color: #e2e8f0;
  padding: 3rem 2rem 2rem;
  border-top: 1px solid #0f172a;
  flex-shrink: 0;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.footer-section h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #ffffff;
}

.footer-section p {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.6;
}

.footer-section ul {
  list-style: none;
}

.footer-section li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: #cbd5e1;
  transition: color 0.3s ease;
  font-size: 0.9rem;
}

.footer-section a:hover {
  color: #ffffff;
}

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid #334155;
  font-size: 0.85rem;
  color: #94a3b8;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 768px) {
  .header-frame {
    padding: 0 1rem;
    flex-wrap: wrap;
    height: auto;
    gap: 1rem;
  }

  .header-center {
    order: 3;
    flex-basis: 100%;
  }

  .nav-menu {
    flex-direction: column;
    gap: 0.5rem;
  }

  .header-right {
    flex-direction: column;
    width: 100%;
  }

  .search-bar {
    width: 100%;
  }

  .main-wrapper {
    flex-direction: column;
  }

  .sidebar-frame {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }

  .content-sections {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .content-header h1 {
    font-size: 1.75rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .header-frame {
    padding: 0.75rem;
  }

  .logo-text {
    display: none;
  }

  .content-frame {
    padding: 1rem;
  }

  .card {
    padding: 1.5rem;
  }

  .content-header h1 {
    font-size: 1.5rem;
  }

  .nav-menu {
    gap: 1rem;
  }
}

/* ============================================================
   3D MATRIX SECTION
   ============================================================ */

.matrix-container {
  margin: 2rem 0;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
  border-radius: 1rem;
  padding: 2rem;
}

.matrix-wrapper {
  display: flex;
  flex-direction: column;
  width: fit-content;
  margin: 0 auto;
}

.matrix-header-cols {
  display: grid;
  grid-template-columns: 40px 40px 40px repeat(10, 40px);
  gap: 0;
}

.header-spacer {
  display: none;
  width: 80px;
  height: 40px;
  background-color: #f8fafc;
}

.col-header {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1e3a8a;
  color: #ffffff;
  font-weight: 700;
  border-radius: 0;
  font-size: 0.9rem;
  min-width: 40px;
  border: 1px solid #0f172a;
}

.col-header.highlighted {
  background-color: #f59e0b;
  box-shadow: inset 0 0 10px rgba(245, 158, 11, 0.3);
}

.matrix-with-rows {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.matrix-label-away-team {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  background-color: #f8fafc;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e3a8a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  border: 1px solid #cbd5e1;
  flex-shrink: 0;
}

.matrix-header-rows {
  display: grid;
  grid-template-rows: repeat(10, 40px);
  width: 40px;
  gap: 0;
}

.row-header {
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1e3a8a;
  color: #ffffff;
  font-weight: 700;
  border-radius: 0;
  font-size: 0.9rem;
  border: 1px solid #0f172a;
  min-height: 40px;
}

.row-header.highlighted {
  background-color: #f59e0b;
  box-shadow: inset 0 0 10px rgba(245, 158, 11, 0.3);
}

.matrix-perspective {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(10, 40px);
  grid-template-rows: repeat(10, 40px);
  gap: 0;
  width: fit-content;
  min-height: 400px;
  padding: 0;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 0;
  border: 1px solid #cbd5e1;
  box-shadow: 0 10px 30px rgba(30, 58, 138, 0.1);
  transition: transform 0.3s ease;
  align-content: start;
}

.matrix-cell {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: #94a3b8;
  position: relative;
  overflow: visible;
  min-height: 40px;
  padding: 4px;
  gap: 2px;
  white-space: normal;
  text-align: center;
  word-wrap: break-word;
  line-height: 1.1;
}

.matrix-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1), transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.matrix-cell:hover {
  background-color: #e0e7ff;
  border-color: #c7d2fe;
  transform: none;
  box-shadow: 0 6px 12px rgba(30, 58, 138, 0.15);
}

.matrix-cell:hover::before {
  transform: translateX(100%);
}

.matrix-cell.selected {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  border-color: #1e3a8a;
  color: #ffffff;
  font-weight: 700;
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(30, 58, 138, 0.25);
}

.matrix-cell.selected::before {
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2), transparent 70%);
}

/* Matrix Locked State Styles */
.matrix-grid.matrix-locked {
  opacity: 0.7;
  background: rgba(255, 240, 240, 0.3);
  box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.1), 0 10px 30px rgba(30, 58, 138, 0.1);
}

.matrix-grid.matrix-locked .matrix-cell {
  background-color: #fef2f2;
  cursor: not-allowed;
  color: #9ca3af;
}

.matrix-grid.matrix-locked .matrix-cell:hover {
  background-color: #fef2f2;
  border-color: #e2e8f0;
  transform: none;
  box-shadow: none;
}

.matrix-grid.matrix-locked .matrix-cell.selected {
  opacity: 0.6;
  cursor: not-allowed;
}

.matrix-info {
  margin-top: 2rem;
  padding: 1.5rem;
  background-color: #f8fafc;
  border-radius: 0.75rem;
  border-left: 4px solid #1e3a8a;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

.matrix-info p {
  margin: 0.5rem 0;
  color: #475569;
  font-weight: 500;
}

.matrix-info span {
  font-weight: 700;
  color: #1e3a8a;
  font-size: 1rem;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.button-group .btn {
  margin: 0;
  flex: 0 1 auto;
  min-width: 140px;
  text-align: center;
}

/* ============================================================
   QUARTER SCORES SECTION
   ============================================================ */

.quarters-section {
  background-color: #ffffff;
  border-radius: 0.75rem;
  padding: 2rem;
  border: 1px solid #e2e8f0;
  margin-top: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.quarters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
}

.quarter-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quarter-box label {
  font-weight: 600;
  color: #1e3a8a;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quarter-input {
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
  background-color: #ffffff;
  color: #1e293b;
  font-family: inherit;
  resize: none;
  width: 100%;
  min-height: 40px;
  line-height: 1.5;
  overflow: hidden;
}

.quarter-input:focus {
  outline: none;
  border-color: #1e3a8a;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.quarter-input:read-only {
  background-color: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
  border-color: #cbd5e1;
}

.quarter-input:read-only:focus {
  box-shadow: none;
}

/* ============================================================
   SCROLLBAR STYLING (Webkit browsers)
   ============================================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
/* ============================================================
   MODAL DIALOG STYLES
   ============================================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 500px;
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  color: #1e293b;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #64748b;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.modal-close:hover {
  background-color: #f1f5f9;
  color: #1e293b;
}

.modal-body {
  padding: 24px;
}

.modal-body p {
  margin: 0 0 16px 0;
  color: #475569;
  font-size: 14px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 20px 24px;
  border-top: 1px solid #e2e8f0;
}

.btn-secondary {
  background-color: #e2e8f0;
  color: #1e293b;
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

/* ============================================================
   MOBILE DEVICE OPTIMIZATIONS
   ============================================================ */

/* Extra small devices (< 576px) */
@media (max-width: 575px) {
  /* Viewport and touch optimization */
  * {
    touch-action: manipulation;
  }

  /* Footer optimizations */
  .footer-frame {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .footer-session-tabs {
    flex-wrap: wrap;
    margin-right: 0.5rem;
  }

  .footer-logout-btn {
    margin-left: 0;
  }

  /* Header optimizations */
  .header-frame {
    flex-direction: column;
    padding: 0.5rem;
    height: auto;
    gap: 0.5rem;
  }

  .header-left {
    width: 100%;
  }

  .logo {
    justify-content: center;
  }

  .header-center {
    width: 100%;
    order: 3;
    flex-basis: 100%;
  }

  .header-right {
    width: 100%;
    flex-direction: column;
    gap: 0.5rem;
  }

  .search-bar {
    width: 100%;
    padding: 10px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .logout-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    min-height: 44px; /* Touch-friendly size */
  }

  /* Navigation menu optimizations */
  .nav-menu {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .nav-link {
    padding: 12px;
    display: block;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Content layout */
  .main-wrapper {
    flex-direction: column;
  }

  .content-frame {
    padding: 0.75rem;
    flex: 1;
    width: 100%;
  }

  .card {
    padding: 0.75rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }

  /* Typography for mobile */
  .content-header h1 {
    font-size: 1.75rem;
    line-height: 1.2;
  }

  h2 {
    font-size: 1.25rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  /* Forms and buttons */
  .form-group input,
  .form-group textarea,
  select {
    padding: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px;
  }

  .btn,
  button {
    padding: 12px 16px;
    font-size: 14px;
    min-height: 44px;
    border-radius: 6px;
    touch-action: manipulation;
  }

  .btn-full {
    width: 100%;
  }

  /* Matrix adjustments */
  #costPerCellMessage {
    font-size: 2.5rem !important;
    word-wrap: break-word;
    margin-bottom: 0.5rem;
  }

  .matrix-container {
    padding: 0.5rem;
    margin: 0.5rem 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    box-sizing: border-box;
    max-width: 100vw;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    background-color: #fff;
  }

  .matrix-wrapper {
    width: fit-content;
    min-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    padding: 5px;
  }

  .matrix-header-cols {
    grid-template-columns: 40px 40px 40px repeat(10, 40px);
    gap: 0;
    min-width: fit-content;
    width: fit-content;
  }

  .matrix-header-rows {
    grid-template-rows: repeat(10, 40px);
    width: 40px;
  }

  .col-header {
    width: 40px;
    height: 40px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .row-header {
    width: 40px;
    height: 40px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .matrix-grid {
    grid-template-columns: repeat(10, 40px);
    grid-template-rows: repeat(10, 40px);
  }

  .matrix-cell {
    width: 40px;
    height: 40px;
    font-size: 10px;
    cursor: pointer;
    touch-action: none;
  }

  .matrix-label-away-team {
    width: 40px;
  }

  /* Button groups */
  .button-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .button-group .btn {
    width: 100%;
  }

  /* Tables */
  table {
    font-size: 12px;
  }

  th, td {
    padding: 8px;
  }

  /* Modal optimization */
  .modal-content {
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-footer .btn {
    width: 100%;
  }

  /* Session tabs */
  .session-tabs {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .session-tab {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 32px;
  }

  /* Stats grid */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  /* Auth card */
  .auth-card {
    padding: 24px;
    margin: 10px;
    max-width: 100%;
  }

  .auth-header h1 {
    font-size: 24px;
  }

  .auth-form h2 {
    font-size: 18px;
  }

  .password-requirements {
    margin-top: 8px;
    font-size: 12px;
  }

  .req-item {
    padding: 4px 0;
    font-size: 12px;
  }

  /* Landscape orientation adjustments */
  @media (max-width: 575px) and (orientation: landscape) {
    .header-frame {
      padding: 0.5rem;
    }

    .content-frame {
      padding: 0.5rem;
    }

    #costPerCellMessage {
      font-size: 1.75rem !important;
      margin-bottom: 0.25rem;
    }

    .matrix-header-cols {
      grid-template-columns: 35px 35px 35px repeat(10, 35px);
      margin-left: 0;
    }

    .matrix-header-rows {
      grid-template-rows: repeat(10, 35px);
      width: 70px;
    }

    .matrix-grid {
      grid-template-columns: repeat(10, 35px);
      grid-template-rows: repeat(10, 35px);
    }

    .col-header, .row-header, .matrix-cell {
      width: 35px;
      height: 35px;
      font-size: 10px;
    }

    .matrix-label-away-team {
      width: 35px;
    }
  }
}

/* Small devices (576px - 768px) */
@media (min-width: 576px) and (max-width: 768px) {
  .header-frame {
    padding: 0.75rem;
  }

  .content-frame {
    padding: 1rem;
  }

  .card {
    padding: 1.25rem;
  }

  #costPerCellMessage {
    font-size: 3rem !important;
  }

  .btn, button {
    min-height: 40px;
    padding: 10px 14px;
  }

  .button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .matrix-header-cols {
    grid-template-columns: 50px 50px 50px repeat(10, 50px);
    margin-left: 0;
  }

  .matrix-header-rows {
    grid-template-rows: repeat(10, 50px);
    width: 50px;
  }

  .matrix-grid {
    grid-template-columns: repeat(10, 50px);
    grid-template-rows: repeat(10, 50px);
  }

  .col-header, .row-header, .matrix-cell {
    width: 50px;
    height: 50px;
    font-size: 11px;
  }

  .matrix-label-away-team {
    width: 100px;
  }
}

/* Large mobile devices (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  #costPerCellMessage {
    font-size: 3.5rem !important;
  }

  .button-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 0.75rem;
  }

  .content-sections {
    gap: 1rem;
  }
}