/* ======================================================
   BAKERY WORLD – DEEP RED THEME
   Full conversion from original navy/gold stylesheet
   Updated with SCORE_EVENTS + SCORE_JUDGES spacing fixes
====================================================== */

:root{
  --bw-red:#dc2626;
  --bw-red-dark:#b91c1c;
  --bw-red-deep:#991b1b;
  --bw-red-light:#ef4444;
  --bw-red-soft:#fee2e2;

  --bw-gold:#facc15;
  --bw-gold-light:#fde68a;

  --bw-cream:#fff5f5;
  --bw-border:#f1d5d5;
  --bw-border-strong:#e9bcbc;
  --bw-text:#111827;
  --bw-muted:#6b7280;
  --bw-soft:#fffafa;

  --bw-card-radius:22px;
  --bw-card-shadow:0 10px 28px rgba(185,28,28,.06);
  --bw-card-shadow-lg:0 18px 40px rgba(220,38,38,.16);

  --sheet-width:1123px;
  --sheet-height:794px;
}

/* ======================================================
   GLOBAL LAYOUT / GUTTERS
====================================================== */

.container-fluid{
  padding-left:1.25rem;
  padding-right:1.25rem;
}

@media (max-width: 768px){
  .container-fluid{
    padding-left:.9rem;
    padding-right:.9rem;
  }
}

/* ======================================================
   BUILDER WRAP
====================================================== */

.score-builder-wrap{
  padding:1.25rem;
}

/* ======================================================
   BUILDER PAGE HEADER
====================================================== */

.score-page-header{
  background:linear-gradient(135deg, rgba(185,28,28,.98), rgba(220,38,38,.96));
  color:#fff;
  border-radius:24px;
  padding:1.4rem 1.5rem;
  box-shadow:var(--bw-card-shadow-lg);
  margin-bottom:1.25rem;
  position:relative;
  overflow:hidden;
}
.score-page-header::after{
  content:"";
  position:absolute;
  inset:auto -60px -60px auto;
  width:180px;
  height:180px;
  background:radial-gradient(circle, rgba(250,204,21,.18), transparent 70%);
  pointer-events:none;
}
.score-page-title{
  margin:0;
  font-weight:800;
  letter-spacing:.2px;
}
.score-page-subtitle{
  margin:.35rem 0 0;
  color:rgba(255,255,255,.82);
}

/* ======================================================
   CARDS
====================================================== */

.bw-card{
  background:#fff;
  border:1px solid rgba(185,28,28,.08);
  border-radius:var(--bw-card-radius);
  box-shadow:var(--bw-card-shadow);
  overflow:hidden;
  height:100%;
  margin-bottom:1.25rem;
}
.bw-card-header{
  padding:1.1rem 1.3rem;
  border-bottom:1px solid #f7dede;
  background:linear-gradient(180deg, #fff, #fff8f8);
}
.bw-card-title{
  font-size:1rem;
  font-weight:800;
  color:var(--bw-red);
  margin:0;
}
.bw-card-subtitle{
  margin:.2rem 0 0;
  color:var(--bw-muted);
  font-size:.84rem;
  line-height:1.45;
}
.bw-card-body{
  padding:1.25rem 1.3rem 1.35rem;
}

/* ======================================================
   BUILDER LAYOUT
====================================================== */

.builder-topbar{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) 280px auto;
  gap:.75rem;
  margin-bottom:1rem;
}
@media (max-width: 1400px){
  .builder-topbar{
    grid-template-columns:1fr 1fr;
  }
}
@media (max-width: 768px){
  .builder-topbar{
    grid-template-columns:1fr;
  }
}

.builder-main{
  display:grid;
  grid-template-columns:360px minmax(0,1fr);
  gap:1rem;
  align-items:start;
}
@media (max-width: 1400px){
  .builder-main{
    grid-template-columns:1fr;
  }
}

/* ======================================================
   FORMS
====================================================== */

