:root {
  --modern-ink: #17202a;
  --modern-muted: #5d6978;
  --modern-line: #d9e0e7;
  --modern-surface: #ffffff;
  --modern-soft: #f4f7fb;
  --modern-blue: #1167b1;
  --modern-green: #07836f;
  --modern-gold: #d99a16;
  --modern-shadow: 0 14px 34px rgba(23, 32, 42, 0.1);
}

html {
  scroll-behavior: smooth;
}

body {
  color: var(--modern-ink);
  background:
    linear-gradient(180deg, rgba(244, 247, 251, 0.92), rgba(255, 255, 255, 1) 38%),
    var(--modern-soft);
  -webkit-font-smoothing: antialiased;
}

header {
  background: rgba(5, 5, 5, 0.9) !important;
  box-shadow: 0 10px 28px rgba(5, 5, 5, 0.18);
}

.nav {
  padding-block: 12px !important;
  flex-wrap: wrap;
  position: relative;
}

.brand {
  flex: 0 1 auto;
  min-width: 220px;
}

.brand img,
.brand-mark {
  border-radius: 12px !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.nav-links,
.links {
  flex: 1 1 520px;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px !important;
  min-width: 0;
}

.site-menu {
  position: relative;
  margin-left: auto;
}

.site-menu summary {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(243, 179, 41, 0.42);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
  user-select: none;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.site-menu summary::-webkit-details-marker {
  display: none;
}

.site-menu summary::after {
  content: "+";
  color: var(--modern-gold);
  font-size: 18px;
  line-height: 1;
}

.site-menu[open] summary {
  background: rgba(243, 179, 41, 0.16);
  border-color: rgba(243, 179, 41, 0.75);
}

.site-menu[open] summary::after {
  content: "-";
}

.site-menu .nav-links,
.site-menu .links {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 50;
  width: min(280px, calc(100vw - 32px));
  max-height: min(70vh, 360px);
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap !important;
  align-items: stretch;
  justify-content: flex-start;
  gap: 6px !important;
  padding: 10px;
  border: 1px solid rgba(243, 179, 41, 0.32);
  border-radius: 8px;
  background: rgba(5, 5, 5, 0.96);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.28);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(243, 179, 41, 0.7) rgba(255, 255, 255, 0.08);
}

.site-menu .nav-links::-webkit-scrollbar,
.site-menu .links::-webkit-scrollbar {
  width: 8px;
}

.site-menu .nav-links::-webkit-scrollbar-track,
.site-menu .links::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.site-menu .nav-links::-webkit-scrollbar-thumb,
.site-menu .links::-webkit-scrollbar-thumb {
  background: rgba(243, 179, 41, 0.72);
  border-radius: 999px;
}

.site-menu:not([open]) .nav-links,
.site-menu:not([open]) .links {
  display: none;
}

.site-menu .nav-links a,
.site-menu .links a {
  flex: 0 0 auto;
  width: 100%;
  justify-content: flex-start;
  padding: 10px 12px;
}

.nav-links a,
.links a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 7px 10px;
  color: #f7ead1;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-links a:hover,
.links a:hover {
  background: rgba(243, 179, 41, 0.14);
  color: #ffffff;
  transform: translateY(-1px);
}

main {
  min-height: calc(100vh - 90px);
}

.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(110deg, rgba(5, 5, 5, 0.92), rgba(17, 103, 177, 0.82), rgba(7, 131, 111, 0.7)),
    url("https://images.unsplash.com/photo-1522202176988-66273c2fd55f?auto=format&fit=crop&w=1600&q=80") !important;
  background-size: cover !important;
  background-position: center !important;
}

.hero-inner {
  padding-top: 74px !important;
  padding-bottom: 62px !important;
}

.hero h1 {
  max-width: 780px;
  text-wrap: balance;
}

.hero p,
.section-title p,
.panel p,
p {
  color: var(--modern-muted);
}

.hero p {
  color: rgba(255, 255, 255, 0.9) !important;
}

.hero-logo {
  border-radius: 24px !important;
}

