/* =========================================================
   app.css — AWS Bright Theme + Global Amazon Ember Font Stack
   - Bright AWS homepage-aligned body (#fff)
   - Dark sidebar retained
   - Plain icon colors
   - Light AWS-style topbar + dropdown
   ========================================================= */

/* OPTIONAL: Only works if you upload .woff2 files to /public/assets/fonts/
   If you don't upload them, the stack will fall back to system fonts. */
@font-face {
  font-family: "Amazon Ember Display";
  src: url("/public/assets/fonts/AmazonEmberDisplay-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Amazon Ember Display";
  src: url("/public/assets/fonts/AmazonEmberDisplay-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Amazon Ember Display";
  src: url("/public/assets/fonts/AmazonEmberDisplay-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Amazon Ember";
  src: url("/public/assets/fonts/AmazonEmber-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Amazon Ember";
  src: url("/public/assets/fonts/AmazonEmber-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Amazon Ember";
  src: url("/public/assets/fonts/AmazonEmber-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root{
  --bg:#ffffff;                 /* body background */
  --panel:#ffffff;              /* cards/panels */
  --panel2:#f8fafc;             /* subtle alt */
  --border:#e5e7eb;             /* light borders */
  --text:#0f172a;               /* dark text */
  --muted:#475569;              /* muted text */

  --primary:#0972d3;            /* AWS blue */
  --primary2:#075aa8;
  --accent:#ff9900;             /* AWS orange */

  --good:#16a34a;
  --warn:#ff9900;
  --bad:#dc2626;

  --r:16px;
  --r2:22px;
  --shadow: 0 10px 28px rgba(2,6,23,.08);

  /* GLOBAL FONT STACK (AWS) */
  --font: "Amazon Ember Display","Amazon Ember","Helvetica Neue",Helvetica,Arial,sans-serif;

  /* Sidebar (kept dark) */
  --sb-bg:#0b1220;
  --sb-panel:#0f172a;
  --sb-border:rgba(148,163,184,.18);
  --sb-text:#e5e7eb;
  --sb-muted:#9ca3af;
  --sb-hover:rgba(255,255,255,.06);
  --sb-active:rgba(255,255,255,.10);
}

/* Force font across entire site */
html, body, input, select, textarea, button {
  font-family: "Amazon Ember Display","Amazon Ember","Helvetica Neue",Helvetica,Arial,sans-serif !important;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background: var(--bg);
  color:var(--text);
}

/* Layout */
.shell{display:flex; min-height:100vh}
.sidebar{
  width:280px;
  background: linear-gradient(180deg, rgba(11,18,32,.98), rgba(15,23,42,.98));
  border-right:1px solid var(--sb-border);
  padding:18px 14px;
  position:sticky; top:0; height:100vh; overflow:auto;
}
.main{flex:1; display:flex; flex-direction:column; background:var(--bg)}
.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px;
  background:#ffffff;
  border-bottom:1px solid var(--border);
}
.content{padding:18px; max-width:1200px; width:100%; margin:0 auto}

/* Brand */
.brand{display:flex; gap:12px; align-items:center; padding:6px 6px 14px}
.logo{
  width:42px; height:42px; border-radius:14px;
  background: linear-gradient(135deg, rgba(9,114,211,.95), rgba(255,153,0,.70));
  box-shadow: 0 10px 22px rgba(2,6,23,.20);
}
.brand h1{font-size:14px; margin:0; font-weight:700; letter-spacing:.2px; color:var(--sb-text)}
.brand .sub{font-size:12px; color:rgba(229,231,235,.75); margin-top:3px; font-weight:500}

/* Sidebar nav */
.navgrp{margin-top:12px}
.navtitle{
  margin:14px 8px 8px;
  color:rgba(229,231,235,.70);
  font-size:11px;
  letter-spacing:.14em;
  text-transform:uppercase;
  font-weight:700;
}
.nav a{
  display:flex; align-items:center; gap:10px;
  padding:10px 10px;
  margin:4px 6px;
  border-radius:14px;
  color:var(--sb-text);
  text-decoration:none;
  border:1px solid transparent;
  font-weight:600;
}
.nav a .dot{
  width:10px; height:10px; border-radius:999px;
  background: rgba(148,163,184,.55); /* plain icon color */
}
.nav a:hover{
  background: var(--sb-hover);
  border-color: rgba(148,163,184,.12);
}
.nav a.active{
  background: var(--sb-active);
  border-color: rgba(255,255,255,.10);
}
.nav a.active .dot{background: #ffffff}
.nav a.warn .dot{background: var(--accent)}

/* Cards / UI */
.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  box-shadow: var(--shadow);
  padding:16px;
}
.row{display:flex; gap:14px; flex-wrap:wrap}
.col{flex:1; min-width:260px}

.h1{font-size:28px; margin:0; font-weight:700; letter-spacing:.2px}
.sub{color:var(--muted); font-weight:500; margin-top:6px}

/* Buttons */
.btn{
  display:inline-flex; align-items:center; gap:10px;
  padding:10px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background: #ffffff;
  color:var(--text);
  text-decoration:none;
  font-weight:600;
  cursor:pointer;
}
.btn:hover{border-color: rgba(9,114,211,.35)}
.btn.primary{
  color:#ffffff;
  background: linear-gradient(180deg, var(--primary), var(--primary2));
  border-color: rgba(9,114,211,.45);
}
.btn.primary:hover{filter:brightness(1.02)}
.btn.warn{
  background: rgba(255,153,0,.10);
  border-color: rgba(255,153,0,.28);
}
.pill{
  display:inline-flex; align-items:center;
  padding:6px 10px; border-radius:999px;
  font-weight:600; font-size:12px;
  border:1px solid var(--border);
  background: #ffffff;
  color: var(--text);
}
.pill.good{border-color: rgba(22,163,74,.25); background: rgba(22,163,74,.08)}
.pill.bad{border-color: rgba(220,38,38,.25); background: rgba(220,38,38,.08)}
.pill.warn{border-color: rgba(255,153,0,.30); background: rgba(255,153,0,.10)}

/* Tables */
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius: var(--r2);
  border:1px solid var(--border);
}
.table th, .table td{
  padding:12px 12px;
  border-bottom:1px solid var(--border);
  font-weight:500;
}
.table th{
  color:rgba(71,85,105,.95);
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-weight:700;
  background: #ffffff;
}
.table tr:last-child td{border-bottom:none}
.table tr:hover td{background: rgba(9,114,211,.04)}

/* Inputs */
.input, select, textarea{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: #ffffff;
  color:var(--text);
  font-weight:500;
  outline:none;
}
.input:focus, select:focus, textarea:focus{
  border-color: rgba(9,114,211,.55);
  box-shadow: 0 0 0 4px rgba(9,114,211,.12);
}

/* Topbar helpers */
.tb-left{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.tb-right{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.tb-strong{margin-left:8px;color:var(--text);font-weight:700}

/* AWS-style account dropdown (light) */
.aws-dd{position:relative}
.aws-dd-btn{
  display:inline-flex;align-items:center;gap:10px;
  padding:10px 12px;border-radius:999px;
  border:1px solid var(--border);
  background: #ffffff;
  color:var(--text);
  font-weight:700;
  cursor:pointer;
}
.aws-dd-btn:hover{border-color: rgba(9,114,211,.35)}
.aws-dd-user{max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.aws-dd-caret{opacity:.85}

.aws-dd-menu{
  position:absolute;right:0;top:calc(100% + 10px);
  width:320px;
  background: #ffffff;
  border:1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(2,6,23,.14);
  padding:10px;
  display:none;
  z-index:9999;
}
.aws-dd.open .aws-dd-menu{display:block}

.aws-dd-head{
  padding:10px 12px;
  font-weight:700;
  color:rgba(15,23,42,.95);
  border-radius:14px;
  background: rgba(2,6,23,.03);
  border:1px solid rgba(2,6,23,.06);
  margin-bottom:8px;
}
.aws-dd-item{
  display:block;
  text-decoration:none;
  color:rgba(15,23,42,.96);
  padding:10px 12px;
  border-radius:14px;
  border:1px solid transparent;
}
.aws-dd-item:hover{
  background: rgba(9,114,211,.06);
  border-color: rgba(9,114,211,.16);
}
.aws-dd-item-title{font-weight:700}
.aws-dd-sep{
  height:1px;
  background: rgba(2,6,23,.10);
  margin:8px 2px;
}

/* Links */
a{color: var(--primary); text-decoration:none}
a:hover{text-decoration:underline}

/* Mobile */
@media (max-width: 980px){
  .sidebar{width:92px}
  .brand h1,.brand .sub,.nav a span{display:none}
  .nav a{justify-content:center}
  .nav a .dot{display:none}
}


/* =========================================================
   Sidebar scrollbar — sleek, modern, no borders
   ========================================================= */

.sidebar{
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.22) transparent;

  /* Remove any “edge/border” feel */
  background-clip: padding-box;
}

/* WebKit (Chrome/Edge/Safari) */
.sidebar::-webkit-scrollbar{
  width: 10px;
}
.sidebar::-webkit-scrollbar-track{
  background: transparent;
  border: 0;
  box-shadow: none;
}
.sidebar::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.18);
  border-radius: 999px;

  /* This is the key “no border box” trick:
     use a transparent border + clip to create spacing without a visible border */
  border: 3px solid transparent;
  background-clip: content-box;
}
.sidebar::-webkit-scrollbar-thumb:hover{
  background: rgba(255,255,255,.28);
  border: 3px solid transparent;
  background-clip: content-box;
}
.sidebar::-webkit-scrollbar-corner{
  background: transparent;
}

/* Optional: reduce visual noise on the internal spacer gutter */
.sidebar{ overscroll-behavior: contain; }

/* Make active menu item feel “anchored” and clearer */
.nav a.active{
  position: relative;
}
.nav a.active::before{
  content:"";
  position:absolute;
  left:-6px;
  top:10px;
  bottom:10px;
  width:3px;
  border-radius:999px;
  background:#fff;
  opacity:.95;
}

/* =========================================================
   Sidebar fade masks (top/bottom) + collapse mode
   ========================================================= */

/* Fade mask layers */
.sidebar{
  position: sticky; /* already in your theme, keep */
}

/* Create 2 overlay fades */
.sidebar::before,
.sidebar::after{
  content:"";
  position: sticky;
  left: 0;
  right: 0;
  height: 18px;
  display: block;
  pointer-events: none;
  opacity: 0;              /* default off (JS will enable) */
  transition: opacity .18s ease;
  z-index: 20;
}

/* Top fade */
.sidebar::before{
  top: 0;
  background: linear-gradient(
    to bottom,
    rgba(11,18,32,.95),
    rgba(11,18,32,.00)
  );
}

/* Bottom fade */
.sidebar::after{
  bottom: 0;
  background: linear-gradient(
    to top,
    rgba(11,18,32,.95),
    rgba(11,18,32,.00)
  );
}

/* Turn fades on only when sidebar is scrollable */
.sidebar.sb-scrollable::before,
.sidebar.sb-scrollable::after{
  opacity: 1;
}

/* Hide top fade when we're at the very top */
.sidebar.sb-at-top::before{ opacity: 0; }

/* Hide bottom fade when we're at the very bottom */
.sidebar.sb-at-bottom::after{ opacity: 0; }


/* =========================================================
   Collapse sidebar (desktop)
   - remembers state via JS/localStorage
   - compact AWS-console style
   ========================================================= */

body.sb-collapsed .sidebar{
  width: 92px;
  padding-left: 10px;
  padding-right: 10px;
}

/* Hide long brand text in collapsed mode */
body.sb-collapsed .brand h1,
body.sb-collapsed .brand .sub{
  display:none;
}

/* Center logo */
body.sb-collapsed .brand{
  justify-content:center;
}

/* Hide nav section titles */
body.sb-collapsed .navtitle{
  display:none;
}

/* Hide link labels but keep clickable area */
body.sb-collapsed .nav a span{
  display:none;
}

/* Keep spacing + center items */
body.sb-collapsed .nav a{
  justify-content:center;
  padding:12px 10px;
}

/* Dot becomes the “icon” */
body.sb-collapsed .nav a .dot{
  width:12px;
  height:12px;
}

/* Main area still full width */
body.sb-collapsed .main{
  width: calc(100% - 92px);
}

/* Collapse button styling (in topbar) */
.sb-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  user-select:none;
  font-weight: 900;
}
.sb-toggle:hover{
  border-color: rgba(9,114,211,.35);
  background: rgba(9,114,211,.03);
}
.sb-toggle:active{
  transform: translateY(1px);
}

/* Optional: make topbar left cluster nicer if you have tb-left */
.topbar .tb-left{gap:10px}


/* Chevron icon animation */
.sb-toggle .sb-toggle-ico{
  transition: transform .18s ease, opacity .18s ease;
  opacity: .92;
}

/* Expanded (default): chevron points LEFT */
.sb-toggle .sb-toggle-ico{
  transform: rotate(180deg);
}

/* Collapsed: chevron points RIGHT */
body.sb-collapsed .sb-toggle .sb-toggle-ico{
  transform: rotate(0deg);
}


.sb-toggle{
  transition: background .15s ease, border-color .15s ease;
}
.sb-toggle:hover .sb-toggle-ico{
  opacity: 1;
}


/* =========================================================
   Collapsed sidebar: show menu items properly (icon-only + tooltip)
   ========================================================= */

/* Make sure sidebar still scrolls nicely when collapsed */
body.sb-collapsed .sidebar{
  width: 92px;
  padding: 14px 10px;
}

/* Hide titles + long brand text */
body.sb-collapsed .navtitle,
body.sb-collapsed .brand h1,
body.sb-collapsed .brand .sub{
  display:none !important;
}

/* Center logo */
body.sb-collapsed .brand{
  justify-content:center;
  padding-bottom: 10px;
}

/* NAV LINKS become compact "icon buttons" */
body.sb-collapsed .nav a{
  position: relative;
  justify-content: center;
  padding: 12px 10px;
  margin: 6px 6px;
  border-radius: 16px;
}

/* Use the dot as the icon (visible and centered) */
body.sb-collapsed .nav a .dot{
  display:inline-block !important;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.68);
  box-shadow: 0 0 0 4px rgba(255,255,255,.06);
}

/* Hide label text but keep it for tooltips */
body.sb-collapsed .nav a span{
  display:none !important;
}

/* Active state remains obvious */
body.sb-collapsed .nav a.active{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.10);
}
body.sb-collapsed .nav a.active .dot{
  background:#ffffff;
  box-shadow: 0 0 0 4px rgba(255,255,255,.10);
}

/* Remove the left active bar in collapsed mode (it looks odd on narrow width) */
body.sb-collapsed .nav a.active::before{
  display:none !important;
}

/* ---------------------------------------------------------
   Tooltip on hover (AWS-like)
   Uses data-label attribute set by JS below.
--------------------------------------------------------- */
body.sb-collapsed .nav a[data-label]:hover::after{
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  color: #0f172a;
  border: 1px solid rgba(15,23,42,.14);
  box-shadow: 0 18px 40px rgba(2,6,23,.18);
  font-weight: 700;
  font-size: 12px;
  z-index: 99999;
}

/* Tiny tooltip arrow */
body.sb-collapsed .nav a[data-label]:hover::before{
  content:"";
  position:absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 7px solid rgba(255,255,255,.96);
  filter: drop-shadow(-1px 0 0 rgba(15,23,42,.10));
  z-index: 99999;
}

/* Optional: tighten group spacing so items don't look “floating” */
body.sb-collapsed .navgrp{
  margin-top: 8px;
}

/* =========================================
   Sidebar SVG Icons
========================================= */

.nav a .icon{
  width:18px;
  height:18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-right:10px;
  color: rgba(255,255,255,.65);
  transition: color .18s ease;
}

.nav a .icon svg{
  width:18px;
  height:18px;
}

.nav a:hover .icon{
  color:#fff;
}

.nav a.active .icon{
  color:#fff;
}

/* COLLAPSED MODE */

body.sb-collapsed .nav a{
  justify-content:center;
}

body.sb-collapsed .nav a .icon{
  margin-right:0;
}

body.sb-collapsed .nav a span:last-child{
  display:none;
}


/* =========================================================
   FIX: Collapsed sidebar icons not showing
   - Your older collapsed CSS likely hides all spans in nav links.
   - We override: show .icon, hide only .label
   ========================================================= */

/* Collapsed layout */
body.sb-collapsed .sidebar{
  width: 92px;
  padding: 14px 10px;
}

/* Hide headings + long brand text */
body.sb-collapsed .navtitle,
body.sb-collapsed .brand h1,
body.sb-collapsed .brand .sub{
  display:none !important;
}

/* Center brand/logo */
body.sb-collapsed .brand{
  justify-content:center;
  padding-bottom: 10px;
}

/* NAV link becomes icon button */
body.sb-collapsed .nav a{
  position: relative;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 12px 10px;
  margin: 6px 6px;
  border-radius: 16px;
}

/* ✅ CRITICAL OVERRIDE:
   If you have rules like: body.sb-collapsed .nav a span{display:none}
   this brings icons back.
*/
body.sb-collapsed .nav a .icon{
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  width: 20px;
  height: 20px;
  margin-right: 0 !important;
  color: rgba(255,255,255,.78);
}

/* Ensure SVG is visible */
body.sb-collapsed .nav a .icon svg{
  display:block !important;
  width: 20px;
  height: 20px;
}

/* Hide ONLY the label */
body.sb-collapsed .nav a .label{
  display:none !important;
}

/* Active state remains obvious */
body.sb-collapsed .nav a.active{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.12);
}
body.sb-collapsed .nav a.active .icon{
  color:#ffffff;
}

/* Remove active left bar in collapsed mode if your theme adds it */
body.sb-collapsed .nav a.active::before{
  display:none !important;
}

/* Tooltip (works with your data-label attr) */
body.sb-collapsed .nav a[data-label]:hover::after{
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  color: #0f172a;
  border: 1px solid rgba(15,23,42,.14);
  box-shadow: 0 18px 40px rgba(2,6,23,.18);
  font-weight: 700;
  font-size: 12px;
  z-index: 99999;
}
body.sb-collapsed .nav a[data-label]:hover::before{
  content:"";
  position:absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 7px solid rgba(255,255,255,.96);
  filter: drop-shadow(-1px 0 0 rgba(15,23,42,.10));
  z-index: 99999;
}