.form-label-strong{
  font-size:.82rem;
  font-weight:800;
  color:var(--bw-red);
  margin-bottom:.35rem;
}

.form-control,
.form-select{
  border-radius:14px;
  border-color:#ead2d2;
}

.form-control:focus,
.form-select:focus{
  border-color:rgba(220,38,38,.4);
  box-shadow:0 0 0 .18rem rgba(220,38,38,.08);
}

.form-check-input:checked{
  background-color:#dc2626;
  border-color:#dc2626;
}

/* ======================================================
   BUTTONS
====================================================== */

.btn{
  border-radius:14px;
  font-weight:700;
}

.bw-btn-primary{
  background:var(--bw-red);
  border-color:var(--bw-red);
  color:#fff;
}
.bw-btn-primary:hover{
  background:var(--bw-red-dark);
  border-color:var(--bw-red-dark);
  color:#fff;
}

.bw-btn-gold{
  background:var(--bw-gold);
  border-color:var(--bw-gold);
  color:#1f2937;
}
.bw-btn-gold:hover{
  background:#eab308;
  border-color:#eab308;
  color:#111827;
}

.btn-outline-primary{
  color:var(--bw-red);
  border-color:#ef9a9a;
}
.btn-outline-primary:hover{
  background:var(--bw-red);
  border-color:var(--bw-red);
  color:#fff;
}

.btn-outline-secondary{
  color:#7f1d1d;
  border-color:#e7bcbc;
}
.btn-outline-secondary:hover{
  background:#fff1f2;
  border-color:#dc2626;
  color:var(--bw-red);
}

.btn-outline-danger{
  color:#b91c1c;
  border-color:#f0a8a8;
}
.btn-outline-danger:hover{
  background:#b91c1c;
  border-color:#b91c1c;
  color:#fff;
}

.btn-outline-dark{
  color:#7f1d1d;
  border-color:#e5bcbc;
}
.btn-outline-dark:hover{
  background:#7f1d1d;
  border-color:#7f1d1d;
  color:#fff;
}

/* ======================================================
   CONTENT SECTIONS
====================================================== */

.section-title-sm{
  font-size:.78rem;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:var(--bw-muted);
  margin-bottom:.55rem;
}

.control-section + .control-section{
  margin-top:1.2rem;
  padding-top:1.2rem;
  border-top:1px solid #f4dede;
}

/* ======================================================
   CRITERIA
====================================================== */

.criteria-row{
  border:1px solid #f1d5d5;
  border-radius:16px;
  padding:.75rem;
  background:#fff;
}
.criteria-row + .criteria-row{
  margin-top:.65rem;
}

.criteria-row .row{
  --bs-gutter-x:.55rem;
  --bs-gutter-y:.55rem;
}

/* ======================================================
   NOTES / HELPERS
====================================================== */

.helper-note{
  background:#fff7ed;
  border:1px solid #fed7aa;
  color:#9a3412;
  border-radius:16px;
  padding:.8rem .9rem;
  font-size:.84rem;
  font-weight:600;
}

.small-muted{
  color:#6b7280;
  font-size:.82rem;
}

.alert-soft{
  background:#fff8f8;
  border:1px solid #f1d5d5;
  border-radius:16px;
  padding:.8rem .9rem;
}

.compact-btn{
  padding:.38rem .65rem;
  font-size:.85rem;
}

/* ======================================================
   PREVIEW TOOLBAR / STAGE
====================================================== */

.preview-toolbar{
  display:flex;
  flex-wrap:wrap;
  justify-content:space-between;
  align-items:center;
  gap:.75rem;
  margin-bottom:1rem;
}

