*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f0f4f8;
  --text: #1a1a1a;
  --accent: #7f5af0;
  --card-bg: #fff;
  --shadow: rgba(127, 90, 240, 0.2)
}

html {
  scroll-behavior: smooth;
}

body.dark-mode {
  --bg: #1a1a2e;
  --text: #eaeaea;
  --card-bg: #2a2a40;
  --shadow: rgba(127, 90, 240, 0.3)
}

html,
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 100%;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
  line-height: 1.6;
}

header {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1000;
  height: 60px;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
  padding: 0 1rem;
  position: relative;
}

.nav-list {
  list-style: none;
  display: flex;
  gap: 1.8rem;
  align-items: center;
}

.nav-list li a,
.nav-list li button {
  text-decoration: none;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  font-size: .95rem;
  font-weight: 500;
  transition: color .3s
}

.nav-list li a:hover,
.nav-list li button:hover {
  color: var(--accent)
}

.nav-close {
  display: none;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#theme-toggle {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text);
  cursor: pointer;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 5px;
}

.menu-toggle span {
  width: 25px;
  height: 3px;
  background: var(--text);
  border-radius: 2px;
}

.menu-toggle.active {
  transform: translateX(160px);
}

.menu-toggle:hover span {
  background: var(--accent);
}

body.dark-mode .menu-toggle span {
  background: #eaeaea;
}


.about-section {
  text-align: center;
  padding: 4rem 2rem
}

.about-section h1 span {
  color: var(--accent);
  font-weight: 800;
  animation: 1.2s ease-in-out infinite alternate;
}

.about-section h2 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
  color: var(--accent);
  animation: slideInTop .8s ease forwards
}

.about-section p {
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 1.5rem;
  line-height: 1.8;
  animation: fadeIn 1.2s ease forwards
}

.about-section .btn {
  animation: popIn 1.5s ease forwards
}

@keyframes slideInTop {
  from {
    transform: translateY(-50px);
    opacity: 0
  }

  to {
    transform: translateY(0);
    opacity: 1
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes popIn {
  0% {
    transform: scale(.5);
    opacity: 0
  }

  100% {
    transform: scale(1);
    opacity: 1
  }
}

.about-card {
  background: var(--card-bg);
  padding: 2.5rem 2rem;
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  max-width: 800px;
  margin: auto;
  position: relative;
  overflow: hidden;
  will-change: transform;
}

.about-card:hover {
  box-shadow: 0 35px 80px rgba(0, 0, 0, 0.3);
}

.about-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1), transparent 60%);
  transform: rotate(30deg);
  animation: lightSweep 6s infinite linear;
  pointer-events: none;
  z-index: 0;
}

@keyframes lightSweep {
  0% {
    transform: rotate(30deg) translateX(-100%);
  }

  100% {
    transform: rotate(30deg) translateX(100%);
  }
}

.about-card>* {
  position: relative;
  z-index: 2;
}


body.dark-mode .about-card {
  background-color: #2a2a40;
  box-shadow: 0 20px 50px rgba(255, 255, 255, 0.05);
}


body.dark-mode {
  background-color: #121212;
  color: #fff
}

body.dark-mode a {
  color: #90caf9
}

body.dark-mode .navbar,
.body.dark-mode .nav-list {
  background-color: #1e1e1e
}

body.dark-mode .btn {
  background-color: #333;
  color: #fff
}

body.dark-mode input,
body.dark-mode textarea {
  background-color: #2a2a2a;
  color: #fff;
  border: 1px solid #555
}

section {
  padding: 4rem 2rem;
  max-width: 1000px;
  margin: auto
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.3rem;
  margin: 0.5rem 0.3rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  text-decoration: none;
  text-align: center;
  transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 14px rgba(127, 90, 240, 0.3);
}

.btn:hover {
  background-color: #6842d6;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 20px rgba(127, 90, 240, 0.4);
}

body.dark-mode .btn {
  background: #7f5af0;
  color: #fff;
}

