/* Pickleball extends the established CourtCast Organizer system in operations.css. */
body.pickleball-standard-page {
  overflow-x: hidden;
  padding-bottom: calc(94px + env(safe-area-inset-bottom));
  background: var(--paper);
}

.pickleball-standard-page .op-header { position: sticky; top: 0; }
.pickleball-standard-page .op-context small { text-transform: uppercase; }
.sync-state::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--orange); }
.sync-state.online::before { background: var(--green); box-shadow: 0 0 0 4px rgba(15,189,104,.13); }

.organizer-event { color: #fff; background: linear-gradient(135deg, var(--navy), #0b438f); }
.organizer-event-inner { width: min(1180px,100%); min-height: 102px; margin: 0 auto; padding: 22px 20px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.organizer-event h1 { margin: 3px 0 5px; font-size: clamp(23px,3vw,32px); letter-spacing: -.035em; }
.organizer-event p { margin: 0; color: #c7d5ea; font-size: 10px; }
.pickleball-tag { color: #63dfd0; font: 500 9px "DM Mono",monospace; letter-spacing: .12em; }
.event-logo { width: 70px; height: 70px; border-radius: 9px; object-fit: contain; padding: 5px; background: #fff; border: 1px solid rgba(255,255,255,.55); }
.event-logo[hidden] { display: none; }

.pickleball-standard-page .op-shell { padding-bottom: 112px; }
.court-board-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.court-board-toolbar small,.panel-head small { color: #6d7b96; font: 9px "DM Mono",monospace; letter-spacing: .12em; text-transform: uppercase; }
.court-board-toolbar h2 { margin: 5px 0 0; color: var(--navy); font-size: 25px; }
.pickleball-court-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.pickleball-court-grid .court-card { display: flex; flex-direction: column; min-height: 190px; }
.pickleball-court-grid .court-card h3 { min-height: 34px; margin-bottom: 6px; }
.pickle-team { min-height: 43px; display: grid; grid-template-columns: minmax(0,1fr) auto 34px; gap: 10px; align-items: center; border-top: 1px solid var(--line); }
.pickle-team > div { min-width: 0; }
.pickle-team strong,.pickle-team small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pickle-team strong { font-size: 11px; }
.pickle-team small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.pickle-team > span { color: var(--muted); font: 8px "DM Mono",monospace; }
.pickle-team > b { color: var(--navy); font: 700 22px "DM Mono",monospace; text-align: right; }
.pickle-team.serving strong::before { content: "●"; margin-right: 6px; color: var(--teal); font-size: 8px; }
.pickleball-court-grid .court-foot { margin-top: auto; }
.empty-state { grid-column: 1/-1; padding: 38px; border: 1px dashed var(--line); border-radius: 13px; background: #fff; color: var(--muted); text-align: center; }

.pickle-panel { margin-bottom: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-head h2 { margin: 4px 0 0; color: var(--navy); font-size: 19px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.field { display: grid; gap: 5px; }
.field.full { grid-column: 1/-1; }
.field label { color: var(--muted); font-size: 9px; font-weight: 700; }
.field input,.field select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: #fff; color: var(--text); }
.field input[type="file"] { padding: 10px 12px; }
.field input:focus,.field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(18,104,243,.1); }
.form-message { min-height: 17px; margin: 9px 0 0; color: #087d60; font-size: 9px; }
.form-message.error { color: #b5423c; }
.admin-court-toolbar { margin: 25px 0 14px; }
.admin-courts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.admin-courts .pickle-panel { margin: 0; }
.primary:disabled { cursor: not-allowed; opacity: .5; }

.referee-directory-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.referee-directory-card { margin: 0; display: grid; gap: 14px; }
.referee-directory-card .panel-head { margin: 0; }
.referee-directory-match { display: grid; gap: 7px; padding: 11px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.referee-directory-team { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--navy); font-size: 11px; }
.referee-directory-team > span { min-width: 0; }
.referee-directory-team strong,.referee-directory-team small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.referee-directory-team small { margin-top: 2px; color: var(--muted); font-size: 8px; font-weight: 400; }
.referee-directory-team b { font: 700 16px "DM Mono",monospace; }
.referee-open { min-height: 42px; display: grid; place-items: center; border-radius: 9px; text-decoration: none; }

.pickleball-nav { display: grid; grid-template-columns: repeat(4,1fr); position: fixed; left: 50%; right: auto; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(700px,calc(100% - 20px)); height: 72px; padding: 6px; gap: 4px; border: 1px solid rgba(151,169,197,.32); border-radius: 22px; background: rgba(250,252,255,.9); -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%); box-shadow: 0 18px 45px rgba(7,26,70,.18),inset 0 1px 0 rgba(255,255,255,.9); overflow: hidden; z-index: 50; }
.pickleball-public-nav { grid-template-columns: repeat(3,1fr); }
.pickleball-nav a { min-width: 0; border-radius: 16px; color: #65728c; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; position: relative; padding: 4px; transition: color .2s ease,background .24s ease,box-shadow .24s ease,transform .18s ease; }
.pickleball-nav a:active { transform: scale(.96); }
.pickleball-nav a.active { color: #fff; background: linear-gradient(145deg,#082b69,#087b9d); box-shadow: 0 7px 18px rgba(8,58,121,.28); }
.pickleball-nav a.active::before { content: ""; position: absolute; top: 5px; right: 9px; width: 5px; height: 5px; border-radius: 50%; background: #5cebd7; box-shadow: 0 0 8px #5cebd7; }
.pickleball-nav .tab-icon { display: grid; place-items: center; width: 26px; height: 26px; font-size: 18px; }
.pickleball-nav .tab-label { font-size: 8px; font-weight: 700; }

@media (max-width:760px) {
  .organizer-event-inner { min-height: 88px; padding: 18px 12px; }
  .event-logo { width: 58px; height: 58px; }
  .pickleball-court-grid,.admin-courts,.referee-directory-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .pickleball-standard-page .health { font-size: 0; }
}

@media (max-width:600px) and (orientation:portrait) {
  html.pickleball-live-document,html.pickleball-live-document body.pickleball-live-page { min-height: 100%; overflow-x:hidden; overflow-y:auto; }
  body.pickleball-live-page { min-height: 100dvh; padding-bottom: 0; }
  .pickleball-live-page .op-header { position: relative; height: 60px; }
  .pickleball-live-page .organizer-event-inner { min-height: 90px; padding: 14px 10px; }
  .pickleball-live-page .organizer-event h1 { font-size: 21px; }
  .pickleball-live-page .event-logo { width: 58px; height: 58px; }
  .pickleball-live-page .op-shell { height: calc(100dvh - 60px); min-height: 620px; padding: 8px 10px calc(78px + env(safe-area-inset-bottom)); overflow: visible; }
  .pickleball-live-page .op-section { height: 100%; min-height: 0; }
  .pickleball-live-page .court-board-toolbar { display: none; }
  .pickleball-live-page .pickleball-court-grid { height: 100%; min-height: 0; grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:repeat(3,minmax(0,1fr)); gap: 7px; }
  .pickleball-live-page .pickleball-court-grid .court-card { min-height: 0; padding: 8px 9px; border-radius: 11px; overflow: hidden; }
  .pickleball-live-page .court-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(9px,2.7vw,12px); }
  .pickleball-live-page .state { padding: 3px 4px; font-size: 6px; }
  .pickleball-live-page .pickleball-court-grid .court-card h3 { min-height: 0; margin: 6px 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(7px,2vw,9px); }
  .pickleball-live-page .pickle-team { min-height: 30px; grid-template-columns: minmax(0,1fr) auto 22px; gap: 4px; }
  .pickleball-live-page .pickle-team strong { font-size: clamp(8px,2.3vw,10px); }
  .pickleball-live-page .pickle-team small { margin-top: 1px; font-size: clamp(6px,1.8vw,7px); }
  .pickleball-live-page .pickle-team > span { font-size: 6px; }
  .pickleball-live-page .pickle-team > b { font-size: clamp(15px,4.5vw,20px); }
  .pickleball-live-page .court-foot { margin-top: auto; padding-top: 4px; font-size: 6px; }
  .pickleball-live-page .pickleball-nav { bottom: calc(6px + env(safe-area-inset-bottom)); height: 64px; width: calc(100% - 20px); border-radius: 19px; }

  html.pickleball-referees-document,html.pickleball-referees-document body.pickleball-referees-page { min-height: 100%; overflow-x:hidden; overflow-y:auto; }
  body.pickleball-referees-page { min-height: 100dvh; padding-bottom: 0; }
  .pickleball-referees-page .op-header { position: relative; height: 60px; }
  .pickleball-referees-page .organizer-event-inner { min-height: 90px; padding: 14px 10px; }
  .pickleball-referees-page .organizer-event h1 { font-size: 21px; }
  .pickleball-referees-page .event-logo { width: 58px; height: 58px; }
  .pickleball-referees-page .op-shell { height: calc(100dvh - 60px); min-height: 620px; padding: 8px 10px calc(78px + env(safe-area-inset-bottom)); overflow: visible; }
  .pickleball-referees-page .op-section { height: 100%; min-height: 0; }
  .pickleball-referees-page .court-board-toolbar { display: none; }
  .pickleball-referees-page .referee-directory-grid { height: 100%; min-height: 0; grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:repeat(3,minmax(0,1fr)); gap: 7px; }
  .pickleball-referees-page .referee-directory-card { min-height: 0; padding: 8px 9px; border-radius: 11px; gap: 4px; grid-template-rows: auto auto 1fr auto; overflow: hidden; }
  .pickleball-referees-page .referee-directory-card .panel-head { min-width: 0; gap: 4px; }
  .pickleball-referees-page .referee-directory-card .panel-head small { font-size: 6px; }
  .pickleball-referees-page .referee-directory-card .panel-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(10px,2.8vw,12px); }
  .pickleball-referees-page .referee-directory-card .state { padding: 3px 4px; font-size: 6px; }
  .pickleball-referees-page .referee-directory-card .pickleball-tag { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 6px; }
  .pickleball-referees-page .referee-directory-match { align-content: start; gap: 0; padding: 2px 0; }
  .pickleball-referees-page .referee-directory-team { min-height: 34px; font-size: clamp(8px,2.3vw,10px); }
  .pickleball-referees-page .referee-directory-team small { font-size: clamp(6px,1.8vw,7px); }
  .pickleball-referees-page .referee-directory-team b { font-size: clamp(14px,4vw,18px); }
  .pickleball-referees-page .referee-open { min-height: 28px; border-radius: 6px; font-size: 8px; }
  .pickleball-referees-page .pickleball-nav { bottom: calc(6px + env(safe-area-inset-bottom)); height: 64px; width: calc(100% - 20px); border-radius: 19px; }
}

@media (orientation:landscape) and (max-height:600px) {
  body.pickleball-standard-page { padding-bottom: 68px; }
  .pickleball-standard-page .op-shell { padding-bottom: 76px; }
  .pickleball-nav { bottom: calc(6px + env(safe-area-inset-bottom)); height: 56px; width: min(620px,calc(100% - 20px)); border-radius: 18px; padding: 5px; }
  .pickleball-nav a { flex-direction: row; gap: 6px; border-radius: 13px; }
  .pickleball-nav .tab-icon { width: 21px; height: 21px; font-size: 16px; }
}
