:root {
  --indigo:#1F4AA8;
  --blue:#4FA3F7;
  --dark:#2B2F3A;
  --muted:#667085;
  --success:#9BE000;
  --success-dark:#6FB300;
  --danger:#DC2626;
  --bg:#F2F5FB;

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-soft: 0 6px 20px rgba(0,0,0,.08);
  --shadow-card: 0 10px 30px rgba(0,0,0,.07);
}

* { box-sizing:border-box }
body {
  font-family:"Poppins",system-ui,Segoe UI,Arial,sans-serif;
  color:var(--dark);
  background:var(--bg);
}

img,
svg {
  max-width: 100%;
  height: auto;
}

/* ====================== */
/*  L O G I N  &  C A R D */
/* ====================== */
.bg {
  min-height:100vh;
  background: linear-gradient(160deg, #ffffff 0%, #e9f2ff 45%, #eef6ff 100%);
  display:flex;
  align-items:center;
  justify-content:center;
}

.card {
  width:100%;
  max-width:520px;
  background:white;
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  border:1px solid #e5e7f5;
}

/* Logo */
.logo {
  width:auto;
  height:auto;
  border-radius:0;
  background:transparent;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:none;
}
.logo-svg { width:42px; height:42px }
.logo-image {
  width:200px;
  max-width:100%;
  height:auto;
  display:block;
}

.link {
  color: var(--blue);
}

.link-button {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

.link-button:hover {
  color: var(--indigo);
}

.w3-blue {
  background-color: var(--indigo) !important;
}
.w3-indigo {
  background-color: var(--indigo) !important;
}
.w3-green {
  background-color: var(--success) !important;
  color: #1B1F28 !important;
}
.w3-blue:hover,
.w3-indigo:hover {
  background-color: var(--blue) !important;
}
.w3-green:hover {
  background-color: var(--success-dark) !important;
}
.w3-text-blue,
.w3-text-indigo {
  color: var(--indigo) !important;
}

/* Shared topbar layout: brand (left), academy (center), actions (right) */
.app-topbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 12px;
}

.app-topbar-left,
.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.app-topbar-right {
  margin-left: auto;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.app-brand {
  font-size: 1.2rem;
  line-height: 1;
}

.app-topbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: 46%;
  text-align: center;
  pointer-events: none;
}

.app-academy-name {
  display: inline-block;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar-btn {
  height: 34px;
  min-height: 34px;
  padding: 6px 12px !important;
}

.app-btn-label-short {
  display: none;
}

.app-topbar-page-title {
  font-weight: 600;
}

.app-user-badge .w3-tag {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-workspace-card {
  margin-bottom: 16px;
}

.dashboard-workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard-workspace-kicker {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dashboard-workspace-title {
  margin: 0;
  color: var(--indigo);
  font-size: 1.45rem;
  line-height: 1.15;
}

.dashboard-workspace-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.dashboard-workspace-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-workspace-pill {
  border: 1px solid #d3d7f3;
  border-radius: 999px;
  background: #fff;
  color: var(--dark);
  font: inherit;
  font-weight: 600;
  line-height: 1;
  min-height: 38px;
  padding: 10px 14px;
  cursor: pointer;
  transition: .16s ease;
}

.dashboard-workspace-pill:hover {
  border-color: #b4c0f3;
  background: #f6f8ff;
}

.dashboard-workspace-pill.is-active {
  background: var(--indigo);
  color: #fff;
  border-color: var(--indigo);
  box-shadow: 0 10px 24px rgba(31,74,168,.18);
}

.dashboard-module-card {
  animation: fade .2s ease;
}

@media (max-width: 860px) {
  .app-topbar-center {
    max-width: 36%;
  }
}

@media (max-width: 680px) {
  .app-topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "left center"
      "right right";
    column-gap: 10px;
    row-gap: 6px;
    padding: 8px 10px;
    min-height: auto;
  }

  .app-topbar-left {
    grid-area: left;
    min-width: 0;
  }

  .app-topbar-center {
    grid-area: center;
    position: static;
    transform: none;
    width: auto;
    max-width: none;
    min-width: 0;
    margin-left: auto;
    text-align: right;
    pointer-events: auto;
  }

  .app-topbar-right {
    grid-area: right;
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    row-gap: 6px;
  }

  .app-academy-name {
    max-width: 100%;
    font-size: 0.96rem;
  }

  .app-user-badge {
    flex: 1 1 100%;
    min-width: 0;
    text-align: left;
  }

  .app-user-badge .w3-tag {
    display: block;
    width: 100%;
    max-width: none;
  }

  .dashboard-workspace-title {
    font-size: 1.2rem;
  }

  .dashboard-workspace-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .dashboard-workspace-pill {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

.fc .fc-daygrid-event {
  border: none;
  padding: 6px;
  margin: 4px 0;
  overflow: hidden;
  max-width: 100%;
}
.fc .fc-daygrid-event .fc-event-main {
  color: #fff;
  white-space: normal;
}
.fc .fc-event-time {
  display: none;
}
.fc .fc-event-title {
  display: none;
}
.fc .fc-time {
  font-weight: 600;
  margin-bottom: 4px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.fc .fc-levels {
  display: none;
}

.fc .fc-daygrid-day-frame,
.fc .fc-daygrid-day-events {
  overflow: hidden;
}

.fc .fc-daygrid-event-harness {
  width: 100%;
}

.fc .fc-daygrid-event .w3-button {
  display: block;
  width: 100%;
  margin: 6px 0 0 !important;
  height: auto;
  padding: 6px 10px;
  font-weight: 600;
}

.fc .fc-attendance-btn {
  background: rgba(255,255,255,0.92) !important;
  color: #1B1F28 !important;
  border-color: rgba(255,255,255,0.6) !important;
}

.fc .fc-edit-btn {
  background: rgba(255,255,255,0.92) !important;
  color: #1B1F28 !important;
  border-color: rgba(255,255,255,0.6) !important;
}

.fc .fc-attendance-btn:hover,
.fc .fc-edit-btn:hover {
  background: #fff !important;
  filter: brightness(0.97);
}

.fc .fc-button-primary {
  background: #F59E0B !important;
  border-color: #F59E0B !important;
  color: #1B1F28 !important;
}

.fc .fc-button-primary:hover,
.fc .fc-button-primary:focus {
  background: #FB923C !important;
  border-color: #FB923C !important;
  color: #1B1F28 !important;
}

.calendar-tooltip {
  position: fixed;
  z-index: 9999;
  display: none;
  max-width: 260px;
  background: #1B1F28;
  color: #ffffff;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  line-height: 1.3;
}

/* Views */
.view { display:none; animation:fade .25s ease }
.view.active { display:block }

/* Inputs */
.w3-input, .w3-select {
  height:44px;
  border-radius: var(--radius-lg) !important;
  border: 1px solid #d3d7f3 !important;
  padding-left:14px;
}

.w3-input:focus,
.w3-select:focus,
textarea.w3-input:focus {
  border-color: var(--blue) !important;
}

.w3-input:focus-visible,
.w3-select:focus-visible,
textarea.w3-input:focus-visible,
.w3-button:focus-visible,
.link-button:focus-visible {
  outline: 3px solid rgba(79,163,247,.28);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(79,163,247,.12);
}

textarea.w3-input {
  height:auto;
  min-height:80px;
}

/* Buttons */
.w3-button {
  border-radius: var(--radius-xl) !important;
  font-weight:600;
  height:44px;
  transition:0.15s ease;
}

.w3-button:hover {
  transform: translateY(-1px);
  box-shadow:0 8px 20px rgba(0,0,0,.08);
}

.w3-button[disabled] {
  opacity: .72;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-message {
  min-height: 24px;
}

/* Modals */
.w3-modal-content {
  border-radius: var(--radius-xl) !important;
  box-shadow: var(--shadow-card);
}

/* Lists (athlete cards, user cards) */
.card-list {
  border-radius: var(--radius-lg);
  padding:16px;
  background:white;
  box-shadow: var(--shadow-soft);
  margin-bottom:14px;
}

/* Animación */
@keyframes fade {
  from { opacity:0; transform:translateY(6px) }
  to { opacity:1; transform:none }
}

.no-left-right {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll > table {
  min-width: 640px;
}

.callup-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.callup-action-bar .w3-button {
  margin: 0 !important;
}

body .w3-content {
  width: min(100%, calc(100% - 24px));
  margin: 0 auto;
}

body .scope-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body .scope-tabs .w3-button {
  margin: 0 !important;
  flex: 1 1 170px;
}

body .player-row {
  gap: 12px;
}

body .player-row > div:first-child {
  flex: 1 1 220px;
  min-width: 0;
}

body #teamSummaryCards,
body #playerSummaryCards {
  gap: 12px;
}

body .scard {
  flex: 1 1 150px;
  min-width: 140px;
  max-width: 220px;
  margin: 0;
}

body #teamTableContent,
body #playerHistoryContent {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body .team-row {
  min-width: 720px;
}

body .mh-row {
  min-width: 860px;
}

body .main-tab-btn {
  margin-right: 0;
}

@media (max-width: 768px) {
  body .w3-content {
    width: calc(100% - 16px);
  }

  body .w3-card,
  body .card {
    border-radius: 18px !important;
  }

  body .w3-row > [class*="w3-col"],
  body .w3-row-padding > [class*="w3-col"] {
    margin-bottom: 10px;
  }

  body .w3-row > [class*="w3-col"].w3-right-align,
  body .w3-row-padding > [class*="w3-col"].w3-right-align {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    text-align: left !important;
    margin-top: 8px;
  }

  body .w3-row > [class*="w3-col"].w3-right-align .w3-button,
  body .w3-row-padding > [class*="w3-col"].w3-right-align .w3-button {
    margin: 0 !important;
  }

  body .w3-modal {
    padding: 8px;
  }

  body .w3-modal-content {
    width: 100% !important;
    max-width: none !important;
    margin: 20px auto !important;
  }

  footer.w3-container.w3-padding.w3-right-align {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    text-align: left !important;
  }

  footer.w3-container.w3-padding.w3-right-align .w3-button {
    flex: 1 1 calc(50% - 8px);
    margin: 0 !important;
  }

  body input[type="month"][style*="max-width:180px"] {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
  }

  body input[type="month"][style*="max-width:180px"] + .w3-button {
    width: 100%;
    margin-left: 0 !important;
    margin-top: 8px !important;
  }

  body .callup-action-bar .w3-button,
  body .scope-tabs .w3-button,
  body .main-tab-btn {
    flex: 1 1 calc(50% - 8px);
  }

  body .player-row {
    flex-wrap: wrap;
    align-items: flex-start !important;
    justify-content: flex-start !important;
  }

  body .player-row > span {
    width: 100%;
    text-align: left;
  }

  body .w3-button {
    height: auto;
    min-height: 44px;
  }

  body .team-row {
    min-width: 680px;
    font-size: 0.82em;
  }

  body .mh-row {
    min-width: 780px;
    font-size: 0.78em;
  }
}

@media (max-width: 540px) {
  .app-topbar {
    row-gap: 5px;
  }

  .app-topbar-left,
  .app-topbar-right {
    gap: 6px;
  }

  .app-brand {
    font-size: 1.08rem;
  }

  .app-topbar-page-title {
    font-size: 0.78rem;
  }

  .app-topbar-right .w3-button,
  .app-topbar-btn {
    width: auto;
    flex: 0 1 auto;
  }

  .app-topbar-btn {
    height: 32px;
    min-height: 32px;
    padding: 5px 10px !important;
    font-size: 0.74rem;
  }

  .app-topbar-btn .app-btn-label-full {
    display: none;
  }

  .app-topbar-btn .app-btn-label-short {
    display: inline;
  }

  .app-user-badge {
    text-align: left;
  }

  .app-user-badge .w3-tag {
    padding-left: 10px !important;
    padding-right: 10px !important;
    text-align: center;
  }

  body .callup-action-bar .w3-button,
  body .scope-tabs .w3-button,
  body .main-tab-btn,
  footer.w3-container.w3-padding.w3-right-align .w3-button,
  body .w3-row > [class*="w3-col"].w3-right-align .w3-button,
  body .w3-row-padding > [class*="w3-col"].w3-right-align .w3-button {
    flex: 1 1 100%;
    width: 100%;
  }

  body .scard {
    max-width: none;
    flex: 1 1 100%;
  }
}
