/* website/static/css/responsive.css */

/* ------------------------------------------------------------
   🌍 Global Responsiveness Layer
   - Consolidates responsive rules from style.css and base.html
   - Ensures compatibility across all screen sizes
------------------------------------------------------------ */

/* ✅ Base adjustments */
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* prevent horizontal scroll */
}

/* ✅ Fluid typography */
h1, h2, h3, h4, h5, h6 {
  font-size: clamp(1rem, 2vw, 2.2rem);
}
p, li, a, label, input, button {
  font-size: clamp(0.9rem, 1.5vw, 1.1rem);
}

/* ✅ Containers */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(1rem, 2vw, 2rem);
}

/* ------------------------------------------------------------
   🔗 Navbar + Hamburger Menu
------------------------------------------------------------ */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  background: #333;
  padding: 0.5rem 1rem;
  position: relative;
}
.navbar a {
  color: #fff;
  text-decoration: none;
  margin: 0.5rem;
  font-size: clamp(0.9rem, 1.5vw, 1.1rem);
}
.menu-toggle {
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
  background: none;
  border: none;
}
.menu-links {
  display: none;
  flex-direction: row;
  background: #444;
  position: absolute;
  top: 3rem;
  right: 1rem;
  padding: 1rem;
  border-radius: 5px;
}
.menu-links a {
  margin: 0.5rem 0;
}
.menu-links.show {
  display: flex;
}

/* ✅ Desktop navbar */
@media (min-width: 768px) {
  .menu-toggle { display: none; }
  .menu-links {
    display: flex !important;
    flex-direction: row;
    position: static;
    background: none;
    padding: 0;
  }
  .menu-links a { margin: 0 0.5rem; }
}

/* ✅ Mobile hamburger positioning */
@media (max-width: 768px) {
  .menu-toggle {
    position: absolute;
    top: 0.75rem;
    right: 1rem; /* move to upper right corner */
  }
}

/* ------------------------------------------------------------
   📚 Sidebar
------------------------------------------------------------ */
.sidebar {
  flex-shrink: 0;
}
@media (max-width: 1024px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.5rem;
    box-shadow: none;
  }
  .container {
    margin-right: 0;
    padding-top: 5rem;
  }
}
@media (max-width: 480px) {
  .sidebar {
    display: none; /* hide sidebar on very small screens */
  }
  .container {
    padding-top: 4rem;
  }
}

/* ------------------------------------------------------------
   📝 Forms (signup/login/etc.)
------------------------------------------------------------ */
.signup-card, .login-card {
  max-width: 400px;
  width: 90%;
}
@media (max-width: 768px) {
  .signup-card, .login-card {
    width: 95%;
    padding: 1rem;
  }
}
@media (max-width: 480px) {
  .signup-card, .login-card {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
  }
  .signup-card input, .login-card input {
    font-size: 0.9rem;
  }
}

/* ------------------------------------------------------------
   📦 Question cards grid
------------------------------------------------------------ */
#question-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.question-card {
  padding: 1rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(6px);
}

/* ------------------------------------------------------------
   📊 Tables
------------------------------------------------------------ */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 0.5rem;
  text-align: left;
}
@media (max-width: 768px) {
  table, thead, tbody, th, td, tr {
    display: block;
  }
  th {
    display: none;
  }
  td {
    border: none;
    position: relative;
    padding-left: 50%;
  }
  td::before {
    position: absolute;
    left: 0.5rem;
    white-space: nowrap;
    font-weight: bold;
    content: attr(data-label);
  }
}

/* ------------------------------------------------------------
   🖼️ Media
------------------------------------------------------------ */
img, video {
  max-width: 100%;
  height: auto;
}

/* ------------------------------------------------------------
   🧭 Footer
------------------------------------------------------------ */
footer {
  font-size: clamp(0.8rem, 1.2vw, 1rem);
  padding: 1rem;
}

/* ------------------------------------------------------------
   🛠️ Utility classes
------------------------------------------------------------ */
.hidden-mobile { display: block; }
@media (max-width: 480px) {
  .hidden-mobile { display: none; }
}
.hidden-desktop { display: none; }
@media (max-width: 768px) {
  .hidden-desktop { display: block; }
}