/* =========================
   GLOBAL BASE
========================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  word-wrap: break-word;
}

html, body {
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  font-family: "Times New Roman", Times, serif;

  display: flex;
  justify-content: center;
  align-items: center;

  color: var(--text-color);
}

/* =========================
   MAIN CONTENT
========================= */
.page-container {
  width: 100%;
  max-width: 700px;
  padding: 16px;
}

/* =========================
   TYPOGRAPHY
========================= */
h1 {
  text-align: center;
}

h2 {
  margin-top: 50px;
  margin-bottom: 10px;
  text-align: center;
}

header {
  margin: 40px 0 20px;
  text-align: center;
}

footer {
  margin-top: 60px;
  text-align: center;
  font-size: 14px;
  opacity: 0.5;
}

.justifiedp {
  text-align: justify;
  text-indent: 2em;
  line-height: 1.8;
  margin-bottom: 16px;
  opacity: 0.85;
}

.centerp {
  text-align: center;
  line-height: 1.6;
  margin-bottom: 12px;
}

.h1underline {
  text-decoration: none;
  position: relative;
  display: inline-block;
}

.h1underline::after {
  content: "";
  display: block;
  height: 2px;
  width: 60%;
  margin: 8px auto 0;
  background: var(--text-color);
  opacity: 0.6;
}

hr {
  margin: 40px 0;
  opacity: 0.3;
  border-color: var(--text-color);
}

/* =========================
   MEDIA SAFETY
========================= */
img, video {
  max-width: 100%;
  height: auto;
}

.gif {
  display: block;
  margin: auto;
  max-width: 100%;
}

/* =========================
   BUTTONS
========================= */
.themed-btn {
  display: flex;
  justify-content: center;
  align-items: center;

  padding: 15px;
  width: 100%;

  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 12px;

  color: var(--text-color);
  text-decoration: none;

  transition: 0.2s ease;
}

.btn-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

/* =========================
   THEME VARIABLES
========================= */
:root {
  --text-color: #000;
}

[data-theme="dark"] {
  --text-color: #fff;
}

[data-theme="dark"] body {
  background: linear-gradient(135deg, #0f172a, #1e293b, #020617);
}

/* =========================
   BACKGROUND GLOW
========================= */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;

  background:
    radial-gradient(circle at 20% 30%, rgba(96,165,250,0.4), transparent),
    radial-gradient(circle at 80% 70%, rgba(244,114,182,0.4), transparent),
    radial-gradient(circle at 50% 50%, rgba(52,211,153,0.4), transparent);

  filter: blur(80px);
}

/* =========================
   SIDEBAR CONTAINER
========================= */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;

  width: 200px;
  height: 100vh;

  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  display: flex;
  flex-direction: column;
  padding-top: 60px;

  transform: translateX(-100%);
  transition: transform 0.3s ease;

  z-index: 10000;

  color: var(--text-color);
  pointer-events: none;
}

.sidebar.open {
  transform: translateX(0);
  pointer-events: auto;
}

.sidebar-header {
  font-size: 20px;
  font-weight: bold;
  text-align: center;
}
  
/* =========================
   SIDEBAR LINKS
========================= */
.sidebar a {
  color: var(--text-color);
  padding: 12px;
  text-align: center;
  text-decoration: none;
  transition: 0.2s ease;
}

.sidebar a:hover {
  background: rgba(255,255,255,0.1);
}

/* =========================
   DROPDOWN BUTTON
========================= */
.dropdown-btn {
  background: none;
  border: none;
  color: var(--text-color);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  padding: 10px;

  display: inline-block;   /* 🔥 important */
  width: fit-content;      /* 🔥 key fix */
  margin: 0 auto;          /* 🔥 keep it centered */

  position: relative;
  text-align: center;
}

/* hover background stays */
.dropdown-btn:hover {
  background: rgba(255,255,255,0.1);
}

/* 🔥 underline (hidden by default) */
.dropdown-btn::after {
  content: "";
  position: absolute;

  left: 0;
  bottom: 0;

  height: 2px;
  width: 100%; /* 🔥 matches text width automatically */

  background: var(--text-color);
  opacity: 0.6;

  transform: scaleX(0); /* hidden */
  transform-origin: center;
  transition: transform 0.3s ease;
}