.preview-stage{
  background:linear-gradient(180deg, #fff8f8 0%, #fff1f2 100%);
  border:1px solid #f1d5d5;
  border-radius:24px;
  padding:1rem;
  overflow:auto;
}

/* ======================================================
   SHEET LAYOUT
====================================================== */

.sheet-page{
  width:var(--sheet-width);
  min-height:var(--sheet-height);
  background:#fff;
  margin:0 auto;
  border-radius:10px;
  box-shadow:0 25px 60px rgba(127,29,29,.14);
  padding:28px 30px 28px 30px;
  box-sizing:border-box;
}

.sheet-header{
  display:grid;
  grid-template-columns:120px 1fr;
  gap:18px;
  align-items:start;
  margin-bottom:16px;
}
.sheet-header-main{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.logo-box{
  height:90px;
  border:1px dashed #e5bcbc;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#fffafa;
  overflow:hidden;
}
.logo-box img{
  max-width:100%;
  max-height:100%;
  object-fit:contain;
}
.logo-placeholder{
  font-size:12px;
  font-weight:800;
  color:#991b1b;
  text-transform:uppercase;
  letter-spacing:.04em;
  text-align:center;
  padding:8px;
}

.sheet-title{
  font-size:28px;
  font-weight:900;
  color:var(--bw-red);
  line-height:1.1;
  margin:0;
}
.sheet-subtitle{
  margin-top:6px;
  font-size:14px;
  color:#7f1d1d;
  line-height:1.45;
}

/* ======================================================
   INFO GRID
====================================================== */

.info-grid{
  display:grid;
  grid-template-columns:repeat(5, minmax(0, 1fr));
  gap:8px;
  width:100%;
}
.info-line{
  border:1px solid #f1d5d5;
  border-radius:10px;
  padding:8px 10px;
  background:#fff;
  min-height:56px;
}
.info-label{
  font-size:10px;
  font-weight:900;
  color:#991b1b;
  text-transform:uppercase;
  letter-spacing:.04em;
  line-height:1.1;
}
.info-value{
  margin-top:4px;
  font-size:13px;
  font-weight:700;
  color:#111827;
  min-height:16px;
  line-height:1.2;
}

/* ======================================================
   MATRIX TABLE
====================================================== */

.matrix-wrap{
  border:1px solid #efcaca;
  border-radius:16px;
  overflow:hidden;
}

.matrix-table{
  width:100%;
  border-collapse:collapse;
  table-layout:fixed;
}
.matrix-table th,
.matrix-table td{
  border:1px solid #f3dede;
  padding:8px 7px;
  vertical-align:middle;
}
.matrix-table thead th{
  background:#fff1f2;
  text-align:center;
  color:#7f1d1d;
  font-size:12px;
  font-weight:900;
}
.matrix-table thead th .crit-title{
  display:block;
  font-size:13px;
  color:#111827;
  font-weight:900;
  line-height:1.2;
}
.matrix-table thead th .crit-meta{
  display:block;
  margin-top:4px;
  font-size:11px;
  color:#991b1b;
  font-weight:700;
}
.matrix-table .contestant-head{
  width:260px;
  min-width:260px;
  max-width:260px;
  text-align:left;
}
.matrix-table tbody td:first-child{
  background:#fff;
  font-size:13px;
  font-weight:700;
  color:#111827;
}
.matrix-table .contestant-name{
  line-height:1.25;
}
.matrix-table .contestant-sub{
  display:block;
  margin-top:3px;
  color:#7f1d1d;
  font-size:11px;
  font-weight:700;
}

.score-box{
  height:34px;
  border:1px solid #e5bcbc;
  border-radius:8px;
  background:#fff;
}
.deduction-box{
  height:34px;
  border:1px dashed #dc2626;
  border-radius:8px;
  background:#fff1f2;
}

.total-col-head{
  width:110px;
  min-width:110px;
  max-width:110px;
}
.rank-col-head{
  width:85px;
  min-width:85px;
  max-width:85px;
}
.notes-head{
  width:180px;
  min-width:180px;
  max-width:180px;
}
.deduction-head{
  width:110px;
  min-width:110px;
  max-width:110px;
}

/* ======================================================
   FOOTER AREA
====================================================== */

.footer-zone{
  margin-top:16px;
  display:grid;
  grid-template-columns:1fr 280px;
  gap:16px;
  align-items:end;
}

.notes-box{
  border:1px solid #f3dede;
  border-radius:14px;
  min-height:84px;
  padding:10px 12px;
}
.notes-title{
  font-size:12px;
  font-weight:900;
  color:#991b1b;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.notes-lines{
  margin-top:10px;
  height:44px;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 18px,
      rgba(127,29,29,.16) 19px,
      transparent 20px
    );
}

.signature-box{
  text-align:center;
}
.signature-line{
  border-bottom:2px solid #7f1d1d;
  height:34px;
}
.signature-label{
  margin-top:6px;
  font-size:12px;
  font-weight:900;
  color:#7f1d1d;
  text-transform:uppercase;
  letter-spacing:.04em;
}

/* ======================================================
   SWITCH ROW
====================================================== */

.switch-row{
  display:flex;
  align-items:center;
  gap:.6rem;
  padding:.55rem .7rem;
  border:1px solid #f1d5d5;
  border-radius:14px;
  background:#fff;
  margin-bottom:.55rem;
}
.switch-row .form-check-input{
  margin-top:0;
}
.switch-row label{
  font-weight:700;
  color:#111827;
  margin:0;
}

/* ======================================================
   RESPONSIVE
====================================================== */

@media (max-width: 1200px){
  .info-grid{
    grid-template-columns:repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 768px){
  .sheet-header{
    grid-template-columns:1fr;
  }
  .info-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}

/* ======================================================
   PREVIEW MULTI PAGE
====================================================== */

#sheetPreview{
  display:flex;
  flex-direction:column;
  gap:24px;
}

.multi-page-sheet{
  width:var(--sheet-width);
  min-height:var(--sheet-height);
  background:#fff;
  margin:0 auto;
  border-radius:10px;
  box-shadow:0 25px 60px rgba(127,29,29,.14);
  padding:28px 30px;
  box-sizing:border-box;
}

.sheet-page-badge{
  font-size:12px;
  font-weight:800;
  color:#7f1d1d;
  background:#fff1f2;
  border:1px solid #f1d5d5;
  border-radius:999px;
  padding:6px 10px;
  white-space:nowrap;
}

.sheet-page-break{
  page-break-before:always;
  break-before:page;
}

@media print{
  #sheetPreview{
    gap:0;
  }

  .multi-page-sheet{
    box-shadow:none;
    border-radius:0;
    margin:0 auto;
    page-break-after:always;
    break-after:page;
  }

  .multi-page-sheet:last-child{
    page-break-after:auto;
    break-after:auto;
  }
}

