/* Google Fonts */
:root {
  --font-main: 'Poppins', 'Montserrat', Arial, sans-serif;
  --color-primary: #2563eb;
  --color-bg: #f8fafc;
  --color-bg-dark: #1e293b;
  --color-text: #22223b;
  --color-text-dark: #f8fafc;
  --color-accent: #64748b;
  --color-shadow: rgba(37, 99, 235, 0.08);
  --transition: 0.3s cubic-bezier(.4,0,.2,1);
  --navbar-height: 70px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  padding: 0;
  transition: background var(--transition), color var(--transition);
}

body.dark {
  background: var(--color-bg-dark);
  color: var(--color-text-dark);
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Preloader */
#preloader {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s;
}
.loader-logo {
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 2px;
  animation: pulse 1.2s infinite alternate;
}
@keyframes pulse {
  to { transform: scale(1.1); opacity: 0.7; }
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  background: #fff;
  box-shadow: 0 2px 8px var(--color-shadow);
  z-index: 1000;
  transition: background var(--transition);
}
body.dark .navbar {
  background: var(--color-bg-dark);
}
.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.logo {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 2px;
  margin-left: 1rem;
}
.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links li {
  position: relative;
}
.nav-links a {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
  font-size: 1.1rem;
  transition: color var(--transition);
  padding: 0.5rem 0;
}
body.dark .nav-links a {
  color: var(--color-text-dark);
}
.nav-links a.active,
.nav-links a:hover {
  color: var(--color-primary);
}
.nav-links a.active::after,
.nav-links a:hover::after {
  content: '';
  display: block;
  height: 3px;
  width: 100%;
  background: var(--color-primary);
  border-radius: 2px;
  position: absolute;
  left: 0; bottom: -6px;
  transition: width var(--transition);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--color-accent);
  transition: color var(--transition);
}
body.dark #theme-toggle {
  color: #fff;
}
.icon-moon::before {
  content: '🌙';
  font-size: 1.3rem;
}
body.dark .icon-moon::before {
  content: '☀️';
}
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  margin-right: 1rem;
}
.hamburger span {
  width: 25px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
  transition: all 0.3s;
}
body.dark .hamburger span {
  background: #fff;
}

/* Responsive Navbar */
@media (max-width: 900px) {
  .nav-links {
    position: fixed;
    top: var(--navbar-height);
    right: -100vw;
    width: 220px;
    height: calc(100vh - var(--navbar-height));
    background: #fff;
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem 1.5rem;
    gap: 1.5rem;
    box-shadow: -2px 0 8px var(--color-shadow);
    transition: right 0.4s;
    z-index: 999;
  }
  body.dark .nav-links {
    background: var(--color-bg-dark);
  }
  .nav-links.open {
    right: 0;
  }
  .hamburger {
    display: flex;
  }
  .nav-actions {
    flex-direction: row-reverse;
    justify-content: flex-end;
    width: 100%;
    gap: 0.5rem;
  }
  .navbar .nav-actions {
    margin-right: 1rem;
  }
  #theme-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1100;
  }
  .navbar .nav-actions {
    margin-right: 3.2rem; /* leave space for theme toggle */
  }
}

/* Back to Top */
#backToTop {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--color-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 1001;
}
#backToTop.show {
  opacity: 1;
  pointer-events: auto;
}