.button,
button {
  border-radius: 7px !important;
  box-shadow: 0 10px 22px rgba(17, 103, 177, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.button:hover,
button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 14px 28px rgba(17, 103, 177, 0.24);
}

.button.secondary {
  background: var(--modern-gold) !important;
}

main > section {
  padding-block: 56px !important;
}

.container,
.nav,
.hero-inner {
  max-width: 1200px !important;
}

.section-title {
  margin-bottom: 24px !important;
}

.section-title h2,
.admission-box h2,
.panel h2,
h1 {
  color: var(--modern-ink);
  line-height: 1.15;
}

.admission-box,
.panel,
.card,
.course-card,
.feedback-card,
.achievement-card,
.contact-card,
.why-item,
.summary-card,
.portal-card {
  border-color: var(--modern-line) !important;
  border-radius: 8px !important;
  box-shadow: var(--modern-shadow);
}

.panel,
.card,
.feedback-card,
.achievement-card,
.contact-card,
.summary-card,
.portal-card {
  background: rgba(255, 255, 255, 0.96) !important;
}

.admission-box {
  box-shadow: 0 24px 60px rgba(5, 5, 5, 0.28) !important;
}

.stats {
  border-color: var(--modern-line) !important;
  box-shadow: var(--modern-shadow);
}

.stat strong {
  color: var(--modern-green) !important;
}

.course-grid,
.why-grid,
.feedback-grid,
.achievement-grid,
.gallery-grid,
.contact-grid,
.grid {
  gap: 18px !important;
}

.course-card,
.why-item,
.feedback-card,
.achievement-card,
.contact-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.course-card:hover,
.why-item:hover,
.feedback-card:hover,
.achievement-card:hover,
.contact-card:hover,
.photo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(23, 32, 42, 0.14);
}

input,
select,
textarea {
  border-color: var(--modern-line) !important;
  border-radius: 7px !important;
  background: #ffffff !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--modern-blue) !important;
  box-shadow: 0 0 0 3px rgba(17, 103, 177, 0.14);
  outline: none;
}

table {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--modern-line);
  border-radius: 8px;
  overflow: hidden;
}

th {
  background: #eef4fa !important;
}

td,
th {
  border-color: var(--modern-line) !important;
}

.tabs {
  padding: 8px;
  border: 1px solid var(--modern-line);
  border-radius: 8px;
  background: #eef4fa;
}

.tabs button {
  box-shadow: none;
}

.status,
.course-status,
.roll-badge,
.tag,
.trust-badge,
.verification-badge {
  border-radius: 999px !important;
}

.id-card,
.qr-box,
.course-item {
  border-color: var(--modern-line) !important;
  box-shadow: var(--modern-shadow);
}

.photo-card img,
.photo-card video,
.achievement-card img,
.photo-roll-card img,
.student-photo {
  filter: saturate(1.04) contrast(1.02);
}

.whatsapp {
  border-radius: 999px !important;
  box-shadow: 0 16px 34px rgba(7, 131, 111, 0.28) !important;
}

footer {
  color: #f7ead1 !important;
}

@media (max-width: 900px) {
  .nav {
    gap: 12px !important;
  }

  .brand {
    min-width: 0;
  }

  .nav-links,
  .links {
    width: 100%;
    flex: 1 1 100%;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .layout {
    grid-template-columns: 1fr !important;
  }

  .tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .tabs button {
    flex: 0 0 auto;
  }

  .gallery-grid,
  .course-grid,
  .why-grid,
  .feedback-grid,
  .achievement-grid,
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .hero-inner {
    padding-top: 52px !important;
  }
}

@media (max-width: 1100px) {
  #ownerPanel .layout {
    grid-template-columns: 340px minmax(0, 1fr) !important;
  }

  #ownerPanel .panel {
    min-width: 0;
  }
}

@media (max-width: 980px) {
  #ownerPanel .layout {
    grid-template-columns: 1fr !important;
  }

  #ownerPanel > .row {
    align-items: stretch !important;
  }

  #ownerPanel > .row > .tabs {
    flex: 1 1 100%;
  }

  #logout {
    align-self: flex-start;
  }
}

@media (max-width: 760px) {
  #studentsTab table {
    display: block;
    border: 0;
    background: transparent;
    overflow: visible;
    white-space: normal;
  }

  #studentsTab thead {
    display: none;
  }

  #studentTable {
    display: grid;
    gap: 12px;
  }

  #studentTable tr {
    display: block;
    border: 1px solid var(--modern-line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(23, 32, 42, 0.08);
    overflow: hidden;
  }

  #studentTable td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    border-bottom: 1px solid var(--modern-line) !important;
    padding: 10px 12px !important;
    white-space: normal;
  }

  #studentTable td:last-child {
    border-bottom: 0 !important;
  }

  #studentTable td::before {
    content: attr(data-label);
    color: var(--modern-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

  #studentTable td[data-label="Photo"] {
    grid-template-columns: 96px 1fr;
    align-items: center;
  }

  #studentTable .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #studentTable .actions button {
    width: 100%;
  }
}