/* ======================================================
   SHARED PAGE HERO
   Used by SCORE_EVENTS / SCORE_JUDGES
====================================================== */

.page-hero{
  background:linear-gradient(135deg, #fff5f5, #ffe4e6);
  color:#7f1d1d; /* deep red text */
  border-radius:24px;
  padding:1.5rem 1.6rem;
  box-shadow:0 10px 30px rgba(220,38,38,.12);
  margin-bottom:1.5rem;
  position:relative;
  overflow:hidden;
  border:1px solid #f1d5d5;
}

/* soft glow accent */
.page-hero::after{
  content:"";
  position:absolute;
  inset:auto -60px -60px auto;
  width:200px;
  height:200px;
  background:radial-gradient(circle, rgba(220,38,38,.15), transparent 70%);
  pointer-events:none;
}

/* optional top glow (adds depth) */
.page-hero::before{
  content:"";
  position:absolute;
  inset:-80px auto auto -80px;
  width:200px;
  height:200px;
  background:radial-gradient(circle, rgba(239,68,68,.12), transparent 70%);
  pointer-events:none;
}

.page-hero h1{
  margin:0;
  font-weight:900;
  letter-spacing:.2px;
  color:#7f1d1d; /* strong readable */
}

.page-hero p{
  margin:.4rem 0 0;
  color:#991b1b; /* softer but still readable */
  font-weight:500;
}

/* ======================================================
   SHARED TABLE POLISH
====================================================== */

.table td,
.table th{
  vertical-align:middle;
}
.table thead th{
  background:#fff1f2;
  color:#7f1d1d;
  font-size:.82rem;
  font-weight:900;
  border-bottom:1px solid #f1d5d5;
}
.table tbody tr:hover{
  background:#fff8f8;
}

/* ======================================================
   SHARED STATUS PILLS
====================================================== */

.pill{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  border-radius:999px;
  padding:.35rem .7rem;
  font-size:.75rem;
  font-weight:800;
}

.pill-draft{
  background:#fff7ed;
  color:#9a3412;
  border:1px solid #fed7aa;
}
.pill-open{
  background:#fef2f2;
  color:#b91c1c;
  border:1px solid #fecaca;
}
.pill-closed{
  background:#f3f4f6;
  color:#374151;
  border:1px solid #d1d5db;
}

.pill-active{
  background:#fef2f2;
  color:#b91c1c;
  border:1px solid #fecaca;
}
.pill-inactive{
  background:#f8fafc;
  color:#475569;
  border:1px solid #cbd5e1;
}
.pill-assigned{
  background:#fff1f2;
  color:#991b1b;
  border:1px solid #f1d5d5;
}
.pill-unassigned{
  background:#fff7ed;
  color:#9a3412;
  border:1px solid #fed7aa;
}

/* ======================================================
   SHARED ACTION ROW / MODAL
====================================================== */

.actions-row{
  display:flex;
  gap:.6rem;
  flex-wrap:wrap;
}

.modal-content{
  border:1px solid #f1d5d5;
  border-radius:20px;
  overflow:hidden;
  box-shadow:0 20px 50px rgba(127,29,29,.16);
}
.modal-header{
  background:linear-gradient(180deg, #fff, #fff8f8);
  border-bottom:1px solid #f3dede;
}
.modal-footer{
  border-top:1px solid #f3dede;
  background:#fff;
}

/* ======================================================
   SCORE_EVENTS.PHP
====================================================== */

.score-events-wrap{
  padding:1.5rem;
}

.score-events-wrap > .bw-card{
  margin-bottom:1.5rem;
}

.score-events-wrap .row.g-3{
  --bs-gutter-x:1rem;
  --bs-gutter-y:1rem;
}

.score-events-wrap .bw-card-body > .row.g-3{
  margin-top:0;
}

.table-responsive{
  margin-top:.75rem;
}

.stats-grid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0,1fr));
  gap:1.25rem;
  margin-bottom:1.25rem;
}
@media (max-width: 991.98px){
  .stats-grid{
    grid-template-columns:repeat(2, minmax(0,1fr));
  }
}
@media (max-width: 575.98px){
  .stats-grid{
    grid-template-columns:1fr;
  }
}