body.dark-mode .btn:hover {
  background: #6842d6;
  box-shadow: 0 6px 20px rgba(127, 90, 240, 0.6);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  padding: 2rem 0
}

.project-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
  transition: transform .3s ease, box-shadow .3s ease;
  text-align: center
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, .25)
}

.project-card img {
  max-width: 100%;
  border-radius: 10px;
  margin-bottom: 1rem;
  height: auto;
  object-fit: cover
}

.project-card h3 {
  color: var(--accent);
  margin-bottom: .5rem
}

.project-card p {
  margin-bottom: 1rem
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  padding: 2rem
}

.skill-category {
  background: #fcfafa;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
  transition: transform .3s ease
}

.skill-bar {
  margin-bottom: 1rem
}

.skill-bar span {
  font-weight: 600;
  display: block;
  margin-bottom: .3rem
}

.skill-bar .bar-bg {
  background-color: #eee;
  border-radius: 20px;
  height: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, .1)
}

.skill-bar .bar-fill {
  background: linear-gradient(to right, #00f2fe, #4facfe);
  /* bright gradient */
  width: 0;
  height: 100%;
  transition: width 1.6s ease-in-out;
  border-radius: 20px;
  position: relative;
}

.skill-bar .bar-percent {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #fff;
  font-weight: 600;
}

.skill-category:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, .25)
}


body.dark-mode .skill-category {
  background-color: #2a2a40;
  color: #eaeaea;
  box-shadow: 0 4px 10px rgba(255, 255, 255, .05)
}

body.dark-mode .skill-bar .bar-bg {
  background-color: #444;
  box-shadow: inset 0 0 6px rgba(255, 255, 255, .1)
}

body.dark-mode .skill-bar .bar-percent {
  color: #ccc
}

body.dark-mode .skill-bar .bar-fill {
  background: linear-gradient(to right, #00c9d9, #4fa0fe);
}


#contact {
  text-align: center;
  padding: 4rem 1rem;
  animation: fadeIn 1s ease forwards
}

.contact-container {
  max-width: 600px;
  margin: 0 auto
}

#contact h2 {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 1.5rem
}

.contact-container form input,
.contact-container form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: .7rem;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .05);
  resize: vertical
}

.contact-container form button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .75rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-top: .5rem
}

.contact-container form button:hover {
  background: #6842d6
}

form input::placeholder,
form textarea::placeholder {
  color: #888
}

body.dark-mode form input::placeholder,
body.dark-mode form textarea::placeholder {
  color: #ccc
}

.socials {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem
}

.socials img {
  width: 30px;
  height: 30px;
  transition: transform .3s ease
}

.socials img:hover {
  transform: scale(1.2)
}

footer,
.footer {
  text-align: center;
  padding: 1rem 0;
  background: var(--card-bg);
  font-size: .9rem
}

.footer p {
  margin: 0;
  color: var(--text)
}

body.dark-mode footer {
  background-color: #1c1b1b;
  color: #ccc
}

#chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  margin-left: auto;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 24px;
  padding: 10px;
  border-radius: 50%;
  box-shadow: 0 4px 10px var(--shadow);
  cursor: pointer;
  z-index: 1001;
}

#chatbox {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 300px;
  height: 400px;
  border: 1px solid #ccc;
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, .2);
  border-radius: 10px;
  overflow: hidden;
  z-index: 1000
}

body.dark-mode #chatbox {
  background-color: #222;
  color: #f0f0f0;
  border-color: #444
}

.chat-header {
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  position: relative
}

body.dark-mode .chat-header {
  background: #333
}

.chat-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  position: absolute;
  right: 10px;
  top: 10px
}

.chat-body {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background-color: var(--card-bg);
  color: var(--text)
}

.chat-input-wrapper {
  display: flex;
  padding: 10px;
  gap: 5px;
  border-top: 1px solid #ccc
}

#chat-input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 5px
}

.chat-input-wrapper button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer
}

