/*
    SAYON INSTITUTE OF INNOVATION - FULLY RESPONSIVE & FIXED DESIGN
    ----------------------------------------------------
    ✅ No horizontal overflow on any device
    ✅ Smooth mobile menu animations
    ✅ Modern sidebar styling
    ✅ Proper mobile scaling
    ✅ 100% viewport compliance
*/

/* === DESIGN TOKENS === */
:root {
  --primary: #6b46c1;
  --primary-dark: #553c9a;
  --primary-light: #9f7aea;
  --secondary: #ed8936;
  --accent: #d69e2e;
  --success: #48bb78;
  --error: #f56565;
  --warning: #ecc94b;
  --info: #4299e1;

  --gray-50: #f7fafc;
  --gray-100: #edf2f7;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e0;
  --gray-400: #a0aec0;
  --gray-500: #718096;
  --gray-600: #4a5568;
  --gray-700: #2d3748;
  --gray-800: #1a202c;
  --gray-900: #171923;

  --font-primary: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", var(--font-primary);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* === RESET & BASE === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  /* FIX: Prevent horizontal scroll at root level */
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-primary);
  line-height: 1.6;
  color: var(--gray-800);
  background: linear-gradient(135deg, #1a1c2c 0%, #4a237e 100%);
  background-attachment: fixed;
  /* FIX: Prevent body from causing horizontal overflow */
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* FIX: Constrain all containers to prevent overflow */
.container {
  max-width: 1280px;
  margin: 0 auto;
  /* FIX: Use responsive padding that won't cause overflow */
  padding: 0 clamp(1rem, 3vw, 1.5rem);
  width: 100%;
}

.container-fluid {
  width: 100%;
  /* FIX: Responsive padding */
  padding: 0 clamp(1rem, 3vw, 1.5rem);
  max-width: 100vw;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* === HEADER === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-md);
  animation: slideDown 0.5s ease;
  /* FIX: Ensure header doesn't cause overflow */
  width: 100%;
  /*overflow-x: hidden; */
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.5rem, 2vw, 1.5rem);
  padding: var(--space-4) 0;
  /* FIX: Prevent header content overflow */
  width: 100%;
  max-width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition-base);
  /* FIX: Prevent brand from growing too large */
  flex-shrink: 1;
  min-width: 0;
}

.brand:hover {
  transform: scale(1.02);
}

.brand .logo {
  height: 48px;
  width: auto;
  transition: transform var(--transition-base);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  /* FIX: Ensure logo doesn't break layout */
  flex-shrink: 0;
}

.brand:hover .logo {
  transform: rotate(-3deg) scale(1.05);
}

.brand-text {
  /* FIX: Allow text to shrink if needed */
  min-width: 0;
  flex-shrink: 1;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: clamp(0.875rem, 2vw, 1.25rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  /* FIX: Prevent text overflow */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-text .tagline {
  font-size: clamp(0.75rem, 1.5vw, 0.85rem);
  color: var(--gray-600);
  font-weight: 500;
  /* FIX: Hide tagline on very small screens */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  align-items: center;
  /* FIX: Allow nav to shrink */
  flex-shrink: 1;
  min-width: 0;
}

.nav-list {
  display: flex;
  align-items: center;
  list-style: none;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  /* FIX: Prevent nav from growing too large */
  flex-wrap: nowrap;
}

.nav-list li {
  flex-shrink: 0;
}

.nav-link {
  position: relative;
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  color: var(--gray-700);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  white-space: nowrap;
}

.nav-link::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: translateX(-50%);
  transition: width var(--transition-base);
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  background: rgba(107, 70, 193, 0.05);
}

.nav-link:hover::before,
.nav-link.active::before {
  width: 80%;
}

/* FIX: Modern hamburger menu styling */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  position: relative;
  z-index: 2001;
}

.nav-toggle .bar {
  width: 24px;
  height: 2px;
  background-color: var(--primary);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: absolute;
}

.nav-toggle .bar:nth-child(1) {
  top: 8px;
}

.nav-toggle .bar:nth-child(2) {
  top: 15px;
}

.nav-toggle .bar:nth-child(3) {
  top: 22px;
}

/* FIX: Smooth X animation when active */
.nav-toggle.active .bar:nth-child(1) {
  top: 15px;
  transform: rotate(45deg);
}

.nav-toggle.active .bar:nth-child(2) {
  opacity: 0;
  transform: translateX(-20px);
}