.stat-box{
  border:1px solid #f1d5d5;
  border-radius:20px;
  background:linear-gradient(180deg, #ffffff 0%, #fff8f8 100%);
  padding:18px 16px;
  box-shadow:0 6px 18px rgba(185,28,28,.04);
}
.stat-label{
  font-size:11px;
  font-weight:900;
  color:#991b1b;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.stat-value{
  margin-top:4px;
  font-size:18px;
  font-weight:900;
  color:#111827;
}

.status-select{
  min-width:120px;
}

/* ======================================================
   SCORE_JUDGES.PHP
====================================================== */

.score-judges-wrap{
  padding:1.5rem;
}

.score-judges-wrap > .bw-card{
  margin-bottom:1.5rem;
}

.score-judges-wrap .row.g-3{
  --bs-gutter-x:1rem;
  --bs-gutter-y:1rem;
}

.grid-2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:1.25rem;
}
@media (max-width: 1199.98px){
  .grid-2{
    grid-template-columns:1fr;
  }
}

/* ======================================================
   MOBILE TUNING FOR PAGE WRAPS
====================================================== */

@media (max-width: 768px){
  .score-events-wrap,
  .score-judges-wrap,
  .score-builder-wrap{
    padding:1rem;
  }

  .bw-card-header{
    padding:1rem 1rem;
  }

  .bw-card-body{
    padding:1rem 1rem 1.1rem;
  }

  .stats-grid{
    gap:1rem;
  }
}

