/* ===== CSS Variables ===== */
:root {
  --bg: #0f172a;
  --surface: #111827;
  --text: #e5e7eb;
  --muted: #b1bdce;
  --primary: #38bdf8;
  --accent: #34d399;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --transition: all 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
  /* Support for dynamic viewport units */
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  /* Fallback for browsers that don't support dvh */
  min-height: 100dvh;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent);
}

/* ===== Container ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
}

/* ===== Navigation ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  z-index: 1000;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: var(--transition);
}

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

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
  z-index: 999;
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.hamburger-line {
  width: 25px;
  height: 3px;
  background: var(--text);
  border-radius: 3px;
  transition: var(--transition);
}

.hamburger.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-links a {
  color: var(--text);
  font-weight: 500;
  transition: var(--transition);
}

.nav-links a:hover {
  color: var(--primary);
}

/* Language Toggle */
.lang-toggle {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-toggle:hover {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.1);
}

.lang-icon {
  font-size: 1.2rem;
  line-height: 1;
}

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

.floating-line {
  position: absolute;
  width: 200px;
  height: 200px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  opacity: 0.3;
  pointer-events: none;
  transition: transform 0.2s ease-out;
}

.hero h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--muted);
  margin-bottom: 2rem;
  max-width: 600px;
  min-height: 2.5rem;
}

/* Typing Animation */
.typing-text {
  display: inline-block;
}

.cursor {
  display: inline-block;
  color: var(--primary);
  animation: blink 1s infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

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

/* ===== Buttons ===== */
.btn {
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-size: 1rem;
  display: inline-block;
}

.btn-primary {
  background: var(--primary);
  color: #0b1220;
}

.btn-primary:hover {
  background: var(--accent);
  color: #0b1220;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(56, 189, 248, 0.4);
}

.btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.1);
}

.btn-disabled {
  background: var(--muted);
  color: var(--bg);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-disabled:hover {
  background: var(--muted);
  transform: none;
  box-shadow: none;
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

/* ===== Section Styles ===== */
section {
  min-height: 100dvh;
  /* Fallback for browsers that don't support dvh */
  min-height: 100vh;

  padding: 5rem 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-x: hidden;
}

section h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 3rem;
  text-align: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== About Section ===== */
.about {
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface) 100%);
}

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

.about-text p {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  line-height: 1.8;
}

/* ===== Skills Section ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.skill-card {
  text-align: center;
}

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

.skill-card h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.skill-card ul {
  list-style: none;
  color: var(--muted);
}

.skill-card li {
  padding: 0.5rem 0;
}

/* ===== Projects Section ===== */
.projects {
  background: var(--bg);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.project-image {
  background: linear-gradient(135deg, #1e293b, #334155);
  padding: 0.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.placeholder-img {
  height: fit-content;
  display: flex;
  align-items: center;
}

.placeholder-img img {
  max-width: 100%;
  margin: auto;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.project-content {
  padding: 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-content h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.project-content p {
  color: var(--muted);
  margin-bottom: 1.5rem;
  flex: 1;
}

.project-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.tag {
  background: rgba(56, 189, 248, 0.1);
  color: var(--primary);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.project-links {
  display: flex;
  gap: 1rem;
}

/* ===== Contact Section ===== */
.contact {
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface) 100%);
}

.contact-intro {
  text-align: center;
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto 3rem;
}

.contact-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem;
}

.contact-form {
  padding: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-weight: 500;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.8rem;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.contact-info {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  gap: 2rem;
}

.contact-item h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
  text-align: center;
  padding: 1.25rem;
}

/* Success Message */
.success-message {
  display: none;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  border: 2px solid var(--accent);
}

.success-message.show {
  display: block;
  animation: slideIn 0.5s ease;
}

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

.success-content {
  max-width: 400px;
  margin: 0 auto;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 3rem;
  font-weight: bold;
  margin: 0 auto 1.5rem;
}

.success-message h3 {
  color: var(--accent);
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.success-message p {
  color: var(--muted);
  font-size: 1.1rem;
}

/* ===== Footer ===== */
.footer {
  background: var(--surface);
  padding: 2rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.social-links {
  display: flex;
  gap: 1.5rem;
}

.social-links a {
  color: var(--muted);
  transition: var(--transition);
}

.social-links a:hover {
  color: var(--primary);
}

/* ===== Loading Animation ===== */
.loader-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-wrapper.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader {
  display: flex;
  gap: 1rem;
}

.loader-circle {
  width: 15px;
  height: 15px;
  background: var(--primary);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.loader-circle:nth-child(1) {
  animation-delay: -0.32s;
}

.loader-circle:nth-child(2) {
  animation-delay: -0.16s;
  background: var(--accent);
}

.loader-circle:nth-child(3) {
  background: var(--muted);
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* ===== Scroll to Top Button ===== */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
  opacity: 0;
  visibility: hidden;
  z-index: 999;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  background: var(--accent);
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(56, 189, 248, 0.4);
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .hamburger {
    display: flex !important;
  }

  .lang-toggle {
    order: -1;
    /* margin-right: auto; */
    /* margin-left: 1rem; */
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    height: 100vh;
    width: 70%;
    max-width: 300px;
    background: rgba(17, 24, 39, 0.98);
    backdrop-filter: blur(10px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    transition: right 0.3s ease;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-links.active {
    right: 0;
    z-index: 1000;
  }

  .nav-links li {
    width: 100%;
    text-align: center;
  }

  .nav-links a {
    display: block;
    padding: 1rem;
    font-size: 1.2rem;
  }

  .cta {
    flex-direction: column;
    width: 100%;
  }

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

  /* Projects section needs special container handling */
  .projects .container {
    padding: 1rem;
    max-width: 100%;
  }

  .skills-grid {
    display: flex;
    justify-content: space-between;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    gap: 1.5rem;
    padding: 0 1rem 1.5rem 1rem;
    margin: 0 -2rem;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Hide scrollbar for Chrome/Safari */
  .skills-grid::-webkit-scrollbar {
    display: none;
  }

  div.skill-card.card {
    flex: 0 0 80%;
    max-width: 80%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  /* Carousel Dots */
  .carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
  }

  .carousel-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(148, 163, 184, 0.5);
  }

  .carousel-dots .dot.active {
    background: var(--primary);
    border-color: var(--primary);
    width: 24px;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  }

  .carousel-dots .dot:hover {
    background: rgba(56, 189, 248, 0.6);
    border-color: var(--primary);
  }

  /* Projects Carousel on Mobile */
  .projects-grid {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    gap: 1.5rem;
    margin: 0 -2rem;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Hide scrollbar for Chrome/Safari */
  .projects-grid::-webkit-scrollbar {
    display: none;
  }

  .project-card {
    flex: 0 0 80%;
    max-width: 80%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  .project-content {
    padding: 1rem;
  }
  .project-links {
    flex-direction: column;
  }

  /* Contact section mobile layout */
  .contact-content {
    grid-template-columns: 1fr;
    align-content: center;
    padding: 0;
  }

  .contact-info {
    flex-direction: column;
    gap: 1.5rem;
  }

  .footer .container {
    flex-direction: column;
    text-align: center;
  }

  .scroll-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }
}