/* Hero Section */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: #e7f0fd;
  padding-top: var(--navbar-height);
  transition: background var(--transition);
}
body.dark .hero-section {
  background: #22304a;
}
.hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  flex-wrap: wrap;
}
.hero-text {
  flex: 1 1 350px;
}
.hero-text h1 {
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}
.hero-text h2 {
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--color-accent);
  min-height: 2.2rem;
}
.hero-text p {
  margin: 1.2rem 0 2rem 0;
  font-size: 1.1rem;
  color: var(--color-accent);
}
.hero-buttons {
  display: flex;
  gap: 1rem;
}
.btn {
  padding: 0.8rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px var(--color-shadow);
  text-decoration: none;
  display: inline-block;
}
.btn.primary {
  background: var(--color-primary);
  color: #fff;
}
.btn.primary:hover {
  background: #1746a2;
}
.btn.outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn.outline:hover {
  background: var(--color-primary);
  color: #fff;
}
.hero-img {
  flex: 1 1 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-img img {
  width: 320px;
  max-width: 100%;
  border-radius: 24px;
  box-shadow: 0 4px 24px var(--color-shadow);
  background: #fff;
}

/* About Section */
.about-section {
  padding: 5rem 0 3rem 0;
  background: var(--color-bg);
  transition: background var(--transition);
}
body.dark .about-section {
  background: #1e293b;
}
.about-content {
  display: flex;
  align-items: center;
  gap: 3rem;
  flex-wrap: wrap;
}
.about-info {
  flex: 1 1 350px;
}
.about-info h2 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
  color: var(--color-primary);
}
.about-info p {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}
.about-details {
  list-style: none;
  padding: 0;
  margin: 0;
}
.about-details li {
  margin-bottom: 0.7rem;
  font-size: 1rem;
}
.about-details a {
  color: var(--color-primary);
  text-decoration: none;
}
.about-img {
  flex: 1 1 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.about-img img {
  width: 220px;
  max-width: 100%;
  border-radius: 16px;
  box-shadow: 0 2px 12px var(--color-shadow);
  background: #fff;
}

/* Skills Section */
.skills-section {
  padding: 5rem 0 3rem 0;
  background: #f1f5f9;
  transition: background var(--transition);
}
body.dark .skills-section {
  background: #22304a;
}
.skills-section h2 {
  text-align: center;
  color: var(--color-primary);
  margin-bottom: 2.5rem;
}
.skills-cards {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2.5rem;
}
.skill-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 2px 16px var(--color-shadow);
  padding: 2rem 2.5rem 1.5rem 2.5rem;
  min-width: 260px;
  max-width: 320px;
  transition: box-shadow 0.3s, transform 0.3s;
  border: 2px solid #f1f5f9;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.skill-card:hover {
  box-shadow: 0 4px 24px rgba(37, 99, 235, 0.12);
  transform: scale(1.025);
  border-color: #e0e7ef;
}
.skill-icon {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.skill-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #22223b;
  margin-bottom: 1.2rem;
  letter-spacing: 1px;
}
.bar {
  width: 90%;
  height: 8px;
  background: #e0e7ef;
  border-radius: 8px;
  margin-top: 1.2rem;
  margin-bottom: 0.2rem;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #60a5fa);
  width: var(--level);
  border-radius: 8px;
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
}

/* Resume/Experience Section */
.resume-section {
  padding: 5rem 0 3rem 0;
  background: #f1f5f9;
  transition: background var(--transition);
}
body.dark .resume-section {
  background: #22304a;
}
.resume-section h2 {
  text-align: center;
  color: var(--color-primary);
  margin-bottom: 2.5rem;
}
.timeline {
  max-width: 700px;
  margin: 0 auto;
  position: relative;
  padding-left: 30px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--color-primary);
  border-radius: 2px;
}
.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
  padding-left: 2.5rem;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s, transform 0.7s;
}
.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}
.timeline-dot {
  position: absolute;
  left: -2px;
  top: 0.5rem;
  width: 16px;
  height: 16px;
  background: #fff;
  border: 4px solid var(--color-primary);
  border-radius: 50%;
  z-index: 1;
}
.timeline-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
}
.timeline-date {
  font-size: 0.95rem;
  color: var(--color-accent);
  margin-bottom: 0.3rem;
}
.timeline-desc {
  font-size: 1rem;
  color: var(--color-accent);
}

/* Contact Section */
.contact-section {
  padding: 5rem 0 0 0;
  background: var(--color-bg);
  transition: background var(--transition);
}
body.dark .contact-section {
  background: #f1f5f9;
}
.contact-content {
  display: flex;
  align-items: flex-start;
  gap: 3rem;
  flex-wrap: wrap;
  justify-content: center;
}
.contact-info {
  flex: 1 1 250px;
  margin-bottom: 2rem;
}
.contact-info h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}
.contact-info p {
  font-size: 1.1rem;
  color: var(--color-accent);
}
.contact-form {
  flex: 1 1 350px;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  background: #fff;
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 2px 12px var(--color-shadow);
}
body.dark .contact-form {
  background: #22304a;
}
.contact-form input,
.contact-form textarea {
  padding: 0.9rem 1rem;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-main);
  background: #f8fafc;
  color: var(--color-text);
  transition: border var(--transition), background var(--transition);
}
body.dark .contact-form input,
body.dark .contact-form textarea {
  background: #1e293b;
  color: #fff;
  border: 1px solid #334155;
}
.contact-form textarea {
  min-height: 90px;
  resize: vertical;
}
.contact-form .btn {
  align-self: flex-start;
}
.form-message {
  font-size: 1rem;
  margin-top: 0.5rem;
  color: var(--color-primary);
}

/* Footer */
.footer {
  background: #222c3a;
  color: #fff;
  padding: 2rem 0 1rem 0;
  text-align: center;
  margin-top: 3rem;
}
.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.footer-social {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.5rem;
}
.footer-social a img {
  width: 28px;
  height: 28px;
  filter: invert(1);
  transition: filter 0.3s;
}
.footer-social a:hover img {
  filter: invert(0.5) sepia(1) hue-rotate(190deg) saturate(5);
}
.footer p {
  font-size: 1rem;
  color: #cbd5e1;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  background: #e0e7ef;
}
::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 8px;
}

