* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --cosmic-purple: #2d1b4e;
  --cosmic-pink: #e91e8c;
  --cosmic-cyan: #00d4ff;
  --cosmic-blue: #4a90d9;
  --cosmic-dark: #0a0a1a;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--cosmic-dark);
  color: white;
  min-height: 100vh;
  line-height: 1.6;
}

/* Background */
.background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  background-image: url('background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.background-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: -1;
}

/* Header - Combined Banner and Navigation */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 0.75rem 2rem;
  background: linear-gradient(90deg, #7b2d8e, #4a90d9, #2d8e8e);
  z-index: 1001;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
}

.header-brand {
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.header-nav {
  display: flex;
  gap: 2rem;
}

.header-nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.3s ease;
}

.header-nav a:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 5rem 2rem 4rem;
}

/* Name Box - Rounded card style */
.name-box {
  position: fixed;
  top: 80px;
  left: 20px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1.25rem;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: white;
  font-family: 'Times New Roman', Times, serif;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  z-index: 100;
  text-decoration: none;
  cursor: pointer;
}

/* Code View Buttons */
.code-view-buttons {
  position: fixed;
  top: 145px;
  left: 20px;
  display: flex;
  gap: 0.4rem;
  z-index: 100;
}

.code-view-btn {
  background: linear-gradient(135deg, var(--cosmic-purple), var(--cosmic-pink));
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.code-view-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(233, 30, 140, 0.4);
}

.hero-badge {
  background: rgba(45, 27, 78, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.75rem 2rem;
  border-radius: 2rem;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(10px);
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--cosmic-purple), var(--cosmic-pink), var(--cosmic-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(233, 30, 140, 0.3);
}

.hero h2 {
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.hero p {
  max-width: 600px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.hero-quote {
  font-style: italic;
  color: var(--cosmic-cyan);
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

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

.btn {
  padding: 0.875rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  font-size: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cosmic-purple), var(--cosmic-pink));
  color: white;
  box-shadow: 0 4px 15px rgba(233, 30, 140, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 30, 140, 0.4);
}

.btn-secondary {
  background: transparent;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--cosmic-cyan);
}

/* Section Styles */
section {
  padding: 5rem 2rem;
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--cosmic-cyan), var(--cosmic-blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section-subtitle {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 3rem;
  font-size: 1.1rem;
}

/* About Section */
.about {
  background: rgba(10, 10, 26, 0.7);
  backdrop-filter: blur(10px);
}

.about-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.about-content p {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.8;
}

/* Portfolio Grid */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

.topic-card {
  background: rgba(45, 27, 78, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 1.5rem;
  transition: all 0.3s ease;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.topic-card:hover {
  transform: translateY(-5px);
  border-color: var(--cosmic-pink);
  box-shadow: 0 10px 30px rgba(233, 30, 140, 0.2);
}

.topic-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.topic-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: white;
}

.topic-card p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
}

.topic-card a {
  display: inline-block;
  margin-top: 1rem;
  color: var(--cosmic-cyan);
  text-decoration: none;
  font-weight: 500;
}

.topic-card a:hover {
  text-decoration: underline;
}

/* Topic Detail Sections */
.topic-detail {
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.topic-detail:nth-child(even) {
  background: rgba(45, 27, 78, 0.4);
}

.topic-content {
  max-width: 900px;
  margin: 0 auto;
}

.topic-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.topic-header-icon {
  font-size: 3rem;
}

.topic-header h2 {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--cosmic-pink), var(--cosmic-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topic-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
  border-left: 4px solid var(--cosmic-pink);
}

.topic-section h3 {
  color: var(--cosmic-cyan);
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.topic-section p {
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.8;
}

/* Flow Diagram */
.flow-diagram {
  margin: 1.5rem 0 2rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0.75rem;
  border-left: 4px solid var(--cosmic-pink);
}

.flow-diagram img {
  width: 100%;
  height: auto;
  display: block;
}

/* Side-by-Side Code Comparison */
.code-comparison {
  display: flex;
  gap: 1.5rem;
  margin: 1.5rem 0 2rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0.75rem;
  border-left: 4px solid var(--cosmic-pink);
}

.code-comparison .code-side,
.code-comparison .output-side {
  flex: 1;
  min-width: 0;
}

.code-comparison h4 {
  text-align: center;
  color: var(--cosmic-purple);
  margin-bottom: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.code-comparison img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .code-comparison {
    flex-direction: column;
  }
}

/* Button Group */
.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Define Button */
.define-btn {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--cosmic-purple), var(--cosmic-pink));
  color: white;
  border: none;
  border-radius: 2rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(233, 30, 140, 0.3);
}

.define-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 30, 140, 0.4);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
}

.modal.active {
  display: block;
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 900px;
  width: 90%;
  max-height: 85vh;
  background: white;
  border-radius: 1rem;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 85vh;
  object-fit: contain;
  background: white;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  color: #333;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: var(--cosmic-pink);
  color: white;
}

/* Text-based Modal Content */
.modal-text-content {
  max-width: 700px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: white !important;
}

.modal-body {
  padding: 2rem;
  color: #333;
}