@media (max-width: 620px) {
  body {
    overflow-x: hidden;
  }

  .nav,
  .container {
    width: 100%;
    padding-inline: 14px !important;
  }

  .nav {
    padding-block: 8px !important;
    gap: 8px !important;
    align-items: stretch !important;
  }

  .brand {
    width: 100%;
    gap: 8px !important;
    line-height: 1.25;
  }

  .brand img,
  .brand-mark {
    width: 36px !important;
    height: 36px !important;
    flex: 0 0 auto;
  }

  .brand span {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 12px;
  }

  .links {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .links::-webkit-scrollbar {
    display: none;
  }

  .links a {
    justify-content: center;
    flex: 0 0 auto;
    width: auto;
    min-height: 30px;
    padding: 6px 9px;
    text-align: center;
    white-space: nowrap;
    font-size: 12px;
  }

  header:has(.links) .nav {
    flex-direction: row !important;
    align-items: center !important;
  }

  header:has(.links) .brand {
    width: auto;
    flex: 0 0 auto;
  }

  header:has(.links) .brand span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  header:has(.links) .links {
    width: auto;
    max-width: calc(100% - 44px);
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }

  header .site-menu .links {
    position: absolute;
    width: min(240px, calc(100vw - 32px));
    max-width: min(240px, calc(100vw - 32px));
    flex: none !important;
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow-x: hidden;
    overflow-y: auto;
  }

  header .site-menu:not([open]) .links {
    display: none !important;
  }

  header .site-menu .links a {
    width: 100%;
    justify-content: flex-start;
  }

  main {
    padding-block: 28px !important;
  }

  h1 {
    font-size: 30px !important;
    line-height: 1.12 !important;
  }

  .panel,
  .card,
  .admission-box {
    padding: 14px !important;
  }

  #ownerPanel > .row {
    gap: 10px !important;
  }

  #ownerPanel .tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    white-space: normal;
    padding: 6px;
  }

  #ownerPanel .tabs button {
    min-height: 38px;
    padding: 8px;
    white-space: normal;
  }

  #logout {
    width: 100%;
  }

  #studentsTab .row label {
    flex: 1 1 100% !important;
  }

  #studentsTab .row select,
  #studentsTab .row input {
    width: 100%;
  }

  .form-grid,
  .grid,
  .gallery-grid,
  .course-grid,
  .why-grid,
  .feedback-grid,
  .achievement-grid {
    grid-template-columns: 1fr !important;
  }

  .row,
  .actions {
    align-items: stretch !important;
  }

  .row > *,
  .actions > *,
  button,
  .button {
    max-width: 100%;
  }

  .actions button,
  .actions .button {
    flex: 1 1 140px;
  }

  #studentForm button,
  #customCourseForm button,
  #galleryForm button,
  #videoGalleryForm button,
  #announcementForm button,
  #achievementForm button,
  #passwordForm button {
    width: 100%;
  }

  table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .id-card {
    width: 100%;
    max-width: 100% !important;
  }

  .id-head {
    align-items: flex-start !important;
  }

  .id-body {
    grid-template-columns: 1fr !important;
  }

  .id-body img {
    width: min(150px, 100%) !important;
    height: auto !important;
    aspect-ratio: 5 / 6;
  }

  .qr-box img,
  .qr-img {
    width: min(170px, 100%) !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
  }

  .qr-box a {
    overflow-wrap: anywhere;
  }

  .section-block {
    margin-top: 24px !important;
  }

  .section-block h2 {
    font-size: 20px;
  }

  .card img,
  .card video,
  .photo-card img,
  .photo-card video {
    aspect-ratio: 16 / 11 !important;
  }

  main > section {
    padding-block: 42px !important;
  }
}

@media (max-width: 420px) {
  #ownerPanel .tabs {
    grid-template-columns: 1fr;
  }

  #studentTable td {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  #studentTable .actions {
    grid-template-columns: 1fr;
  }
}
