/* ===== BiffaWigan Resource Hub — base styles =====
   Things the Tailwind Play CDN can't cleanly express inline:
   font-face, keyframes, layered backgrounds, the fixed grid overlay,
   and the loading/empty/error states (palette-matched). */

/* ----- Fonts (Open Sans, 5 weights) ----- */
@font-face { font-family:'Open Sans'; font-weight:300; font-style:normal; font-display:swap; src:url('../fonts/OpenSans-Light.ttf') format('truetype'); }
@font-face { font-family:'Open Sans'; font-weight:400; font-style:normal; font-display:swap; src:url('../fonts/OpenSans-Regular.ttf') format('truetype'); }
@font-face { font-family:'Open Sans'; font-weight:600; font-style:normal; font-display:swap; src:url('../fonts/OpenSans-SemiBold.ttf') format('truetype'); }
@font-face { font-family:'Open Sans'; font-weight:700; font-style:normal; font-display:swap; src:url('../fonts/OpenSans-Bold.ttf') format('truetype'); }
@font-face { font-family:'Open Sans'; font-weight:800; font-style:normal; font-display:swap; src:url('../fonts/OpenSans-ExtraBold.ttf') format('truetype'); }

* { box-sizing:border-box; }
body { margin:0; font-family:'Open Sans', sans-serif; color:#E6F2F4; }

/* ----- Animations ----- */
@keyframes bw-content-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes bw-pulse { 0%,100% { opacity:.5; } 50% { opacity:1; } }
.bw-animate-in { animation:bw-content-in .28s ease-out; }

/* ----- App background (layered radial + linear) ----- */
.bw-app {
  min-height:100vh;
  background-color:#04141a;
  background-image:
    radial-gradient(900px 600px at 12% -5%, rgba(17,177,232,0.20), transparent 60%),
    radial-gradient(1100px 700px at 92% 8%, rgba(16,103,118,0.30), transparent 55%),
    radial-gradient(800px 800px at 78% 110%, rgba(0,118,143,0.18), transparent 60%),
    linear-gradient(180deg,#04141a 0%,#061b22 100%);
  background-attachment:fixed;
  padding:40px 24px 64px;
}

/* Content padding (moved to a class so media queries can shrink it) */
.bw-content-pad { padding:28px 28px 32px; }

/* ----- Fixed grid overlay ----- */
.bw-grid-overlay {
  position:fixed; inset:0; pointer-events:none;
  background-image:
    linear-gradient(rgba(136,216,243,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(136,216,243,0.045) 1px, transparent 1px);
  background-size:48px 48px;
  mask-image:radial-gradient(circle at 50% 30%, black, transparent 85%);
  -webkit-mask-image:radial-gradient(circle at 50% 30%, black, transparent 85%);
}

/* ----- Glass panel ----- */
.bw-glass {
  border-radius:18px;
  background:linear-gradient(180deg, rgba(11,33,40,0.72), rgba(6,22,28,0.66));
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
  border:1px solid rgba(136,216,243,0.16);
  box-shadow:0 1px 0 rgba(255,255,255,0.04) inset, 0 30px 80px rgba(0,0,0,0.45);
}

/* Hide scrollbar on the tab strip but keep it scrollable */
.bw-tabs { overflow-x:auto; scrollbar-width:none; }
.bw-tabs::-webkit-scrollbar { display:none; }

/* ----- State blocks (loading / empty / error) ----- */
.bw-state {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:14px; text-align:center; padding:56px 24px;
  color:#6E929A; font-size:14px; font-weight:600;
}
.bw-state .bw-state-sub { font-size:12px; font-weight:600; color:#3f6168; letter-spacing:.3px; }
.bw-state.bw-error { color:#F18D41; }

/* Spinner for loading state */
.bw-spinner {
  width:28px; height:28px; border-radius:999px;
  border:2px solid rgba(136,216,243,0.18);
  border-top-color:#11B1E8;
  animation:bw-spin .7s linear infinite;
}
@keyframes bw-spin { to { transform:rotate(360deg); } }

/* Skeleton shimmer reused for loading pills/rows */
.bw-skeleton {
  background:rgba(136,216,243,0.08);
  border-radius:999px;
  animation:bw-pulse 1.2s ease-in-out infinite;
}

/* =====================================================================
   Interactive components — values copied verbatim from the mockup,
   with real :hover states (the mockup used a runtime style-hover attr).
   ===================================================================== */

/* ----- View toggle (header) ----- */
.bw-toggle {
  width:34px; height:30px; display:inline-flex; align-items:center; justify-content:center;
  border-radius:7px; border:none; cursor:pointer; background:transparent;
  color:#6E929A; transition:all .15s ease;
}
.bw-toggle:hover { background:rgba(17,177,232,0.18); color:#11B1E8; }
.bw-toggle.bw-toggle--on { background:#106776; color:#FFFFFF; }
.bw-toggle.bw-toggle--on:hover { background:#106776; color:#FFFFFF; }

/* ----- Tab buttons ----- */
.bw-tab {
  display:flex; align-items:center; gap:8px; padding:16px 18px 14px;
  border:none; background:transparent; cursor:pointer; font-family:inherit;
  font-size:14px; font-weight:600; white-space:nowrap; color:#6E929A;
  border-bottom:2px solid transparent; margin-bottom:-1px; transition:color .15s ease;
}
.bw-tab:hover { color:#E6F2F4; }
.bw-tab.bw-tab--active { font-weight:700; color:#FFFFFF; border-bottom:2px solid #11B1E8; }

.bw-chip {
  font-size:11px; font-weight:700; font-variant-numeric:tabular-nums;
  padding:1px 7px; border-radius:999px;
  background:rgba(136,216,243,0.08); color:#6E929A;
}
.bw-tab--active .bw-chip { background:rgba(17,177,232,0.18); color:#11B1E8; }

/* ----- Type badge ----- */
.bw-badge {
  font-size:9px; font-weight:700; letter-spacing:1px; color:#04141a;
  padding:3px 7px; border-radius:4px; font-variant-numeric:tabular-nums; flex-shrink:0;
}

/* ----- Grid view: rounded pill ----- */
.bw-pill {
  display:inline-flex; align-items:center; gap:12px; padding:10px 10px 10px 18px;
  border-radius:999px; background:rgba(136,216,243,0.05);
  border:1px solid rgba(136,216,243,0.16); transition:background .15s ease, border-color .15s ease;
}
.bw-pill:hover { background:rgba(136,216,243,0.1); border-color:rgba(17,177,232,0.45); }
.bw-pill .bw-pill-name { font-size:14px; font-weight:600; color:#E6F2F4; white-space:nowrap; }

/* round icon-only action buttons (grid) */
.bw-iconbtn {
  width:30px; height:30px; border-radius:999px; display:inline-flex; align-items:center;
  justify-content:center; cursor:pointer; border:1px solid rgba(136,216,243,0.2);
  background:transparent; color:#9EC9D1; transition:all .15s ease;
}
.bw-iconbtn:hover { background:rgba(17,177,232,0.18); color:#11B1E8; border-color:rgba(17,177,232,0.5); }

/* ----- List view: rows ----- */
.bw-list { display:flex; flex-direction:column; border:1px solid rgba(136,216,243,0.12); border-radius:12px; overflow:hidden; }
.bw-row {
  display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 18px;
  border-bottom:1px solid rgba(136,216,243,0.08); transition:background .15s ease;
}
.bw-row:last-child { border-bottom:none; }
.bw-row:nth-child(even) { background:rgba(136,216,243,0.02); }
.bw-row:hover { background:rgba(136,216,243,0.06); }
.bw-row-name { font-size:15px; font-weight:600; color:#E6F2F4; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* list action buttons (labelled) */
.bw-btn {
  display:inline-flex; align-items:center; gap:7px; height:34px; padding:0 14px;
  border-radius:8px; cursor:pointer; font-family:inherit; font-size:13px; font-weight:600;
  transition:all .15s ease;
}
.bw-btn-view { border:1px solid rgba(136,216,243,0.22); background:transparent; color:#9EC9D1; }
.bw-btn-view:hover { background:rgba(17,177,232,0.15); color:#11B1E8; border-color:rgba(17,177,232,0.5); }
.bw-btn-download { border:1px solid transparent; background:#106776; color:#FFFFFF; }
.bw-btn-download:hover { background:#00768F; }

/* disabled state while a SAS URL is being fetched */
.bw-busy { opacity:.55; pointer-events:none; }

/* ----- Header: divider + inline View label ----- */
.bw-divider {
  width:1px; height:24px; flex-shrink:0; border-radius:1px;
  background:rgba(136,216,243,0.18);
}

/* ----- Sort control (header, beside the View toggle) ----- */
.bw-sort-btn {
  display:inline-flex; align-items:center; gap:8px; height:38px; padding:0 14px;
  border-radius:10px; cursor:pointer; font-family:inherit; font-size:13px; font-weight:600;
  background:rgba(6,24,30,0.6); border:1px solid rgba(136,216,243,0.14);
  color:#6E929A; transition:color .15s ease, border-color .15s ease, background .15s ease;
}
.bw-sort-btn:hover { color:#11B1E8; border-color:rgba(17,177,232,0.5); }
.bw-sort-btn.is-open { color:#11B1E8; border-color:rgba(17,177,232,0.5); background:rgba(6,24,30,0.85); }
.bw-sort-btn .bw-chev { transition:transform .15s ease; }
.bw-sort-btn.is-open .bw-chev { transform:rotate(180deg); }

.bw-sort-menu {
  position:absolute; top:calc(100% + 6px); right:0; z-index:30;
  min-width:170px; padding:6px; display:flex; flex-direction:column; gap:2px;
  border-radius:10px; background:#0b2128; border:1px solid rgba(136,216,243,0.16);
  box-shadow:0 18px 44px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.04) inset;
  transform-origin:top right; animation:bw-menu-in .14s ease-out;
}
.bw-sort-menu[hidden] { display:none; }
@keyframes bw-menu-in { from { opacity:0; transform:translateY(-6px) scale(.97); } to { opacity:1; transform:none; } }

.bw-sort-opt {
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  text-align:left; padding:8px 12px; border-radius:7px; border:none; background:transparent;
  cursor:pointer; font-family:inherit; font-size:13px; font-weight:600; color:#9EC9D1;
  white-space:nowrap; transition:background .12s ease, color .12s ease;
}
.bw-sort-opt:hover { background:rgba(17,177,232,0.12); color:#11B1E8; }
.bw-sort-opt.is-active { background:rgba(17,177,232,0.15); color:#11B1E8; }
/* check mark on the active option */
.bw-sort-opt::after { content:''; width:14px; height:14px; opacity:0; flex-shrink:0;
  background:currentColor;
  -webkit-mask:no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  mask:no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E"); }
.bw-sort-opt.is-active::after { opacity:1; }

/* =====================================================================
   Responsive tweaks — desktop is unchanged; these only kick in on
   smaller viewports.
   ===================================================================== */
@media (max-width: 640px) {
  .bw-app { padding:24px 14px 48px; }
  .bw-content-pad { padding:20px 16px 26px; }

  /* let the header stack: logo on top, controls below */
  .bw-header { flex-wrap:wrap; gap:16px; }

  /* smaller page title */
  #title { font-size:22px; }

  /* keep long names from forcing horizontal scroll in grid view */
  .bw-pill { max-width:100%; }
  .bw-pill .bw-pill-name { min-width:0; overflow:hidden; text-overflow:ellipsis; }
}

@media (max-width: 420px) {
  .bw-content-pad { padding:18px 12px 22px; }
  #title { font-size:20px; }

  /* list-view actions collapse to icon-only to save width */
  .bw-btn-label { display:none; }
  .bw-btn { padding:0 11px; gap:0; }
}