.nav-toggle.active .bar:nth-child(3) {
  top: 15px;
  transform: rotate(-45deg);
}

.profile-avatar-container {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
}

.profile-avatar-container:hover {
  background: var(--gray-100);
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 2px solid var(--accent);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

#header-username {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.9rem;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.btn:hover::before {
  transform: translateX(100%);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}

.btn-hero {
  padding: var(--space-4) var(--space-8);
  font-size: 1.1rem;
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-xl);
}

.btn-block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* === HERO SECTION === */
.hero {
  position: relative;
  /* FIX: Responsive padding instead of fixed 120px */
  padding: clamp(3rem, 10vh, 7.5rem) 0;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(107, 70, 193, 0.95), rgba(159, 122, 234, 0.9)),
    url("https://images.unsplash.com/photo-1522202176988-66273c2fd55f?w=1600") center / cover;
  /* FIX: Ensure hero doesn't cause horizontal scroll */
  width: 100%;
  max-width: 100vw;
}

.hero-background {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.1), transparent 60%),
    radial-gradient(circle at 70% 80%, rgba(236, 72, 153, 0.2), transparent 60%);
  animation: heroShine 8s ease-in-out infinite;
}

@keyframes heroShine {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
  /* FIX: Prevent hero content overflow */
  max-width: 100%;
  padding: 0 clamp(1rem, 3vw, 1.5rem);
}

.hero-title {
  font-family: var(--font-display);
  /* FIX: Fully responsive font size */
  font-size: clamp(1.75rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: var(--space-4);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
  /* FIX: Prevent text overflow */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.hero-subtitle {
  /* FIX: Responsive font size */
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  margin-bottom: var(--space-8);
  opacity: 0.95;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  /* FIX: Prevent text overflow */
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding: 0 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: clamp(1rem, 3vw, 1.5rem);
  margin-top: var(--space-8);
  /* FIX: Prevent grid overflow */
  width: 100%;
  max-width: 100%;
}

.stat-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  text-align: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
  animation: fadeInUp 0.6s ease backwards;
  /* FIX: Ensure cards don't overflow */
  min-width: 0;
}

.stat-card:nth-child(1) {
  animation-delay: 0.1s;
}
.stat-card:nth-child(2) {
  animation-delay: 0.2s;
}
.stat-card:nth-child(3) {
  animation-delay: 0.3s;
}
.stat-card:nth-child(4) {
  animation-delay: 0.4s;
}

.stat-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-2xl);
}

.stat-icon {
  font-size: 3rem;
  margin-bottom: var(--space-3);
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.stat-card h3 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: var(--space-2);
}

.stat-card p {
  color: var(--gray-600);
  font-weight: 600;
}

/* === PAGE SECTIONS === */
.page {
  display: none;
  min-height: calc(100vh - 200px);
  animation: fadeIn 0.5s ease;
  /* FIX: Prevent page overflow */
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-section {
  padding: clamp(2rem, 5vw, 3rem) 0;
  /* FIX: Prevent section overflow */
  width: 100%;
  max-width: 100%;
}

.content-section1 h2,
.content-section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.8rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: var(--space-8);
  color: white;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
  /* FIX: Prevent heading overflow */
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding: 0 1rem;
}

/* === ABOUT PAGE === */
.about-hero {
  text-align: center;
  padding: clamp(1.5rem, 4vw, 2rem);
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-xl);
  margin-top: 29px;
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-lg);
  /* FIX: Prevent about hero overflow */
  width: 100%;
  max-width: 100%;
}

.about-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--gray-600);
  margin-top: var(--space-3);
}

.about-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: clamp(1rem, 3vw, 1.5rem);
  margin-bottom: var(--space-8);
  /* FIX: Prevent grid overflow */
  width: 100%;
}

.about-card {
  background: rgba(255, 255, 255, 0.95);
  padding: clamp(1.5rem, 4vw, 2rem) clamp(1rem, 3vw, 1.5rem);
  border-radius: var(--radius-xl);
  text-align: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
  border-top: 4px solid var(--accent);
  /* FIX: Ensure cards don't overflow */
  min-width: 0;
  word-wrap: break-word;
}

.about-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-2xl);
}

.about-icon {
  font-size: clamp(2.5rem, 6vw, 4rem);
  margin-bottom: var(--space-4);
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

.about-card h3 {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  color: var(--primary);
  margin-bottom: var(--space-3);
  font-weight: 700;
}

/* === COURSES === */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: clamp(1rem, 3vw, 1.5rem);
  /* FIX: Prevent courses grid overflow */
  width: 100%;
}

