/* =========================================
   Event Shared Styles (Hero, Tabs, Layout)
   ========================================= */

/* Hero Section */
.event-hero {
  background: linear-gradient(135deg, #00152b 0%, #003b7a 100%);
  color: white; padding: 30px 20px; box-sizing: border-box; text-align: center; position: relative; overflow: hidden;
  min-height: 240px; display: flex; align-items: center; justify-content: center;
}
.event-hero-bg-accent {
  position: absolute; top: -50%; left: -10%; width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(0,123,255,0.2) 0%, rgba(0,0,0,0) 70%); z-index: 1;
}
.event-hero-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; width: 100%; }
.event-hero-badge { color: white; padding: 4px 14px; border-radius: 20px; font-weight: 700; font-size: 0.85rem; }
.badge-upcoming { background: #17a2b8; }
.badge-current { background: #e74c3c; }
.badge-past { background: #6c757d; }
.event-hero-title { font-size: 2.5rem; margin: 0 0 5px 0; font-weight: normal; }
.event-hero-subtitle { font-size: 1.2rem; color: #a3d1ff; margin: 0 0 15px 0; font-weight: 600; text-transform: uppercase; }
.event-hero-meta { display: flex; gap: 25px; font-size: 1.1rem; font-weight: 500; margin-top: 15px; }

/* Tabs Navigation */
.event-tabs-container {
  background: white; border-bottom: 1px solid #e1e8ed; position: sticky; top: 78px; z-index: 100;
}
.event-tabs { list-style: none; margin: 0 auto; display: flex; gap: 2.5rem; justify-content: center; height: 60px; padding: 0; }
.event-tabs a { display: flex; align-items: center; height: 100%; color: #657786; text-decoration: none; font-weight: 700; text-transform: uppercase; border-top: 4px solid transparent; border-bottom: 4px solid transparent; box-sizing: border-box; transition: color 0.2s; }
@media (hover: hover) and (pointer: fine) {
  .event-tabs a:hover:not(.active) { color: #43515c; }
}
.event-tabs a.active { color: #007bff; border-bottom-color: #007bff; }

/* Content Area Common */
.event-page-content { max-width: 1300px; margin: 3rem auto; padding: 0 20px; min-height: 50vh; }
.fade-in { animation: slideUpFade 0.5s ease-out; }
@keyframes slideUpFade { 0% { opacity: 0; transform: translateY(20px); } 100% { opacity: 1; transform: translateY(0); } }

/* Cards & Sections */
.overview-card, .format-section, .team-section { background: #ffffff; border-radius: 8px; padding: 30px 40px 40px; margin-bottom: 3rem; border: 1px solid #dee2e6; border-top: 4px solid #007bff; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); }
.overview-card h2, .format-section h2, .team-section h2 { border-bottom: 2px solid #007bff; padding-bottom: 10px; display: inline-block; margin: 0 0 15px 0; }
.overview-section { max-width: 1000px; margin: 0 auto; }
.overview-section p { color: #444; line-height: 1.8; margin: 0; font-size: 0.95rem; }
.format-item { margin-top: 0; margin-bottom: 35px; }
.format-item:last-child { margin-bottom: 0; }
.format-item h3 { color: #222; font-size: 1.15rem; margin: 0 0 10px 0; }

.stage-section { background: #ffffff; border-radius: 8px; padding: 30px 40px 40px; border: 1px solid #dee2e6; border-top: 4px solid #007bff; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); }
.stage-header { text-align: center; margin-bottom: 40px; }
.stage-title { font-size: 2.2rem; margin: 0 0 6px 0; font-weight: 900; line-height: 1.2; }
.stage-subtitle { color: #657786; font-size: 1rem; text-transform: uppercase; margin: 0; }

/* Teams */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; margin-top: 5px; }
.team-card { background: #ffffff; border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 4px 12px rgba(0,0,0,0.04); padding: 12px 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 15px; border-radius: 12px; transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, background-color 0.6s cubic-bezier(0.16, 1, 0.3, 1); cursor: pointer; }
.team-card-header { display: flex; align-items: center; gap: 15px; width: 100%; pointer-events: none; }
.team-card .team-icon { font-size: 1.5rem; background: transparent; width: 56px; height: 56px; min-width: 56px; display: flex; align-items: center; justify-content: center; border-radius: 8px; overflow: hidden; pointer-events: auto; }
.team-card .team-icon, .team-card .team-name { transition: all 0.3s ease; position: relative; z-index: 2; }
.team-card .team-name { font-size: 1.0rem; font-weight: 700; color: #222; pointer-events: auto; }

/* Inline Expansion Accordion */
.team-accordion { width: 100%; display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.5s cubic-bezier(0.16, 1, 0.3, 1); cursor: default; }
.team-accordion-inner { overflow: hidden; padding-top: 0; border-top: 1px solid transparent; transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1); opacity: 0; }

.team-card.expanded { border-color: #007bff; box-shadow: 0 10px 30px rgba(0, 123, 255, 0.12); /* background: #fdfeff; */ }
.team-card.expanded .team-accordion { grid-template-rows: 1fr; }
.team-card.expanded .team-accordion-inner { padding-top: 15px; margin-top: 15px; border-top: 1px solid #eee; opacity: 1; }
.team-accordion .modal-history { padding-left: 0 !important; }
.team-accordion .modal-history > div:first-child { color: #888; font-size: 0.85rem; padding-bottom: 10px; margin-bottom: 0; border-bottom: none; }
.team-accordion .roster-grid { grid-template-columns: repeat(2, 1fr) !important; }

@media (hover: none) {
  .team-card:active {
    transform: scale(0.94);
    background-color: #f0f6ff !important;
    box-shadow: inset 0 8px 16px rgba(0,40,100,0.1) !important;
    transition: background-color 0s, transform 0.1s ease-out, box-shadow 0s;
  }
}

/* Team Card Hover Base (Underline Expansion) */
.team-grid .team-card { position: relative; border-color: transparent !important; }
.team-grid .team-card::after { content: ''; position: absolute; bottom: 0; left: 50%; width: 0; height: 3px; background: #007bff; box-shadow: 0 0 10px rgba(0, 123, 255, 0.4); transition: all 0.3s ease; transform: translateX(-50%); border-radius: 3px; }

/* Match Card */
.match-card {
  background: #ffffff; border: 1px solid #e1e8ed; border-radius: 8px; width: 100%; height: 80px;
  display: flex; flex-direction: column; position: relative; box-sizing: border-box; box-shadow: 0 4px 15px rgba(0,0,0,0.02);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (hover: hover) and (pointer: fine) {
  .match-card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0, 123, 255, 0.15); }
}
@media (hover: none) {
  .match-card:active {
    transform: scale(0.96);
    background-color: #f0f6ff !important;
    box-shadow: inset 0 6px 12px rgba(0,40,100,0.08) !important;
    transition: background-color 0s, transform 0.1s ease-out, box-shadow 0s;
  }
}

.vod-badge {
  position: absolute;
  top: -15px;
  right: -15px;
  background: linear-gradient(135deg, #111, #333);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  z-index: 5;
  box-shadow: 0 2px 5px rgba(0,0,0,0.25);
  pointer-events: none;
}
.match-divider { height: 1px; background: #e1e8ed; width: 100%; position: absolute; top: 39px; z-index: 10; }
.match-team {
  display: flex; justify-content: space-between; align-items: center; padding: 0 15px; height: 40px;
  box-sizing: border-box; background: #f8fbff; border-left: 4px solid transparent; transition: all 0.2s ease;
}
.match-team:first-child, .vod-badge + .match-team { border-top-left-radius: 8px; border-top-right-radius: 8px; }
.match-team:last-child { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }
.match-team.winner { background: #ffffff; border-left-color: #007bff; font-weight: 800; }
.match-team.winner .team-name, .match-team.winner .team-score { color: #111; }
.match-team.winner .team-score { color: #007bff; }
.match-team.loser { background: #f0f4f8; }
.match-team.loser .team-name, .match-team.loser .team-score { color: #8899a6; font-weight: 400; }
.team-info { display: flex; align-items: center; gap: 10px; }
.team-info .team-icon { font-size: 1.1rem; opacity: 0.8; background: transparent; width: 36px; height: 36px; min-width: 36px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.team-name { font-size: 0.95rem; color: #555; font-weight: 600; }
.team-score { font-size: 1rem; color: #555; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Modals */
.qed-modal-overlay { display: none !important; opacity: 0; transition: opacity 0.3s; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; pointer-events: none; }
.qed-modal-overlay.active { opacity: 1; pointer-events: auto; display: block !important; }
.qed-modal {
  display: block; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 700px; margin: 0;
  background: #ffffff; color: #333; border-radius: 8px; z-index: 2001; padding: 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15); opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  border: 1px solid #dee2e6; max-width: 95vw; max-height: 90vh; overflow-y: auto;
  overflow-x: hidden;
}
.qed-modal.active { opacity: 1; pointer-events: auto; }
.qed-modal-close {
  position: absolute; top: 10px; right: 12px; background: none; border: none; font-size: 28px;
  color: #8899a6; cursor: pointer; transition: color 0.2s, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease; padding: 0; line-height: 1; z-index: 2002;
}
@media (hover: hover) and (pointer: fine) {
  .qed-modal-close:hover { color: #000; }
}
@media (hover: none) {
  .qed-modal-close:active {
    transform: scale(0.8);
    opacity: 0.6;
    transition: transform 0.1s ease-out, opacity 0s;
  }
}
.header-team-modal { gap: 60px; }
.modal-history { padding-left: 60px; }

.modal-header { padding: 20px 15px; border-bottom: 1px solid #eee; text-align: center; }
.modal-body { padding: 20px 15px 15px; }
.modal-vs { font-size: 1.5rem; color: #888; margin: 0 20px; font-weight: 900; }
.modal-score { font-size: 2.5rem; font-weight: 900; margin: 0 15px; display: inline-block; width: 55px; text-align: center; }
.modal-score.winner { color: #007bff; }
.modal-score.loser { color: #e74c3c; }
.modal-team { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; max-width: 150px; }
.modal-team img { width: 85px; height: 85px; object-fit: contain; }
.modal-team-name { font-weight: 700; font-size: 1.05rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; display: block; line-height: 1.15; padding: 0 10px; box-sizing: border-box; }
.modal-match-meta { display: flex; justify-content: center; gap: 20px; font-size: 0.95rem; font-weight: 700; color: #555; margin-bottom: -15px; }

.map-scores { display: flex; flex-direction: column; gap: 5px; margin-top: 0; }
.map-row { display: grid; grid-template-columns: 1fr 110px 1fr; gap: 15px; align-items: center; text-align: center; padding: 8px 0; }
.map-name { font-weight: 700; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 5px; width: 100%; box-sizing: border-box; }
.map-side { display: flex; align-items: center; gap: 8px; }
.map-side.left { justify-content: flex-end; }
.map-side.right { justify-content: flex-start; }
.map-score { font-size: 1.25rem; font-weight: 800; display: inline-block; width: 35px; text-align: center; }
.map-score-left { text-align: right; }
.map-score-right { text-align: left; }
.agent-list { display: flex; gap: 4px; }
.agent-icon { width: 42px; height: 42px; background: #d0d7de; border-radius: 4px; }
.map-score.winner { color: #007bff; }
.map-score.loser { color: #e74c3c; }

.roster-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 12px; margin-top: 15px; }
.roster-card { background: #f0f4f8; padding: 15px 10px; border-radius: 8px; text-align: center; min-width: 0; }
.roster-ign { font-weight: bold; margin-bottom: 5px; font-size: 1.1rem; color: #222; }
.roster-role { font-size: 0.85rem; color: #555; }

/* Responsive Adjustments */
@media (max-width: 767px) {
  .event-hero { padding: 30px 15px; }
  .event-hero-title { font-size: clamp(1.5rem, 7vw, 2.1rem); }
  .event-hero-subtitle { font-size: clamp(1rem, 4vw, 1.2rem); }
  .event-page-content { margin: 3rem auto; padding: 0 15px; }
  .overview-card, .format-section, .team-section, .stage-section { padding: 25px 20px; margin-bottom: 3rem; }
  .stage-title { font-size: clamp(1.8rem, 8vw, 2.2rem); }
  
  .match-team { padding: 0 10px; }
  .team-info { gap: 6px; }
  .team-info .team-icon { width: 32px; height: 32px; min-width: 32px; font-size: 0.95rem; }
  
  .lower-header-inline { font-size: 0.8rem; white-space: nowrap; }

  .qed-modal-overlay { background: rgba(0,0,0,0.5) !important; }

  .qed-modal {
    position: fixed !important; top: 50% !important; left: 50% !important; transform: translate(-50%, -50%) !important;
    width: 96vw !important; max-width: 400px; min-width: 0 !important; max-height: 90vh; z-index: 2001 !important;
    overflow-x: hidden;
  }
  .qed-modal::before, .qed-modal::after { display: none !important; }

  /* Bottom Sheet Modals Override */
  .match-modal, .team-modal {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    transform: translateY(100vh) !important;
    width: 100% !important;
    max-width: none !important;
    max-height: 85vh !important;
    border-radius: 20px 20px 0 0 !important;
    margin: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 20px) !important;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease !important;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15) !important;
  }
  .match-modal.active, .team-modal.active {
    transform: translateY(0) !important;
  }
  .match-modal::before, .team-modal::before {
    content: '';
    display: block !important;
    width: 40px;
    height: 5px;
    background: #e1e8ed;
    border-radius: 3px;
    margin: 12px auto -5px;
  }
  .match-modal .modal-header, .team-modal .modal-header { border-bottom: none !important; padding-top: 15px !important; }
  
  .roster-grid { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; margin-top: 10px !important; }
  .roster-card { min-width: 0 !important; padding: 10px 5px !important; }
  .roster-ign { font-size: 0.85rem !important; margin-bottom: 2px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .roster-role { font-size: 0.7rem !important; }
  
  .header-team-modal { gap: 25px !important; }
  .modal-history { padding-left: 25px !important; }
  .modal-header { padding: 15px 5px !important; }
  .modal-body { padding: 15px 5px !important; }
  .modal-team { max-width: 100% !important; }
  .modal-team img { width: 60px !important; height: 60px !important; }
  .modal-team-name { font-size: 0.9rem !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; width: 100% !important; display: block !important; padding: 0 2px !important; box-sizing: border-box !important; }
  .modal-score { font-size: 2.2rem !important; margin: 0 !important; width: 40px !important; text-align: center !important; }
  .modal-vs { font-size: 1.2rem !important; margin: 0 !important; }
  .modal-header > div[style*="grid"] { grid-template-columns: 1fr 70px 1fr !important; gap: 2px !important; }
  .map-row { grid-template-columns: 1fr 70px 1fr !important; padding: 5px 0 !important; gap: 2px !important; }
  .map-side { gap: 3px !important; }
  .map-score { font-size: 1.1rem !important; width: 22px !important; }
  .map-name { font-size: 0.85rem; }
  .agent-icon { width: clamp(14px, 5.5vw, 24px) !important; height: clamp(14px, 5.5vw, 24px) !important; border-radius: 2px; }
  .agent-list { gap: 1px !important; }
  .modal-header > div[style*="border-left"] { padding-left: 10px !important; }
}

/* Playoff Explicit Grid Layout */
.playoff-grid { display: grid; grid-template-columns: minmax(320px, 500px) minmax(300px, 400px); gap: 40px; margin-top: 40px; justify-content: center; align-items: start; }
.playoff-matches-col { display: flex; flex-direction: column; gap: 30px; width: 100%; }
.playoff-standings-col { background: #ffffff; border: 1px solid #e1e8ed; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.02); overflow: hidden; width: 100%; }

@media (max-width: 767px) {
  .playoff-grid { grid-template-columns: 1fr; max-width: 500px; margin-left: auto; margin-right: auto; }
  .team-grid { grid-template-columns: 1fr; }
}
