/* ==========================================
   THEME CONFIGURATIONS (Crisp Light Mode)
   ========================================== */
:root {
  --bg-color: #f8fafc;      /* Clean, off-white background canvas */
  --card-bg: #ffffff;       /* Pure white card surfaces to stand out */
  --primary: #5d5fef;       /* Premium brand indigo/purple accent look */
  --primary-hover: #4b4dd6; /* Deeper tone for hover states */
  --text-main: #0f172a;     /* Deep charcoal/slate for razor-sharp text contrast */
  --text-muted: #64748b;    /* Elegant slate-gray for descriptive copy */
  --border: #e2e8f0;        /* Light gray borders for a clean outline look */
}

/* ==========================================
   BASE & STRUCTURAL CONTAINER LAYOUTS
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
}

.app-container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px 80px 24px; /* Generous breathing space at the bottom */
}

/* ==========================================
   GLOBAL TOP NAVIGATION BAR STYLING
   ========================================== */
.top-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 40px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin: 0;
}

.nav-links-cluster {
  display: flex;
  gap: 32px;
}

.top-nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.top-nav-link:hover {
  color: var(--primary);
}

/* ==========================================
   LANDING HERO CONTAINER & ACTIONS
   ========================================== */
.hero-section {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #311042 100%);
  padding: 90px 24px;
  text-align: center;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  animation: heroFadeIn 0.5s ease-out;
}

@keyframes heroFadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-badge {
  background: rgba(93, 95, 239, 0.15);
  border: 1px solid rgba(93, 95, 239, 0.35);
  color: #cbccff;
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 3rem;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.hero-title strong {
  font-weight: 700;
  color: #818cf8; /* Soft readable purple indigo pop */
}

.hero-subtitle {
  font-size: 1.15rem;
  color: #94a3b8;
  line-height: 1.6;
  max-width: 620px;
  margin: 0 auto 36px auto;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.hero-btn {
  padding: 12px 26px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.primary-btn {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(93, 95, 239, 0.3);
}

.primary-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(93, 95, 239, 0.5);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ==========================================
   GRIDS AND DIRECTORY CARDS Layouts
   ========================================== */
.section-header {
  margin-top: 60px;
  margin-bottom: 30px;
  text-align: left;
}

.section-header h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.section-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.subject-card {
  background-color: var(--card-bg);   
  border: 1px solid var(--border);    
  border-radius: 14px;          
  padding: 35px 24px;
  text-align: center;
  text-decoration: none;        
  color: inherit;               
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.05), 0 8px 16px -6px rgba(15, 23, 42, 0.05); 
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.subject-card:hover {
  transform: translateY(-5px);  
  border-color: #cbd5e1;        
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.subject-card h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
}

.subject-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.card-action-link {
  display: inline-block;
  margin-top: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  transition: transform 0.2s ease;
}

.subject-card:hover .card-action-link {
  transform: translateX(4px);
}

/* ==========================================
   SUBJECT SUBPAGE STRUCTURES
   ========================================== */
.subject-header {
  text-align: left;
  margin-top: 40px;
  margin-bottom: 30px;
}

.back-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-block;
  margin-bottom: 16px;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--primary-hover);
}

.subject-title {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.subject-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.controls-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 24px;
  margin-bottom: 35px;
}

.filter-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-wrapper label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

.filter-wrapper select {
  padding: 8px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-main);
  background: var(--bg-color);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  min-width: 220px;
  transition: border-color 0.2s ease;
}

.filter-wrapper select:focus {
  border-color: var(--primary);
}

.feed-status-heading {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-main);
}

/* ==========================================
   DYNAMIC QUESTION FEED CARDS
   ========================================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;       
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.02);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.05);
}

.card-header {
  display: flex;
  justify-content: space-between; 
  align-items: center;            
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border); 
  padding-bottom: 8px;
}

.question-diagram {
  display: block;
  max-width: 100%;           
  height: auto;              
  max-height: 250px;         
  margin: 16px auto 0 auto;  
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: #f8fafc; 
}

.no-questions {  
  color: var(--text-muted);  
  font-style: italic;  
  text-align: center;  
  padding: 40px;  
}

/* ==========================================
   ENLARGED INTERACTIVE POP-UP MODAL FRAMEWORK
   ========================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.7); /* Deepened opacity for high contrast background separation */
  backdrop-filter: blur(5px);               
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;                            
  padding: 24px;
}

.modal-content {
  background: var(--card-bg);
  width: 94%;
  max-width: 1020px; /* Overhauled from 680px so question viewports look exceptionally broad */
  max-height: 88vh;  /* Optimized vertical height allowance */
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.3);
  display: flex;
  flex-direction: column;
  position: relative;
  animation: modalSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);   
  overflow: hidden;
}