.course-card {
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
  animation: fadeInUp 0.6s ease backwards;
  /* FIX: Ensure cards don't overflow */
  min-width: 0;
}

.course-card:hover {
  transform: translateY(-12px);
  box-shadow: var(--shadow-2xl);
}

.course-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.course-card:hover img {
  transform: scale(1.1);
}

.course-card-content {
  padding: clamp(1rem, 3vw, 1.5rem);
}

.course-card-content h3 {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--primary-dark);
  margin-bottom: var(--space-3);
  font-weight: 700;
  word-wrap: break-word;
}

.course-description {
  color: var(--gray-700);
  margin-bottom: var(--space-4);
  line-height: 1.7;
  word-wrap: break-word;
}

/* === CONTACT === */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
  gap: clamp(1.5rem, 4vw, 2rem);
  /* FIX: Prevent contact grid overflow */
  width: 100%;
}

.contact-form-container,
.contact-details {
  background: rgba(255, 255, 255, 0.98);
  padding: clamp(1rem, 3vw, 1.5rem);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  /* FIX: Ensure contact boxes don't overflow */
  min-width: 0;
  word-wrap: break-word;
}

.contact-details h3 {
  color: var(--primary-dark);
  margin-bottom: var(--space-4);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
}

.contact-details p {
  color: var(--gray-700);
  margin-bottom: var(--space-3);
  line-height: 1.8;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.contact-details a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
  word-wrap: break-word;
}

.contact-details a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* === FORMS === */
form {
  background: transparent;
  padding: 0;
  box-shadow: none;
  /* FIX: Prevent form overflow */
  width: 100%;
  max-width: 100%;
}

.form-group {
  margin-bottom: var(--space-5);
  /* FIX: Prevent form group overflow */
  width: 100%;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  transition: all var(--transition-base);
  background: white;
  /* FIX: Prevent input overflow */
  max-width: 100%;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}

/* === DASHBOARD === */
.dashboard-layout {
  display: flex;
  gap: clamp(1rem, 3vw, 1.5rem);
  padding: clamp(1rem, 3vw, 1.5rem) 0;
  position: relative;
  /* FIX: Prevent dashboard overflow */
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.sidebar-toggle {
  display: none;
}

.dashboard-sidebar {
  flex: 0 0 280px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: clamp(1rem, 3vw, 1.5rem);
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  transition: all var(--transition-base);
  /* FIX: Ensure sidebar doesn't overflow */
  min-width: 0;
}

/* FIX: Modern sidebar header with proper divider */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 3px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(90deg, var(--primary), var(--accent)) border-box;
  border-bottom: 3px solid;
  border-image: linear-gradient(90deg, var(--primary), var(--accent)) 1;
  position: relative;
}

.sidebar-header h3 {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  color: var(--primary);
  font-weight: 700;
  margin: 0;
  /* Remove old border-bottom as we're using the parent's border */
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: color var(--transition-fast);
  padding: 0;
  width: 32px;
  height: 32px;
  position: relative;
}

.sidebar-close:hover {
  color: var(--error);
}

/* FIX: Modern X close button */
.sidebar-close .icon-bar {
  position: absolute;
  width: 24px;
  height: 2px;
  background-color: var(--gray-600);
  border-radius: 2px;
  top: 50%;
  left: 50%;
  transition: all 0.3s ease;
}

.sidebar-close .icon-bar:nth-child(1) {
  transform: translate(-50%, -50%) rotate(45deg);
}

.sidebar-close .icon-bar:nth-child(2) {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.sidebar-close:hover .icon-bar {
  background-color: var(--error);
}

.dashboard-sidebar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
}

.dashboard-sidebar button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: left;
  position: relative;
}

.dashboard-sidebar button .icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.dashboard-sidebar button:hover {
  background: var(--gray-100);
  border-color: var(--primary-light);
  transform: translateX(4px);
}

.dashboard-sidebar button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: var(--shadow-md);
}

.dashboard-content {
  flex: 1;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 4vw, 2rem);
  box-shadow: var(--shadow-lg);
  min-height: 600px;
  animation: fadeIn 0.5s ease;
  /* FIX: Ensure content doesn't overflow */
  min-width: 0;
  overflow-x: auto;
}

.dashboard-content h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--primary);
  margin-bottom: var(--space-6);
  text-shadow: none;
  word-wrap: break-word;
}