/* Responsive */
@media (max-width: 900px) {
  .hero-content, .about-content, .contact-content {
    flex-direction: column;
    gap: 2rem;
    text-align: center;
  }
  .hero-img, .about-img {
    justify-content: center;
  }
  .contact-form {
    margin: 0 auto;
  }
}
@media (max-width: 600px) {
  .container {
    width: 98%;
  }
  .hero-text h1 {
    font-size: 2.1rem;
  }
  .hero-img img, .about-img img {
    width: 160px;
  }
  .skills-cards {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }
  .contact-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
  .contact-form {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 1rem;
    margin-top: 0.5rem;
    background: #fff !important;
    box-shadow: 0 2px 12px var(--color-shadow);
    border-radius: 16px;
  }
  .contact-form input,
  .contact-form textarea {
    background: #fff !important;
    color: #22223b !important;
    border: 1.5px solid #e0e7ef !important;
    min-height: 44px;
    padding: 0.9rem 1rem;
    font-size: 1rem;
    margin-bottom: 0.7rem;
    border-radius: 8px;
    box-sizing: border-box;
  }
  .contact-form textarea {
    min-height: 90px;
  }
}

.about-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.about-info {
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.about-details-cards {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 2.5rem auto 0 auto;
  align-items: center;
}

.about-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px var(--color-shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform var(--transition);
}

body.dark .about-card {
  background: var(--color-bg-dark);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.about-card:hover {
  transform: scale(1.05);
}

.about-icon {
  background: #e7f0fd;
  border-radius: 12px;
  padding: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark .about-icon {
  background: #1e293b;
}

.about-icon img {
  width: 32px;
  height: 32px;
  display: block;
}

.about-label {
  font-weight: 700;
  color: var(--color-accent);
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
  text-align: left;
}

.about-value {
  font-size: 1.1rem;
  color: var(--color-text);
  text-align: left;
}

body.dark .about-value {
  color: var(--color-text-dark);
}

.about-value a {
  color: var(--color-primary);
  text-decoration: none;
  word-break: break-all;
}

@media (max-width: 600px) {
  .about-card {
    min-width: 0;
    width: 100%;
    padding: 1rem;
  }
  .about-details-cards {
    gap: 1rem;
  }
}

.footer-social a:hover svg [stroke="#2563eb"], 
.footer-social a:hover svg [stroke="#fff"] {
  stroke: #2563eb !important;
}
.footer-social a:hover svg [fill="#fff"] {
  fill: #2563eb !important;
}
.about-icon svg {
  display: block;
}
@media (max-width: 900px) {
    .nav-actions {
      margin-left: 0 !important;
    }
}

/* Contact section center */
.contact-header {
  text-align: center;
  width: 100%;
  color: var(--color-primary);
  font-size: 2rem;
  margin-bottom: 2rem;
  font-weight: 700;
}
.contact-content {
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
.contact-form {
  margin: 0 auto;
  max-width: 480px;
  width: 100%;
}

/* Footer social icons (LinkedIn rounded, Instagram outlined) */
.footer-social svg {
  width: 32px;
  height: 32px;
  margin: 0 0.2rem;
  transition: filter 0.3s, box-shadow 0.3s;
}
.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s;
}
.footer-social a:hover svg {
  filter: drop-shadow(0 0 6px var(--color-primary));
}
.footer-social a:hover {
  background: rgba(37,99,235,0.08);
}

/* Accessibility and Semantic Improvements */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for better keyboard navigation */
a:focus,
button:focus,
input:focus,
textarea:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: white;
  padding: 8px;
  z-index: 100;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
}

/* Form improvements */
.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-color);
  color: var(--text-color);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

/* Error states */
.form-group input:invalid,
.form-group textarea:invalid {
  border-color: var(--error-color, #dc3545);
}

.form-group input:invalid:focus,
.form-group textarea:invalid:focus {
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

/* Success message */
.form-message[role="alert"] {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 4px;
  font-weight: 500;
}

.form-message.success {
  background-color: var(--success-color, #28a745);
  color: white;
}

.form-message.error {
  background-color: var(--error-color, #dc3545);
  color: white;
}

/* Loading state */
.form-group.loading {
  position: relative;
}

.form-group.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1rem;
  width: 1rem;
  height: 1rem;
  margin-top: -0.5rem;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* High contrast mode support */
@media (forced-colors: active) {
  .btn,
  .nav-links a,
  .social-links a {
    border: 2px solid currentColor;
  }
  
  .form-group input,
  .form-group textarea {
    border: 2px solid currentColor;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .hero-img img,
  .about-img img {
    transform: none !important;
  }
}