.chat-input-wrapper button:hover {
  background: #6842d6
}

.chat-toggle-btn {
  display: inline-block;
  padding: 8px 16px;
  margin-top: 8px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.3s, color 0.3s;
}

.chat-toggle-btn.dark {
  background-color: #444;
  color: #fff;
}

.chat-toggle-btn.light {
  background-color: #f0f0f0;
  color: #000;
}

#chat-close {
  background: transparent;
  color: var(--chat-header-text);
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s;
}

#chat-close:hover {
  transform: rotate(90deg);
}


.typing-dots {
  display: inline-block;
}

.typing-dots span {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin: 0 2px;
  background-color: currentColor;
  border-radius: 50%;
  animation: wave 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes wave {

  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  40% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 768px) {

  #theme-toggle {
    margin-left: 1rem;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text);
  }

  .navbar {
    justify-content: space-between;
  }

  #theme-toggle {
    order: 3;
  }

  body.dark-mode #theme-toggle {
    color: #eaeaea;
  }


  section,
  .project-card,
  .skill-category,
  .contact-container,
  .about-section {
    max-width: 100%;
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    margin: 0 auto;
    box-sizing: border-box;
  }

  .projects-grid,
  .skills-grid {
    grid-template-columns: 1fr;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .menu-toggle {
    display: flex;
    margin-left: auto;
  }

  .nav-list {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    height: 100vh;
    background-color: #f4f1f1;
    flex-direction: column;
    align-items: flex-start;
    padding: 4rem 1.5rem;
    gap: 1.5rem;
    transition: right 0.3s ease;
    z-index: 1000;
  }

  .nav-list.active {
    right: 0;
  }

  .nav-list a,
  .nav-list button {
    width: auto;
    font-size: 1rem;
    padding: 0.4rem 0.8rem;
  }

  #nav-close {
    display: block;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text);
    cursor: pointer;
    z-index: 1001;
  }

  #nav-close:hover {
    color: var(--accent);
  }

  body.dark-mode #nav-close {
    color: #eaeaea;
  }

  body.dark-mode .nav-list {
    background-color: #1e1e1e;
  }

  body.dark-mode .nav-list a,
  body.dark-mode .nav-list button {
    color: #eaeaea;
  }

  body.dark-mode #nav-close {
    color: #eaeaea;
  }

  body.dark-mode .nav-list a:hover,
  body.dark-mode .nav-list button:hover {
    color: var(--accent);
  }

  .contact-container form button,
  .btn.contact {
    width: 100%;
  }
}

.nav-left-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 768px) {
  #theme-toggle-mobile {
    display: block;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    margin-right: 0.5rem;
  }

  body.dark-mode #theme-toggle-mobile {
    color: #eaeaea;
  }

  #theme-toggle-desktop {
    display: none;
  }
}

@media (max-width: 768px) {
  .nav-list li a {
    display: contents;
    width: 100%;
    color: #141414;
    font-size: 1.3rem;
    font-weight: bold;
  }

  .nav-list.active li:nth-child(1) a {
    animation-delay: 0.1s;
  }

  .nav-list.active li:nth-child(2) a {
    animation-delay: 0.2s;
  }

  .nav-list.active li:nth-child(3) a {
    animation-delay: 0.3s;
  }

  .nav-list.active li:nth-child(4) a {
    animation-delay: 0.4s;
  }

  @keyframes slideFadeIn {
    from {
      opacity: 0;
      transform: translateY(30px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav-list li a:hover {
    background: linear-gradient(135deg, #6842d6, #5735c7);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  }

  .nav-list li a:active {
    transform: scale(0.95);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  }

  body.dark-mode .nav-list li a {
    background: linear-gradient(135deg, #2a2a40, #1e1e2e);
    color: #eaeaea;
    box-shadow: 0 5px 14px rgba(255, 255, 255, 0.05);
  }

  body.dark-mode .nav-list li a:hover {
    background: linear-gradient(135deg, #444, #333);
  }
}