.greeting-banner {
  padding: clamp(1rem, 3vw, 1.5rem) clamp(1.5rem, 4vw, 2rem);
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: var(--radius-xl);
  color: white;
  margin-top: 30px;
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-xl);
  animation: slideInDown 0.6s ease;
  /* FIX: Prevent banner overflow */
  width: 100%;
  max-width: 100%;
  word-wrap: break-word;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === DYNAMIC GREETING STYLES === */
.greeting-banner {
  transition: background 0.5s ease, color 0.5s ease;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.greeting-content {
  display: flex;
  align-items: center;
  gap: 15px;
  z-index: 2;
  /* FIX: Prevent greeting content overflow */
  flex-wrap: wrap;
  width: 100%;
}

.greeting-icon {
  font-size: clamp(2rem, 5vw, 2.5rem);
  animation: float 3s ease-in-out infinite;
  flex-shrink: 0;
}

.greeting-banner h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: white;
  margin-bottom: var(--space-2);
}

/* Time-based Themes */
.greeting-morning {
  background: linear-gradient(135deg, #FF9966, #FF5E62); /* Orange Sunrise */
}
.greeting-afternoon {
  background: linear-gradient(135deg, #56CCF2, #2F80ED); /* Blue Sky */
}
.greeting-evening {
  background: linear-gradient(135deg, #232526, #414345); /* Dark Night */
}

.course-selector-container {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: clamp(1rem, 3vw, 1.25rem);
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-md);
  /* FIX: Prevent selector overflow */
  width: 100%;
  max-width: 100%;
  flex-wrap: wrap;
}

.course-selector-container label {
  flex-shrink: 0;
  font-weight: 600;
}

.course-selector {
  flex: 1;
  min-width: 200px;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  /* FIX: Prevent selector overflow */
  max-width: 100%;
  box-sizing: border-box;
}

.course-selector:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: clamp(1rem, 3vw, 1.25rem);
  margin: var(--space-6) 0;
  /* FIX: Prevent dashboard grid overflow */
  width: 100%;
}

.dashboard-card {
  padding: clamp(1rem, 3vw, 1.5rem);
  background: linear-gradient(135deg, var(--gray-50), white);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  /* FIX: Ensure cards don't overflow */
  min-width: 0;
  word-wrap: break-word;
}

.dashboard-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

.dashboard-card h4 {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.dashboard-card p {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--primary);
  word-wrap: break-word;
}

/* Tables */
.data-table-container {
  /* FIX: Make tables scrollable on mobile */
  overflow-x: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.marks-table,
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: var(--space-6) 0;
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  /* FIX: Minimum width for table to be usable */
  min-width: 600px;
}

.marks-table thead,
.data-table thead {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.marks-table th,
.marks-table td,
.data-table th,
.data-table td {
  padding: clamp(0.5rem, 2vw, 1rem);
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
  word-wrap: break-word;
}

.marks-table tbody tr,
.data-table tbody tr {
  transition: background var(--transition-fast);
}

.marks-table tbody tr:hover,
.data-table tbody tr:hover {
  background: var(--gray-50);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.status-badge.pass {
  background: linear-gradient(135deg, var(--success), #48bb78);
  color: white;
}

.status-badge.fail {
  background: linear-gradient(135deg, var(--error), #fc8181);
  color: white;
}

.status-badge.enrolled {
  background: linear-gradient(135deg, var(--info), #63b3ed);
  color: white;
}

.status-badge.completed {
  background: linear-gradient(135deg, var(--success), #68d391);
  color: white;
}

/* === MODALS === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* FIX: Prevent backdrop scrolling issues */
  overflow-y: auto;
  padding: 1rem;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 2001;
  display: flex;
  align-items: center;
  justify-content: center;
  /* FIX: Allow modal scrolling on overflow */
  overflow-y: auto;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 4vw, 2rem);
  /* FIX: Responsive modal width */
  max-width: min(500px, calc(100vw - 2rem));
  width: 100%;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  box-shadow: var(--shadow-2xl);
  position: relative;
  margin: auto;
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: color var(--transition-fast);
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
}

.modal-close:hover {
  color: var(--error);
}

/* Improved login role switcher styles */
.login-role-switcher {
  display: flex;
  gap: var(--space-3);
  margin: var(--space-6) 0;
  padding: var(--space-2);
  background: var(--gray-100);
  border-radius: var(--radius-lg);
  /* FIX: Allow wrapping on very small screens */
  flex-wrap: wrap;
}

.role-btn {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: all var(--transition-base);
}

.role-btn .role-icon {
  font-size: 2rem;
}

.role-btn:hover {
  background: white;
  border-color: var(--primary-light);
}

.role-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-color: var(--primary);
}

/* Fixed WhatsApp button - no distortion on scroll */
.whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: #25d366;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  text-decoration: none;
}

.whatsapp-float:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

.whatsapp-float svg {
  width: 32px;
  height: 32px;
}

/* Notification badge for announcements */
.notification-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--error);
  color: white;
  border-radius: var(--radius-full);
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.9;
  }
}