.modal-body h2 {
  color: var(--cosmic-purple);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
  border-bottom: 2px solid var(--cosmic-pink);
  padding-bottom: 0.75rem;
}

.modal-body h3 {
  color: var(--cosmic-pink);
  font-size: 1.2rem;
  margin: 1.5rem 0 0.75rem;
}

.modal-body p {
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

/* Code Block Styling */
.code-block {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1.5rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 1rem 0;
  border-left: 4px solid var(--cosmic-pink);
}

.code-block code {
  color: #d4d4d4;
  white-space: pre;
}

.conversion-steps {
  background: #f5f5f5;
  padding: 1rem;
  border-radius: 0.5rem;
  margin: 0.75rem 0;
  font-family: monospace;
}

.conversion-steps p {
  margin: 0.25rem 0;
}

.conversion-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.conversion-table th,
.conversion-table td {
  border: 1px solid #ddd;
  padding: 0.75rem;
  text-align: center;
}

.conversion-table th {
  background: linear-gradient(135deg, var(--cosmic-purple), var(--cosmic-pink));
  color: white;
}

.conversion-table td {
  background: #f9f9f9;
}

.modal-body .conclusion {
  margin-top: 1.5rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(45, 27, 78, 0.1), rgba(233, 30, 140, 0.1));
  border-radius: 0.5rem;
  font-style: italic;
}

/* Topic section with image */
.topic-section.with-image {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.section-image {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
}

.section-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.section-text {
  flex: 1;
}

.section-text h3 {
  color: var(--cosmic-cyan);
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.section-text p {
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.8;
}

/* FAQ Section */
.faq-section {
  margin: 2rem 0;
}

.faq-item {
  margin-bottom: 0.75rem;
  border-radius: 0.5rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.faq-question {
  width: 100%;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: none;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.3s ease;
}

.faq-question:hover {
  background: rgba(255, 255, 255, 0.05);
}

.faq-question span:first-child {
  flex: 1;
  padding-right: 1rem;
}

.faq-icon {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--cosmic-cyan);
  transition: transform 0.3s ease;
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, 0.2);
}

.faq-answer p {
  padding: 1rem 1.25rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.7;
  margin: 0;
}

.faq-answer p + p {
  padding-top: 0.5rem;
}

.faq-item.active .faq-question {
  background: rgba(255, 255, 255, 0.05);
}

/* Infographic Section */
.infographic-section {
  margin: 2.5rem 0;
  padding: 1.5rem 2rem;
  background: rgba(200, 200, 200, 0.15);
  border-radius: 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.infographic-section h3 {
  color: white;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.infographic-section > .infographic-text {
  flex: 1;
}

.infographic-section .infographic-text p {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.infographic-thumbnail {
  width: 80px;
  height: 80px;
  border-radius: 0.5rem;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  background: white;
}

.infographic-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--cosmic-purple), var(--cosmic-pink));
  color: white;
  border-radius: 2rem;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(233, 30, 140, 0.3);
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 30, 140, 0.4);
}

.download-icon {
  font-size: 1.25rem;
}

/* Contact Section */
.contact {
  background: rgba(45, 27, 78, 0.6);
  text-align: center;
}

.contact-info {
  max-width: 600px;
  margin: 0 auto;
}

.contact-info p {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1.5rem;
}

.contact-details {
  background: rgba(255, 255, 255, 0.1);
  padding: 1.5rem;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  border-left: 4px solid var(--cosmic-pink);
}

.contact-details p {
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.contact-details p:last-child {
  margin-bottom: 0;
}

.contact-details strong {
  color: var(--cosmic-cyan);
}

/* Footer */
footer {
  background: rgba(10, 10, 26, 0.95);
  padding: 2rem;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
  color: rgba(255, 255, 255, 0.6);
}

.footer-brand {
  background: linear-gradient(135deg, var(--cosmic-purple), var(--cosmic-pink), var(--cosmic-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: bold;
}

/* Back to Top */
.back-to-top {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  color: var(--cosmic-cyan);
  text-decoration: none;
  transition: all 0.3s ease;
}

.back-to-top:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
  .top-header {
    padding: 0.5rem 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .header-brand {
    font-size: 1rem;
  }

  .code-view-buttons {
    top: 115px;
    left: 10px;
  }

  .code-view-btn {
    font-size: 0.6rem;
    padding: 0.2rem 0.4rem;
  }

  .header-nav {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .header-nav a {
    font-size: 0.85rem;
  }

  .name-box {
    font-size: 0.9rem;
    padding: 0.4rem 1rem;
    letter-spacing: 1px;
    top: 70px;
    left: 10px;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero h2 {
    font-size: 1.25rem;
  }

  .section-title {
    font-size: 2rem;
  }

  .topic-header h2 {
    font-size: 1.5rem;
  }

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

@media (max-width: 480px) {
  .name-box {
    font-size: 1rem;
    padding: 0.4rem 1rem;
    letter-spacing: 1px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
    padding: 0 1rem;
  }

  .btn {
    width: 100%;
    text-align: center;
  }
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeInUp 0.6s ease-out forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--cosmic-dark);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--cosmic-purple), var(--cosmic-pink));
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--cosmic-pink), var(--cosmic-cyan));
}