/* 🔥 show underline when active */
.dropdown-btn.active::after {
  transform: scaleX(1); /* show */
}

/* =========================
   DROPDOWN MENU (ANIMATED)
========================= */
.sub-menu {
  display: flex;
  flex-direction: column;

  max-height: 0;
  overflow: hidden;

  opacity: 0;
  transform: translateY(-10px);

  transition:
    max-height 0.6s ease,
    opacity 0.35s ease,
    transform 0.35s ease;
}

.sub-menu.show {
  max-height: 500px;
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0s, 0.15s, 0.15s;
}

.sub-menu a {
  padding: 8px;
  font-size: 14px;
  opacity: 0.8;
}

/* =========================
   DIVIDER
========================= */
.sidebar hr {
  border: none;
  height: 1px;
  background: var(--text-color);
  opacity: 0.3;
  margin: 10px 0 20px;
}

/* =========================
   DARK MODE SUPPORT
========================= */
[data-theme="dark"] .sidebar {
  background: rgba(0,0,0,0.4);
}

[data-theme="dark"] .sidebar a:hover,
[data-theme="dark"] .dropdown-btn:hover {
  background: rgba(255,255,255,0.08);
}

/* =========================
   MENU BUTTON
========================= */
#menuBtn {
  position: fixed;
  bottom: 15px;
  left: 15px;

  z-index: 10001;

  font-size: 20px;
  padding: 10px 14px;
  border-radius: 12px;

  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);

  border: 1px solid rgba(255,255,255,0.25);
  color: var(--text-color);

  cursor: pointer;
  transition: 0.2s ease;
}

#menuBtn:hover {
  transform: scale(1.05);
}

/* =========================
   FLEXBOX MENU ITEMS
========================= */
.menu-item {
  display: flex;
  flex-direction: column;
}

/* =========================
   DAY/NIGHT THEME TOGGLE
========================= */
.theme-toggle-container {
  position: fixed;
  bottom: 20px;
  left: 70%;
  transform: translateX(-70%);

  display: flex;
  justify-content: center;
  align-items: center;
}

.theme-switch {
  position: relative;
  width: 90px;
  height: 44px;
}

.theme-switch input {
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;

  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(16px);

  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 44px;

  cursor: pointer;
  transition: 0.3s ease;
}

.slider::before {
  content: "☀️";
  position: absolute;

  height: 34px;
  width: 34px;

  left: 5px;
  top: 50%;
  transform: translateY(-50%);

  background: white;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 16px;
  transition: 0.4s;
}

input:checked + .slider::before {
  transform: translate(44px, -50%);
  content: "🌙";
}

/* =========================
   CLOCK DISPLAY
========================= */
.ios-clock {
  position: relative;
  margin: 60px auto;
  text-align: center;
  padding: 20px 30px;
  border-radius: 34px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(25px);
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
  width: fit-content;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.date {
  font-size: 14px;
  opacity: 0.7;
}

.time {
  font-size: 20px;
  font-weight: 600;
}

/* =========================
   DARK MODE GLASS EFFECT
========================= */
[data-theme="dark"] #menuBtn,
[data-theme="dark"] .slider,
[data-theme="dark"] .ios-clock,
[data-theme="dark"] .themed-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 768px) {

  body {
    flex-direction: column;
    padding: 20px;
  }

  .theme-switch {
    width: 70px;
    height: 36px;
  }

  .slider::before {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  input:checked + .slider::before {
    transform: translate(32px, -50%);
  }
}

/* =========================
   APP LOADER OVERLAY
========================= */
.app-loader {
  position: fixed;
  inset: 0;

  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);

  display: flex;
  justify-content: center;
  align-items: center;

  z-index: 99999; /* stays on top */
}

/* BOX */
.loader-box {
  text-align: center;
  padding: 30px 40px;
  border-radius: 20px;

  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);

  color: var(--text-color);
}

/* SPINNER */
.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 15px;

  border: 4px solid rgba(255,255,255,0.2);
  border-top: 4px solid var(--text-color);
  border-radius: 50%;

  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* TEXT */
.loader-box h2 {
  margin-bottom: 8px;
}

/* DOTS (no layout shift) */
.dots {
  display: inline-block;
  width: 1.5em; /* fixed width so text doesn't move */
  text-align: left;
}