/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #2d3748;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

/* Header Styles */
.main-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 2rem 1rem;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.main-header h1 {
  font-size: 2.5rem;
  color: #4a5568;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.main-header p {
  font-size: 1.2rem;
  color: #718096;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Card Styles */
.card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Input Section */
.input-section h2 {
  color: #4a5568;
  margin-bottom: 1.5rem;
  text-align: center;
}

.input-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.input-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.input-field label {
  font-weight: 600;
  color: #4a5568;
  font-size: 1.1rem;
}

.input-field input {
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1.2rem;
  font-family: "Courier New", monospace;
  text-align: center;
  width: 150px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-field input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.binary-hint {
  font-size: 0.8rem;
  color: #718096;
  text-align: center;
}

.subtraction-symbol {
  font-size: 2rem;
  color: #e53e3e;
  font-weight: bold;
}

/* Enhanced input feedback styling */
.input-feedback {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  border-radius: 6px;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.input-feedback.success {
  background: #f0fff4;
  border-color: #68d391;
  color: #2f855a;
}

.input-feedback.error {
  background: #fef5e7;
  border-color: #fc8181;
  color: #c53030;
}

.feedback-icon {
  font-size: 1rem;
}

.feedback-text {
  font-weight: 500;
}

/* Button Styles */
.button-group {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.nav-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.primary-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.secondary-btn {
  background: #f7fafc;
  color: #4a5568;
  border: 2px solid #e2e8f0;
}

.secondary-btn:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
}

/* Added example button styling */
.example-btn {
  background: linear-gradient(135deg, #38b2ac 0%, #319795 100%);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.example-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(56, 178, 172, 0.3);
}

/* Error Message */
.error-message {
  color: #e53e3e;
  text-align: center;
  margin-top: 1rem;
  font-weight: 600;
  padding: 0.5rem;
  border-radius: 4px;
  background: rgba(229, 62, 62, 0.1);
  display: none;
}

.error-message.show {
  display: block;
}

/* Steps Section */
.steps-section h2 {
  text-align: center;
  color: white;
  margin-bottom: 2rem;
  font-size: 2rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Step Card */
.step-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  opacity: 0.6;
}

.step-card.active {
  opacity: 1;
  transform: scale(1.02);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.step-card.completed {
  opacity: 1;
  border-left: 4px solid #48bb78;
}

.step-header {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  background: rgba(102, 126, 234, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.step-number {
  font-size: 1.5rem;
  margin-right: 1rem;
}

.step-header h3 {
  flex: 1;
  color: #4a5568;
  font-size: 1.3rem;
}

.step-status {
  font-size: 1.2rem;
}

.step-content {
  padding: 1.5rem;
}

/* Binary Display */
.binary-display {
  background: #f7fafc;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  font-family: "Courier New", monospace;
}

.binary-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.binary-row:last-child {
  margin-bottom: 0;
}

.label {
  width: 100px;
  font-weight: 600;
  color: #4a5568;
}

.binary-number {
  font-family: "Courier New", monospace;
  font-size: 1.2rem;
  font-weight: bold;
  letter-spacing: 2px;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: white;
  border: 1px solid #e2e8f0;
  min-width: 100px;
  text-align: center;
}

.highlight-invert {
  background: #fed7d7;
  border-color: #fc8181;
  animation: pulse 2s infinite;
}

.highlight-result {
  background: #c6f6d5;
  border-color: #68d391;
  animation: pulse 2s infinite;
}

.result-row {
  border-top: 2px solid #e2e8f0;
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.carry-row {
  font-size: 0.9rem;
  color: #718096;
}

.carry-display {
  font-family: "Courier New", monospace;
  letter-spacing: 2px;
  color: #e53e3e;
}

.explanation {
  margin-left: 1rem;
  font-size: 0.9rem;
  color: #718096;
  font-style: italic;
}

/* Enhanced decimal display styling */
.decimal-display {
  margin-left: 1rem;
  padding: 0.25rem 0.5rem;
  background: #edf2f7;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #4a5568;
  font-weight: 500;
}

/* Final Result */
.final-result {
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, #c6f6d5 0%, #9ae6b4 100%);
  border-radius: 12px;
  margin-top: 1rem;
}

.final-result p {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.result-explanation {
  font-size: 1rem;
  color: #2d3748;
}

/* Navigation */
.navigation-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  text-align: center;
}

.nav-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.nav-btn {
  background: #f7fafc;
  color: #4a5568;
  border: 2px solid #e2e8f0;
}

.nav-btn:hover:not(:disabled) {
  background: #edf2f7;
  border-color: #cbd5e0;
  transform: translateY(-1px);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  width: 0%;
  transition: width 0.5s ease;
}

/* Bit flipping animation styles */
.bit-flip-container {
  display: flex;
  gap: 2px;
  font-family: "Courier New", monospace;
  font-size: 1.2rem;
  font-weight: bold;
}

.bit-flip {
  display: inline-block;
  padding: 0.25rem 0.4rem;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.bit-flip:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
  transform: scale(1.1);
}

.bit-flip.flipping {
  animation: bitFlip 0.6s ease-in-out;
  background: #fed7d7;
  border-color: #fc8181;
}

.bit-flip.flipped {
  background: #c6f6d5;
  border-color: #68d391;
}

@keyframes bitFlip {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(90deg) scale(1.2);
  }
  100% {
    transform: rotateY(0deg);
  }
}

/* Addition animation styles */
.addition-animation {
  margin: 1rem 0;
  padding: 1rem;
  background: linear-gradient(135deg, #e6fffa 0%, #b2f5ea 100%);
  border-radius: 8px;
  border-left: 4px solid #38b2ac;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s ease;
}

.addition-animation.show {
  opacity: 1;
  transform: translateY(0);
}

.addition-step {
  font-weight: 600;
  color: #2c7a7b;
  text-align: center;
  animation: pulse 2s infinite;
}

/* Enhanced carry animation */
.carry-animation {
  margin: 1rem 0;
  padding: 1rem;
  background: #fef5e7;
  border-radius: 8px;
  border-left: 4px solid #ed8936;
}

.animated-carry {
  font-family: "Courier New", monospace;
  letter-spacing: 2px;
  color: #e53e3e;
  font-weight: bold;
}

.carry-bit {
  display: inline-block;
  animation: carryBounce 0.8s ease-in-out;
  margin: 0 1px;
}

@keyframes carryBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
    color: #38a169;
  }
}

/* Step-by-step addition visualization */
.addition-steps {
  margin-top: 1rem;
  padding: 1rem;
  background: #f0fff4;
  border-radius: 8px;
  border-left: 4px solid #48bb78;
}

.step-by-step-title {
  font-weight: 600;
  color: #2f855a;
  margin-bottom: 1rem;
  text-align: center;
}

.addition-columns {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.addition-column {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Courier New", monospace;
  min-width: 80px;
}

.addition-column:hover {
  border-color: #48bb78;
  background: #f0fff4;
  transform: translateY(-2px);
}

.addition-column.active {
  background: #c6f6d5;
  border-color: #38a169;
  animation: pulse 1s ease-in-out;
}

.column-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 0.5rem;
}

.column-values {
  font-size: 1rem;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: #2d3748;
}

.column-result {
  font-size: 0.9rem;
  font-weight: 600;
  color: #38a169;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.5rem;
}

/* Conversion table styles for binary breakdown */
.conversion-table {
  background: #f7fafc;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}

.binary-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 1rem;
  background: white;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.bit-position {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  background: #f0fff4;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-weight: 600;
}

.bit {
  background: #667eea;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: bold;
}

/* Celebration animation styles */
.celebration-container {
  position: relative;
  height: 60px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.celebration-particle {
  position: absolute;
  font-size: 1.5rem;
  animation: celebrate 2s ease-out forwards;
  pointer-events: none;
}

@keyframes celebrate {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) rotate(360deg) scale(0.5);
  }
}

/* Result verification styles */
.result-verification {
  margin-top: 1.5rem;
  text-align: center;
}

.verify-btn {
  background: linear-gradient(135deg, #805ad5 0%, #6b46c1 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.verify-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(128, 90, 213, 0.3);
}

.verification-details {
  margin-top: 1rem;
  padding: 1rem;
  background: #f7fafc;
  border-radius: 8px;
  border-left: 4px solid #805ad5;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s ease;
}

.verification-details.show {
  opacity: 1;
  transform: translateY(0);
}

/* Speed control styling */
.speed-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.speed-control label {
  font-size: 0.9rem;
  color: #4a5568;
  font-weight: 500;
}

.speed-select {
  padding: 0.5rem;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.speed-select:focus {
  outline: none;
  border-color: #667eea;
}

/* Progress indicators styling */
.progress-indicators {
  position: absolute;
  top: -15px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
}

.progress-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #718096;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
  transition: all 0.3s ease;
  cursor: pointer;
}

.progress-dot.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transform: scale(1.2);
}

.progress-dot.completed {
  background: #48bb78;
  color: white;
}

/* Animations */
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

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

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.8);
  }
}

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

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.step-card.animate {
  animation: slideIn 0.5s ease;
}

.animate-slide-left {
  animation: slideInFromLeft 0.6s ease-out;
}

.animate-slide-right {
  animation: slideInFromRight 0.6s ease-out;
}

.animate-bounce {
  animation: bounceIn 0.8s ease-out;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

/* Footer */
.main-footer {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 2rem;
  text-align: center;
  margin-top: 2rem;
}

.tips-section {
  margin-bottom: 2rem;
}

.tips-section h3 {
  color: #4a5568;
  margin-bottom: 1rem;
}

.tips-section ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  text-align: left;
  max-width: 800px;
  margin: 0 auto;
}

.tips-section li {
  background: #f7fafc;
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

/* Navigation Styles for Comprehensive Learning Platform */
.main-nav {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(15px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand h1 {
  font-size: 1.8rem;
  color: #4a5568;
  margin: 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.nav-brand p {
  font-size: 0.9rem;
  color: #718096;
  margin: 0;
}

.nav-menu {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
}

.menu-category {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.menu-category h3 {
  font-size: 1rem;
  color: #4a5568;
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid #e2e8f0;
}

.nav-item {
  background: none;
  border: none;
  color: #718096;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  white-space: nowrap;
}

.nav-item:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transform: translateX(5px);
}

.nav-item.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #4a5568;
  cursor: pointer;
  padding: 0.5rem;
}

/* Welcome Screen Styles */
.welcome-screen {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.welcome-container {
  max-width: 1200px;
  width: 100%;
  text-align: center;
}

.welcome-header {
  margin-bottom: 4rem;
}

.welcome-header h1 {
  font-size: 3rem;
  color: white;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-header p {
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  margin: 0 auto;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.feature-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 2.5rem;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  animation: slideInUp 0.6s ease-out;
}

.feature-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.feature-card:hover .feature-icon {
  animation: bounce 1s ease-in-out;
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.feature-card h3 {
  color: #4a5568;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.feature-card p {
  color: #718096;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.feature-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.feature-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.quick-start {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 3rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.quick-start h3 {
  color: #4a5568;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.quick-start p {
  color: #718096;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.large-btn {
  font-size: 1.2rem;
  padding: 1rem 2rem;
  border-radius: 12px;
}

/* Module Container Styles */
.module-container {
  min-height: calc(100vh - 120px);
  padding: 2rem;
}

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 1.5rem 2rem;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  flex-direction: column;
  gap: 1rem;
  text-align: center;
}

.back-btn {
  background: #f7fafc;
  color: #4a5568;
  border: 2px solid #e2e8f0;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  align-self: flex-start;
}

.back-btn:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
  transform: translateX(-5px);
}

.module-title {
  color: #4a5568;
  font-size: 1.8rem;
  margin: 0;
}

.module-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: #718096;
  font-size: 0.9rem;
}

.module-content {
  animation: fadeIn 0.5s ease-in-out;
}

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

/* Enhanced styles for BCD and 1's complement modules */

/* Interactive digit conversion styles */
.interactive-digit {
  margin: 0.5rem;
}

.digit-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: all 0.3s ease;
  min-width: 120px;
}

.digit-card.converting {
  border-color: #f6ad55;
  background: #fffaf0;
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(246, 173, 85, 0.3);
}

.digit-card.completed {
  border-color: #48bb78;
  background: #f0fff4;
}

.decimal-digit {
  font-size: 2rem;
  font-weight: bold;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.conversion-arrow {
  font-size: 1.5rem;
  color: #718096;
  margin: 0.5rem 0;
}

.bcd-result {
  font-family: "Courier New", monospace;
  font-size: 1.2rem;
  font-weight: bold;
  color: #38a169;
  margin-bottom: 0.5rem;
  min-height: 1.5rem;
}

.bit-breakdown {
  display: flex;
  gap: 2px;
  justify-content: center;
  margin-top: 0.5rem;
}

.bit {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  font-weight: bold;
  text-align: center;
  transition: all 0.3s ease;
}

.bit.bit-reveal {
  background: #c6f6d5;
  border-color: #38a169;
  animation: bitReveal 0.5s ease;
}

@keyframes bitReveal {
  0% {
    transform: scale(0.5) rotate(180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(90deg);
    opacity: 0.7;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Digit conversion container */
.digit-conversion-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.conversion-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* BCD Arithmetic styles */
.operation-selector {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.operation-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.operation-btn {
  background: #f7fafc;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #4a5568;
}

.operation-btn:hover {
  border-color: #cbd5e0;
  background: #edf2f7;
  transform: translateY(-2px);
}

.operation-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Arithmetic display styles */
.arithmetic-display {
  background: #f7fafc;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem 0;
}

.operands {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.operand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.operator,
.equals {
  font-size: 2rem;
  font-weight: bold;
  color: #4a5568;
}

.bcd-value {
  font-family: "Courier New", monospace;
  font-size: 1.2rem;
  font-weight: bold;
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 2px solid #e2e8f0;
}

.decimal-equiv {
  font-size: 0.9rem;
  color: #718096;
  font-style: italic;
}

/* Detailed steps grid */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.step-item {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.step-item.needs-correction {
  border-color: #f6ad55;
  background: #fffaf0;
}

.step-header {
  font-weight: bold;
  color: #4a5568;
  margin-bottom: 0.5rem;
}

.step-calc {
  font-family: "Courier New", monospace;
  font-size: 1rem;
  color: #2d3748;
}

.correction-note {
  background: #e6fffa;
  border: 2px solid #38b2ac;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  text-align: center;
}

/* 1's Complement specific styles */
.complement-display {
  background: #f7fafc;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem 0;
  text-align: center;
}

.original-number,
.complement-number {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.flip-arrow {
  font-size: 1.2rem;
  font-weight: bold;
  color: #667eea;
  margin: 1rem 0;
  animation: pulse 2s infinite;
}

.binary-value {
  font-family: "Courier New", monospace;
  font-size: 1.3rem;
  font-weight: bold;
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 2px solid #e2e8f0;
  letter-spacing: 2px;
}

.binary-value.highlight-result {
  border-color: #48bb78;
  background: #f0fff4;
  color: #38a169;
}

.binary-value.highlight-binary {
  border-color: #667eea;
  background: #f0f4ff;
  color: #5a67d8;
}

/* Bit flip demonstration */
.flip-demonstration {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin: 1rem 0;
}

.bit-flip-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.original-bit,
.flipped-bit {
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 1.1rem;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 4px;
}

.original-bit {
  background: #fed7d7;
  color: #c53030;
}

.flipped-bit {
  background: #c6f6d5;
  color: #38a169;
}

.arrow {
  color: #718096;
  font-weight: bold;
}

/* Interactive bit flip demo */
.flip-demo-container {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem 0;
  border: 2px solid #e2e8f0;
}

.demo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.demo-label {
  font-weight: bold;
  color: #4a5568;
  min-width: 120px;
  text-align: right;
}

.demo-bits {
  display: flex;
  gap: 4px;
}

.demo-bit {
  display: inline-block;
  width: 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 1.1rem;
  border-radius: 6px;
  border: 2px solid #e2e8f0;
  background: white;
  transition: all 0.4s ease;
  cursor: pointer;
}

.demo-bit:hover {
  transform: scale(1.1);
  border-color: #cbd5e0;
}

.demo-bit.flipping {
  animation: bitFlip 0.6s ease-in-out;
  background: #fed7d7;
  border-color: #fc8181;
}

.demo-bit.flipped {
  background: #c6f6d5;
  border-color: #68d391;
}

.original-bits .demo-bit {
  background: #e6fffa;
  border-color: #38b2ac;
  color: #2c7a7b;
}

.complement-bits .demo-bit {
  background: #f0fff4;
  border-color: #48bb78;
  color: #38a169;
}

/* Calculation steps for 1's complement */
.calculation-steps {
  margin-top: 1.5rem;
}

.step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  background: white;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.step.final-step {
  border-color: #48bb78;
  background: #f0fff4;
  font-weight: bold;
}

.carry-value {
  font-family: "Courier New", monospace;
  font-weight: bold;
  color: #e53e3e;
}

/* Success message styles */
.success-message {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 8px 25px rgba(72, 187, 120, 0.3);
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.5s ease;
}

.success-message.show {
  opacity: 1;
  transform: translateX(0);
}

/* Comparison grid for BCD info */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 1rem 0;
}

.comparison-item {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  border: 2px solid #e2e8f0;
}

.comparison-item h5 {
  color: #4a5568;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.comparison-item ul {
  list-style: none;
  padding: 0;
}

.comparison-item li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f7fafc;
  color: #2d3748;
}

.comparison-item li:last-child {
  border-bottom: none;
}

.comparison-item li::before {
  content: "✓ ";
  color: #48bb78;
  font-weight: bold;
  margin-right: 0.5rem;
}

/* Result comparison styling */
.result-comparison {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  border: 2px solid #e2e8f0;
}

.result-comparison p {
  margin: 0.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Info sections */
.bcd-info,
.ones-complement-info {
  background: #f0f4ff;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  border-left: 4px solid #667eea;
}

.bcd-info h4,
.ones-complement-info h5 {
  color: #4c51bf;
  margin-bottom: 1rem;
}

.bcd-info ul,
.ones-complement-info ul {
  list-style: none;
  padding: 0;
}

.bcd-info li,
.ones-complement-info li {
  padding: 0.5rem 0;
  color: #2d3748;
  border-bottom: 1px solid #e6f3ff;
}

.bcd-info li:last-child,
.ones-complement-info li:last-child {
  border-bottom: none;
}

/* Enhanced responsive design */
@media (max-width: 768px) {
  .digit-conversion-container {
    flex-direction: column;
    align-items: center;
  }

  .operation-buttons {
    flex-direction: column;
    align-items: center;
  }

  .operands {
    flex-direction: column;
    gap: 0.5rem;
  }

  .demo-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .demo-label {
    text-align: center;
    min-width: auto;
  }

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

  .success-message {
    position: relative;
    top: auto;
    right: auto;
    margin: 1rem 0;
    transform: none;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    flex-direction: column;
    gap: 2rem;
  }

  .nav-menu.active {
    display: flex;
  }

  .menu-toggle {
    display: block;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #4a5568;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
  }

  .menu-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
  }

  .menu-category {
    align-items: center;
    text-align: center;
  }

  .nav-item {
    width: 100%;
    text-align: center;
    padding: 1rem;
    font-size: 1rem;
  }

  .nav-container {
    padding: 1rem;
  }

  .nav-brand h1 {
    font-size: 1.4rem;
  }

  .welcome-header h1 {
    font-size: 2rem;
  }

  .feature-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 1024px) {
  .nav-menu {
    gap: 2rem;
  }

  .menu-category h3 {
    font-size: 0.9rem;
  }

  .nav-item {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}

@media (max-width: 480px) {
  .nav-container {
    padding: 0.5rem;
  }

  .nav-brand h1 {
    font-size: 1.4rem;
  }

  .nav-brand p {
    font-size: 0.8rem;
  }

  .welcome-header h1 {
    font-size: 1.8rem;
  }

  .feature-card {
    padding: 1.5rem;
  }

  .quick-start {
    padding: 1.5rem;
  }
}

.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: loading 1.5s infinite;
}

.error-state {
  background: #fed7d7;
  border: 2px solid #fc8181;
  color: #c53030;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  animation: pulse 0.5s ease-in-out;
}

.success-state {
  background: #c6f6d5;
  border: 2px solid #68d391;
  color: #2f855a;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  animation: slideInUp 0.5s ease-out;
}