/* ======================================================
   SCORE_CONTESTANTS.PHP
====================================================== */

.score-contestants-wrap{
  padding:1.5rem;
}

.score-contestants-wrap > .bw-card{
  margin-bottom:1.5rem;
}

.score-contestants-wrap .row.g-3{
  --bs-gutter-x:1rem;
  --bs-gutter-y:1rem;
}

@media (max-width: 768px){
  .score-contestants-wrap{
    padding:1rem;
  }
}

/* ======================================================
   JUDGE ACCESS PAGE (SCORE_JUDGE_ACCESS.PHP)
====================================================== */

.judge-access-wrap{
  padding:1.5rem;
}

.judge-access-wrap > .bw-card{
  margin-bottom:1.5rem;
}

.judge-access-wrap .row.g-3{
  --bs-gutter-x:1rem;
  --bs-gutter-y:1rem;
}

/* ======================================================
   LINK INPUT GROUP
====================================================== */

.link-box{
  display:flex;
  gap:.5rem;
  align-items:center;
  flex-wrap:wrap;
}

.link-box input{
  min-width:260px;
  flex:1;
}

/* ======================================================
   BADGE (CONVERTED TO RED THEME)
====================================================== */

.badge-soft{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  border-radius:999px;
  padding:.35rem .7rem;
  font-size:.75rem;
  font-weight:800;

  background:#fff1f2;
  color:#991b1b;
  border:1px solid #f1d5d5;
}

/* ======================================================
   QR DISPLAY
====================================================== */

.qr-box{
  width:150px;
  min-width:150px;
  text-align:center;
}

.qr-box img{
  width:130px;
  height:130px;
  object-fit:contain;
  border:1px solid #f1d5d5;
  border-radius:12px;
  background:#fff;
  padding:6px;
}

.qr-caption{
  margin-top:6px;
  font-size:.72rem;
  color:#7f1d1d;
  font-weight:700;
}

/* ======================================================
   MOBILE
====================================================== */

@media (max-width: 768px){
  .judge-access-wrap{
    padding:1rem;
  }

  .link-box input{
    min-width:100%;
  }
}

/* ======================================================
   SCORE_RESULTS.PHP
====================================================== */

.score-results-wrap{
  padding:1.5rem;
}

.score-results-wrap > .bw-card{
  margin-bottom:1.5rem;
}

.score-results-wrap .row.g-3{
  --bs-gutter-x:1rem;
  --bs-gutter-y:1rem;
}

/* ranking badges */
.rank-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:40px;
  height:40px;
  border-radius:999px;
  font-weight:900;
  color:#111827;
  background:#fff8f8;
  border:1px solid #f1d5d5;
}

.rank-1{
  background:#fff7ed;
  border-color:#fdba74;
}

.rank-2{
  background:#f8fafc;
  border-color:#cbd5e1;
}

.rank-3{
  background:#fef2f2;
  border-color:#fecaca;
}

/* result tabs */
.nav-pills .nav-link{
  border-radius:999px;
  font-weight:800;
  color:#7f1d1d;
  border:1px solid #f1d5d5;
  background:#fff;
}

.nav-pills .nav-link:hover{
  background:#fff1f2;
  color:var(--bw-red);
}

.nav-pills .nav-link.active{
  background:var(--bw-red);
  border-color:var(--bw-red);
  color:#fff;
}

/* score chips */
.score-chip{
  display:inline-block;
  min-width:52px;
  text-align:center;
  padding:.3rem .45rem;
  border-radius:10px;
  background:#fff8f8;
  border:1px solid #f1d5d5;
  font-weight:700;
  font-size:.82rem;
  margin:.1rem;
  color:#7f1d1d;
}

@media (max-width: 768px){
  .score-results-wrap{
    padding:1rem;
  }
}