/* ==========================================================================
   IBM Mainframe Learning Platform - Initial Modern Light UI Components
   Matches exact original screenshot design with ultra responsive layout.
   ========================================================================== */

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.app-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) calc(100vh - var(--header-height));
  grid-template-areas: 
    "header header"
    "sidebar main";
  height: 100vh;
  width: 100%;
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Header Navigation Bar (Frosted White Modern Header)
   -------------------------------------------------------------------------- */
.header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.03);
  z-index: 100;
  width: 100%;
  box-sizing: border-box;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  padding: 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.mobile-menu-btn:active {
  background: #f1f5f9;
  transform: scale(0.95);
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--ibm-blue), #0043ce);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(15, 98, 254, 0.3);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  background: #eff6ff;
  color: var(--ibm-blue);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.header-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #eff6ff;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid #dbeafe;
  flex-shrink: 0;
}

.header-progress-text {
  font-size: 0.8rem;
  color: var(--ibm-blue);
  font-weight: 700;
  white-space: nowrap;
}

.header-progress-bar {
  width: 85px;
  height: 7px;
  background: #dbeafe;
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.header-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ibm-blue), #0284c7);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

/* --------------------------------------------------------------------------
   Sidebar Navigation & Mobile Drawer
   -------------------------------------------------------------------------- */
.sidebar {
  grid-area: sidebar;
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1.5rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  z-index: 90;
}

.sidebar-header-mobile {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  color: #0f172a;
  font-weight: 700;
}

.close-sidebar-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #64748b;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
}

.sidebar-section-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ibm-blue);
  margin-bottom: 0.75rem;
}

.module-group {
  margin-bottom: 1.25rem;
}

.module-header {
  font-size: 0.875rem;
  font-weight: 800;
  color: #0f172a;
  padding: 0.5rem 0;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem;
  color: #334155;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.lesson-item:hover {
  background: #eff6ff;
  color: var(--ibm-blue);
}

.lesson-item.active {
  background: linear-gradient(90deg, #0f62fe 0%, #0043ce 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(15, 98, 254, 0.3);
}

.lesson-status-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  flex-shrink: 0;
}

.lesson-item.completed .lesson-status-icon {
  border-color: #10b981;
  background: #10b981;
  color: #ffffff;
}

/* Backdrop for Mobile Sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 150;
}

/* --------------------------------------------------------------------------
   Main Content Area & Cards
   -------------------------------------------------------------------------- */
.main-content {
  grid-area: main;
  background-color: var(--bg-dark);
  overflow-y: auto;
  padding: 2rem 1.5rem 4rem 1.5rem;
  display: flex;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
}

.lesson-container {
  width: 100%;
  max-width: 980px; /* max-w-4xl / max-w-5xl centered width */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-sizing: border-box;
}

/* Inner Card Multi-Column Grid Utilities */
.card-inner-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.card-inner-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .card-inner-grid-2,
  .card-inner-grid-3 {
    grid-template-columns: 1fr !important;
  }
}

/* General Card Styling */
.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.6rem 1.75rem;
  box-shadow: var(--shadow-sm);
  color: var(--text-main);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
  width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}

.card:hover {
  border-color: #0f62fe;
  box-shadow: 0 8px 28px rgba(15, 98, 254, 0.14), 0 0 0 3px rgba(15, 98, 254, 0.18);
  transform: translateY(-3px);
}