/* === NOTIFICATION BELL === */
.notification-bell {
  position: relative;
  cursor: pointer;
  padding: 8px;
  color: var(--gray-700);
  transition: color var(--transition-base);
}

.notification-bell:hover {
  color: var(--primary);
}

.notification-bell svg {
  width: 24px;
  height: 24px;
}

.bell-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--error);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Footer styles */
.site-footer {
  background: var(--gray-800);
  color: white;
  padding: clamp(1.5rem, 3vw, 2rem) 0;
  text-align: center;
  margin-top: var(--space-8);
  /* FIX: Ensure footer doesn't cause overflow */
  width: 100%;
  max-width: 100vw;
}

.site-footer p {
  margin: 0;
  opacity: 0.9;
  word-wrap: break-word;
}

/* Utility classes */
.text-center {
  text-align: center;
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

/* Loader */
.loader-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.error-message {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: var(--space-2);
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-4) var(--space-6);
  background: var(--gray-800);
  color: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 3001;
  font-weight: 600;
  transition: all var(--transition-base);
  /* FIX: Ensure toast doesn't overflow */
  max-width: calc(100vw - 2rem);
  word-wrap: break-word;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--error);
}

.toast.info {
  background: var(--info);
}

/* === RESPONSIVENESS (Mobile Fixes) === */
@media (max-width: 768px) {
  /* FIX: Ensure body doesn't overflow */
  body {
    min-width: 0;
    overflow-x: hidden;
  }

  /* FIX: Further constrain containers on mobile */
  .container,
  .container-fluid {
    padding: 0 1rem;
  }

  /* FIX: Show hamburger menu toggle */
  .nav-toggle {
    display: flex;
    position: relative;
    z-index: 2001;
  }

  /* FIX: Mobile navigation - Ensure items are visible */
  .main-nav {
    position: static; /* Critical: prevents stacking context issues */
  }

  .nav-list {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(85%, 300px);
    height: 100vh;
    background: white;
    flex-direction: column;
    align-items: flex-start;
    padding: 80px 20px 20px;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000; /* Higher than header */
    overflow-y: auto;
    overflow-x: hidden;
    /* Critical fixes for visibility */
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .nav-list.active {
    right: 0;
  }

  .nav-list li {
    width: 100%;
    margin-bottom: 10px;
    /* Ensure list items are visible */
    display: block;
  }
  /* Add this immediately after to ensure hidden items STAY hidden */
  .nav-list li.hidden,
  .hidden {
    display: none !important;
  }


  .nav-link,
  .nav-list .btn {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    display: block !important;
    /* Ensure text is visible */
    color: var(--gray-800) !important;
    background: transparent;
    text-align: left;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .nav-link:hover,
  .nav-link.active {
    background: var(--gray-100);
    color: var(--primary) !important;
  }

  /* Ensure buttons in nav are visible */
  .nav-list .btn-primary,
  .nav-list .btn-secondary,
  .nav-list .btn-enroll {
    display: block !important;
    width: 100%;
    text-align: center;
    margin: 0;
    background: var(--primary) !important;
    color: white !important;
  }

  /* Profile and notification items */
  .profile-avatar-container {
    width: 100%;
    justify-content: flex-start;
    padding: var(--space-3) var(--space-4);
  }

  #header-username {
    display: inline-block;
    color: var(--gray-800) !important;
  }

  .notification-bell {
    display: inline-flex;
    color: var(--gray-800) !important;
  }

  /* FIX: Mobile dashboard layout */
  .dashboard-layout {
    flex-direction: column;
    padding: 1rem 0;
  }

  /* FIX: Show sidebar toggle button */
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: var(--radius-md);
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 900;
    box-shadow: var(--shadow-lg);
    width: 56px;
    height: 56px;
    flex-direction: column;
    gap: 4px;
  }

  .sidebar-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
  }

  /* FIX: Sidebar slide-in from left */
  .dashboard-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: min(80%, 280px);
    height: 100vh;
    z-index: 2000;
    background: white;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    padding: 20px;
    max-height: 100vh;
    margin-top: 0;
  }

  .dashboard-sidebar.mobile-open {
    left: 0;
  }

  /* FIX: Show close button in sidebar */
  .sidebar-close {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  /* FIX: Full width dashboard content on mobile */
  .dashboard-content {
    width: 100%;
    padding: 1.5rem 1rem;
    min-height: auto;
  }

  /* FIX: Course selector stacks vertically on mobile */
  .course-selector-container {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: 1rem;
  }

  .course-selector {
    width: 100%;
    min-width: 0;
  }

  /* FIX: Stats grid becomes 2 columns on mobile */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  /* FIX: Dashboard grid becomes 1 column on very small screens */
  @media (max-width: 480px) {
    .dashboard-grid {
      grid-template-columns: 1fr;
    }

    .stats-grid {
      grid-template-columns: 1fr;
    }
  }

  /* FIX: Hero section mobile adjustments */
  .hero {
    padding: 3rem 0;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 1rem;
    padding: 0 0.5rem;
  }

  /* FIX: About cards stack on mobile */
  .about-content {
    grid-template-columns: 1fr;
  }

  /* FIX: Courses grid becomes 1 column on mobile */
  .courses-grid {
    grid-template-columns: 1fr;
  }

  /* FIX: Contact grid stacks on mobile */
  .contact-grid {
    grid-template-columns: 1fr;
  }

  /* FIX: Modal adjustments for mobile */
  .modal-content {
    padding: 1.5rem 1rem;
    max-width: calc(100vw - 1rem);
    margin: 0.5rem;
  }

  /* FIX: Form inputs full width on mobile */
  .form-group input,
  .form-group textarea,
  .form-group select {
    padding: 0.75rem 1rem;
  }

  /* FIX: Button adjustments for mobile */
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }

  .btn-hero {
    padding: 1rem 2rem;
    font-size: 1rem;
  }

  /* FIX: WhatsApp float button positioning on mobile */
  .whatsapp-float {
    bottom: 90px;
    right: 16px;
    width: 50px;
    height: 50px;
  }

  .whatsapp-float svg {
    width: 28px;
    height: 28px;
  }

  /* FIX: Brand text truncation on very small screens */
  @media (max-width: 400px) {
    .brand-text .tagline {
      display: none;
    }

    .brand .logo {
      height: 40px;
    }

    .brand-text h1 {
      font-size: 0.875rem;
    }
  }

  /* FIX: Table scroll hint */
  .data-table-container::after {
    content: '← Scroll for more →';
    display: block;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
    color: var(--gray-500);
    font-style: italic;
  }

  /* FIX: Ensure modals are scrollable */
  .modal {
    padding: 0.5rem;
  }

  /* FIX: Login role switcher stacks on very small screens */
  @media (max-width: 400px) {
    .login-role-switcher {
      flex-direction: column;
    }

    .role-btn {
      width: 100%;
    }
  }
}

/* FIX: Medium screens (tablets) adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    padding: 0 1.5rem;
  }

  .dashboard-sidebar {
    flex: 0 0 240px;
  }

  .hero {
    padding: 5rem 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* FIX: Prevent any element from causing horizontal scroll */
* {
  max-width: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

/* FIX: Smooth scrolling for all scrollable elements */
* {
  -webkit-overflow-scrolling: touch;
}

/* FIX: Prevent zoom on input focus on iOS */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px;
  }
}

/* === FIX FOR BELL ICON POSITION === */

/* Wrapper to align bell nicely */
.notification-wrapper {
  display: flex;
  align-items: center;
  margin-left: auto; /* Pushes bell to the right side */
  margin-right: 15px; /* Space between Bell and Toggle/Menu */
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
  .notification-wrapper {
    margin-right: 10px; /* Smaller space on mobile */
  }
  
  /* Ensure bell is visible on white header */
  .notification-bell {
    color: var(--primary); 
  }
}

/* Desktop adjustments */
@media (min-width: 769px) {
  .notification-wrapper {
    /* On desktop, remove the auto margin so it sits next to links */
    margin-left: 0; 
    order: 2; /* Control order if needed */
  }
  
  .nav-list {
    order: 1; /* Links first */
  }
}