:root{
  --bg: #0b0f19;
  --panel: rgba(255,255,255,.06);
  --panel2: rgba(255,255,255,.08);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.62);
  --border: rgba(255,255,255,.10);
  --shadow: 0 18px 60px rgba(0,0,0,.55);
  --radius: 18px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 700px at 20% 0%, rgba(0,180,255,.14), transparent 60%),
              radial-gradient(900px 500px at 80% 20%, rgba(0,255,170,.10), transparent 60%),
              var(--bg);
  color: var(--text);
}

/* Layout */
.app{
  display:flex;
  min-height:100vh;
}

.sidebar{
  width: 280px;
  padding: 18px;
  border-right: 1px solid var(--border);
  background: rgba(0,0,0,.20);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  height: 100vh;
}

.main{
  flex:1;
  padding: 22px 22px 50px;
}

/* Brand */
.brand{
  display:flex;
  gap:12px;
  align-items:center;
  padding: 10px 10px 16px;
}

.brand__logo{
  width:44px;
  height:44px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background: linear-gradient(135deg, rgba(0,180,255,.35), rgba(0,255,170,.20));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 800;
}

.brand__title{
  font-weight: 800;
  letter-spacing: .2px;
}

.brand__sub{
  font-size: 12px;
  color: var(--muted);
  margin-top:2px;
}

/* Nav */
.nav{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding: 8px;
}

.nav__item{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 12px 12px;
  border-radius: 14px;
  color: var(--text);
  text-decoration:none;
  border: 1px solid transparent;
}

.nav__item:hover{
  background: var(--panel);
  border-color: var(--border);
}

.nav__item.active{
  background: linear-gradient(135deg, rgba(0,180,255,.18), rgba(0,255,170,.10));
  border-color: rgba(255,255,255,.16);
}

/* Font Awesome icon alignment (desktop sidebar) */
.nav__item i{
  width: 20px;
  text-align:center;
  font-size: 16px;
  opacity: .9;
}

.nav__item.active i{
  opacity: 1;
}

/* Pills */
.pill{
  margin-left:auto;
  font-size: 11px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
}

/* Sidebar footer */
.sidebar__footer{
  position: absolute;
  bottom: 16px;
  left: 18px;
  right: 18px;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.link{
  color: var(--muted);
  text-decoration:none;
}

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

/* Topbar */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(10px);
}

.topbar__title{
  font-weight: 800;
  letter-spacing: .2px;
}

.content{
  padding-top: 18px;
}

/* Grid / cards */
.grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.card{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  display:flex;
  flex-direction:column;
}

.thumb{
  height: 220px;
  background: rgba(255,255,255,.06);
  display:block;
  width:100%;
  object-fit: cover;
}

.card__body{
  padding: 12px 12px 14px;
  display:flex;
  gap: 8px;
  flex-direction:column;
}

.card__title{
  font-weight: 750;
}

.card__meta{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  color: var(--muted);
  font-size: 12px;
}

/* Buttons */
.btn{
  cursor:pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
}

.btn:hover{
  background: rgba(255,255,255,.10);
}

.btn--ghost{
  background: transparent;
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  display:none;
}

.modal[aria-hidden="false"]{
  display:block;
}

.modal__backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.62);
}

.modal__panel{
  position: relative;
  max-width: 920px;
  margin: 6vh auto;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(15,18,28,.92);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.modal__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal__body{
  padding: 16px;
}

/* Mobile nav hidden by default */
.mobile-nav{
  display:none;
}

/* Desktop modal preview sizing (prevents tiny iframe) */
.modal__panel{
  width: min(1100px, calc(100% - 48px));
}

.modal__body iframe{
  width: 100%;
  height: 70vh;       /* <-- key fix */
  min-height: 520px;  /* keeps it usable on shorter screens */
  border: 0;
  display: block;
}

/* Responsive: tablet */
@media (max-width: 1100px){
  .grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar{ width: 260px; }
}

/* Responsive: mobile */
@media (max-width: 760px){
  .sidebar{ display:none; }
  .main{ padding: 16px; }
  .grid{ grid-template-columns: 1fr; }

  .topbar{
    border-radius: 12px;
    font-size: 14px;
  }

  /* Mobile bottom app nav */
  .mobile-nav{
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: rgba(10,14,25,.96);
    border-top: 1px solid rgba(255,255,255,.10);
    display: flex;
    justify-content: space-around;
    align-items: center;
    backdrop-filter: blur(10px);
    z-index: 999;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-nav a{
    color: rgba(255,255,255,.75);
    font-size: 11px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 64px;
  }

  .mobile-nav a.active{
    color: #00e0ff;
  }

  /* Font Awesome icon styling (mobile nav) */
  .mobile-nav i{
    font-size: 18px;
    line-height: 1;
  }

  body{
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }

  /* iOS-safe fullscreen modal */
  .modal__panel{
    margin: 0;
    width: 100%;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    border-radius: 0;
  }

  .modal__header{
    height: 56px;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top);
  }

  .modal__body{
    padding: 0;
    height: calc(100dvh - 56px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    height: calc((var(--vh, 1vh) * 100) - 56px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  .modal__body iframe{
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
  }

  /* Hide any modal body buttons on mobile (keeps it fullscreen) */
  .modal__body .btn{
    display:none;
  }
}