@keyframes modalSlideUp {
  from { transform: translateY(15px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 20px 32px; /* Increased padding size footprint */
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

#modal-topic {
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
}

#modal-counter {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.modal-body {
  padding: 32px; /* Expanded technical reading workspace bounds */
  overflow-y: auto;                         
  flex-grow: 1;
}

/* Expanded text classes inside full-screen frames */
.modal-body .question-text {
  font-size: 1.25rem; /* Increased to crisp long-form size */
  line-height: 1.65;
  color: #1e293b;
  font-weight: 400;
}

/* Forces question rendering content image nodes to adapt perfectly */
#modal-image-container img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 420px; /* Escalated allowance for crystal clear physics circuit viewports */
  margin: 20px auto 0 auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.close-modal-btn {
  position: absolute;
  top: 14px;
  right: 24px;
  font-size: 2rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
  z-index: 10;
}

.close-modal-btn:hover {
  color: #ef4444;                            
}

.modal-footer {
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

.modal-nav-bar {
  display: flex;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
}

.action-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 10px 20px; /* Broad click state sizes */
  border-radius: 6px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: var(--bg-color);
  border-color: #cbd5e1;
}

.scheme-toggle {
  width: 100%;                              
  background: #f0fdf4;                      
  color: #166534;
  border-color: #bbf7d0;
  font-size: 1rem;
}

.scheme-toggle:hover {
  background: #dcfce7;
  border-color: #86efac;
}

.marking-scheme-panel {
  margin-top: 16px;
  padding: 20px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  max-height: 250px;
  overflow-y: auto;
}

#modal-scheme-list {
  padding-left: 0;
  margin: 0;
}

#modal-scheme-list li {
  font-size: 1.05rem; /* Clean text sizes for keys */
  color: #1e293b;
  line-height: 1.6;
  margin-bottom: 10px;
}

/* ==========================================
   CUSTOM SCROLLBARS & RESPONSIVENESS
   ========================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

@media (max-width: 768px) {
  .hero-title { font-size: 2.2rem; }
  .hero-actions { flex-direction: column; gap: 12px; }
  .hero-btn { width: 100%; text-align: center; }
  .top-nav-bar { padding: 16px 20px; }
  .nav-links-cluster { gap: 16px; }
  .modal { padding: 12px; }
  .modal-content { width: 100%; max-height: 94vh; }
  .modal-body { padding: 20px; }
  .modal-header, .modal-footer, .modal-nav-bar { padding: 14px 20px; }
}

/* ==========================================
   OVERHAULED RIGHT-SIDE MENU COMPONENT
   ========================================== */
.menu-btn {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background-color: var(--primary); 
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.menu-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.side-menu {
    height: 100%;
    width: 0; 
    position: fixed;
    z-index: 9999; 
    top: 0;
    right: 0; 
    background-color: #0f172a; 
    overflow-x: hidden;
    transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1); 
    padding-top: 80px;
    box-shadow: -5px 0 25px rgba(15, 23, 42, 0.15);
}

.side-menu a {
    padding: 14px 32px;
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 500;
    color: #94a3b8;
    display: block;
    transition: all 0.2s ease;
}

.side-menu a:hover {
    color: #ffffff;
    background-color: #1e293b;
    padding-left: 38px; 
}

.side-menu .close-btn {
    position: absolute;
    top: 15px;
    left: 24px; 
    font-size: 32px;
    color: #64748b;
    padding: 0;
    cursor: pointer;
    line-height: 1;
}

.side-menu .close-btn:hover {
    color: #ef4444; 
    background-color: transparent;
}

/* ==========================================
   GLOBAL FOOTER STYLES
   ========================================== */
.site-footer {
    background-color: #0f172a; 
    color: #94a3b8; 
    padding: 40px 24px 20px 24px;
    font-size: 0.9rem;
    margin-top: auto; 
    border-top: 1px solid #1e293b;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 32px;
    padding-bottom: 30px;
    border-bottom: 1px solid #1e293b;
}

.footer-brand {
    flex: 1 1 300px;
}

.footer-brand h4 {
    color: #ffffff;
    font-size: 1.2rem;
    margin: 0 0 12px 0;
    font-weight: 700;
}

.footer-brand p {
    line-height: 1.5;
    margin: 0;
}

.footer-links-group {
    display: flex;
    gap: 48px;
    flex-wrap: wrap;
}

.footer-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-column h5 {
    color: #f8fafc;
    font-size: 0.95rem;
    margin: 0 0 4px 0;
    font-weight: 600;
}

.footer-column a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-column a:hover {
    color: #2563eb; 
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
}

.footer-bottom p {
    margin: 0;
}

.footer-meta-links {
    display: flex;
    gap: 20px;
}

.footer-meta-links a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-meta-links a:hover {
    color: #94a3b8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .footer-container {
        flex-direction: column;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}
/* ==========================================
   NAVIGATION VISIBILITY FIXES
   ========================================== */
.nav-links-cluster a.top-nav-link {
    display: inline-block !important;
}

/* Ensure the header bar element stays visible above main card bodies */
.top-nav-bar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Make sure the footer container doesn't get squished out of view */
.site-footer {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    clear: both;
}