/* Feature item card hover matching card's top accent color */
.feature-card-item:hover {
  border-color: var(--card-accent, #0f62fe) !important;
  box-shadow: 0 10px 28px -4px var(--card-accent, rgba(15, 98, 254, 0.2)) !important;
}

/* Theme-Matching Card Hover Variants */
.card-success {
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
}

.card-success:hover {
  border-color: #10b981 !important;
  box-shadow: 0 8px 28px rgba(16, 185, 129, 0.15), 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
  transform: translateY(-3px);
}

.card-warning {
  background: #fffbeb !important;
  border-color: #fde68a !important;
  border-left: 4px solid #f59e0b !important;
}

.card-warning:hover {
  border-color: #f59e0b !important;
  box-shadow: 0 8px 28px rgba(245, 158, 11, 0.18), 0 0 0 3px rgba(245, 158, 11, 0.22) !important;
  transform: translateY(-3px);
}

.card-hero:hover {
  border-color: #2563eb !important;
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.15), 0 0 0 3px rgba(37, 99, 235, 0.2) !important;
  transform: translateY(-3px);
}

/* Hero Title Card - Light Soft Blue Palette from Original Mockup */
.card-hero {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  box-shadow: 0 4px 15px rgba(15, 98, 254, 0.06);
  padding: 1.85rem 1.75rem;
  border-radius: var(--radius-md);
  color: #0f172a;
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: break-word;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background: #ffffff;
  color: #0f62fe;
  border: 1px solid #bfdbfe;
}

.hero-dot {
  color: #94a3b8;
  font-size: 0.8rem;
}

.hero-difficulty {
  font-size: 0.8rem;
  color: #475569;
  font-weight: 600;
}

.hero-title {
  font-size: clamp(1.3rem, 4vw, 1.85rem);
  font-weight: 800;
  color: #0f172a !important;
  line-height: 1.35;
  margin: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.hero-subtitle {
  font-size: clamp(0.9rem, 2.8vw, 1.05rem);
  color: #2563eb !important;
  margin-top: 0.45rem;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Section Labels */
.card-section-label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-section-label svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Quiz Component Styling
   -------------------------------------------------------------------------- */
.card-quiz {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.6rem 1.75rem;
  box-shadow: var(--shadow-sm);
}

.quiz-question {
  font-size: 1.025rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 0.5rem;
  margin-bottom: 1.15rem;
  line-height: 1.5;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-option-btn {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.15rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: #1e293b;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  outline: none;
}

.quiz-option-btn:hover:not(:disabled) {
  border-color: #0f62fe;
  background: #eff6ff;
  color: #0f62fe;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 98, 254, 0.08);
}

.quiz-option-btn.selected-correct {
  background: #f0fdf4 !important;
  border-color: #10b981 !important;
  color: #15803d !important;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.15) !important;
}

.quiz-option-btn.selected-wrong {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
  font-weight: 600;
}

.quiz-feedback {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.925rem;
  line-height: 1.6;
  display: none;
}

.quiz-feedback.show-correct {
  display: block;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #14532d;
}

.quiz-feedback.show-wrong {
  display: block;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* --------------------------------------------------------------------------
   Mobile & Tablet Responsive Adjustments (< 768px Breakpoint)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .app-container {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas: 
      "header"
      "main";
  }

  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 290px;
    height: 100vh;
    z-index: 200;
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .sidebar-header-mobile {
    display: flex;
  }

  .main-content {
    padding: 1.25rem 0.85rem 7.5rem 0.85rem;
  }
}

@media (max-width: 540px) {
  .header {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }

  .brand-badge {
    display: none;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .header-progress-wrap {
    padding: 0.25rem 0.55rem;
    gap: 0.35rem;
  }

  .header-progress-bar {
    width: 45px;
  }

  .header-progress-text {
    font-size: 0.75rem;
  }

  .card {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-sm);
  }

  .card-hero {
    padding: 1.35rem 1.1rem;
  }

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

/* Mobile Touch & Safari Navigation Support */
.card-next-step {
  margin-bottom: 2.5rem;
}

.btn-next {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 640px) {
  .main-content {
    padding-bottom: 8.5rem !important;
  }

  .card-next-step {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1.25rem !important;
  }

  .btn-next {
    width: 100% !important;
    justify-content: center !important;
    padding: 0.9rem 1.25rem !important;
    font-size: 1rem !important;
  }
}
