/* ===== PORTFOLIO WEBSITE - MAIN STYLES (VŨ TIẾN ĐẠT - DrTMaD) ===== */

/* ===== ACCESSIBILITY & PERFORMANCE IMPROVEMENTS ===== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .animate-fade-in-up,
  .animate-fade-in-left,
  .animate-fade-in-right {
    animation: none !important;
  }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --accent-primary: #00ffff;
  }
}

/* Print styles */
@media print {
  .navbar,
  .particles-canvas,
  .floating-element {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
}

/* ===== ORIGINAL STYLES START HERE ===== */

/* CSS Variables for Dark Theme */
:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --bg-card: #2a2a2a;
  --bg-gradient: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
  --accent-primary: #00d4ff;
  --accent-secondary: #ff6b35;
  --accent-glow: #00d4ff33;
  --text-primary: #ffffff;
  --text-secondary: #b8b8b8;
  --text-muted: #666666;
  --border: #333333;
  --border-glow: #00d4ff55;
  --shadow-dark: rgba(0, 0, 0, 0.8);
  --shadow-glow: rgba(0, 212, 255, 0.3);
  --transition-fast: 0.3s ease;
  --transition-slow: 0.6s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Arial', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Animated Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-gradient);
  z-index: -2;
  opacity: 0.9;
}

/* Particle Background */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  margin-bottom: 1rem;
}

h1 {
  font-size: 3.5rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px var(--shadow-glow);
}

h2 {
  font-size: 2.5rem;
  color: var(--accent-primary);
  text-shadow: 0 0 20px var(--shadow-glow);
}

h3 {
  font-size: 2rem;
  color: var(--text-primary);
}

p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

/* Links */
a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--accent-secondary);
  text-shadow: 0 0 10px var(--shadow-glow);
}

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

/* Navigation */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(26, 26, 26, 0.98);
  backdrop-filter: blur(15px);
  z-index: 1000;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 30px rgba(0, 0, 0, 0.8);
  transition: all 0.3s ease;
}

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

.logo {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all 0.3s ease;
}

.logo:hover {
  transform: scale(1.02);
}

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

.nav-menu li a {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
  display: block;
}

.nav-menu li a:hover {
  color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.08);
  transform: translateY(-1px);
}

.nav-menu li a.active {
  color: var(--accent-primary);
  background: rgba(0, 212, 255, 0.12);
  font-weight: 600;
}

/* Mobile Menu Toggle */
.mobile-toggle {
  display: none;
  flex-direction: column;
  cursor: pointer;
  padding: 0.5rem;
}

.mobile-toggle span {
  width: 25px;
  height: 3px;
  background: var(--accent-primary);
  margin: 3px 0;
  transition: var(--transition-fast);
  border-radius: 2px;
  box-shadow: 0 0 10px var(--shadow-glow);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 1rem 2rem;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: var(--text-primary);
  box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-primary);
  border: 2px solid var(--accent-primary);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: var(--transition-fast);
  z-index: -1;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 15px 40px rgba(0, 212, 255, 0.6);
  filter: brightness(1.2);
}

.btn-secondary:hover {
  background: var(--accent-primary);
  color: var(--bg-primary);
  box-shadow: 0 15px 40px rgba(0, 212, 255, 0.4);
}

/* Sections */
.section {
  padding: 6rem 0;
  position: relative;
}

.section-title {
  text-align: center;
  margin-bottom: 4rem;
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -1rem;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 2px;
  box-shadow: 0 0 20px var(--shadow-glow);
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 2rem;
  border: 1px solid var(--border);
  transition: var(--transition-slow);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, var(--accent-glow), transparent);
  transition: var(--transition-slow);
  transform: rotate(-45deg);
  opacity: 0;
}

.card:hover::before {
  animation: cardGlow 2s infinite;
}

.card:hover {
  transform: translateY(-10px) rotateX(5deg);
  box-shadow: 0 20px 40px var(--shadow-dark), 0 0 30px var(--shadow-glow);
  border-color: var(--accent-primary);
}

@keyframes cardGlow {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.3; }
}

/* Grid System */
.grid {
  display: grid;
  gap: 2rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

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

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

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

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

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px var(--shadow-glow);
  }
  50% {
    box-shadow: 0 0 40px var(--shadow-glow), 0 0 60px var(--shadow-glow);
  }
}

/* Animation Classes */
.animate-fade-in-up {
  animation: fadeInUp 0.8s ease forwards;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.8s ease forwards;
}

.animate-fade-in-right {
  animation: fadeInRight 0.8s ease forwards;
}

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

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

/* Loading Spinner */
.loading {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-radius: 50%;
  border-top-color: var(--accent-primary);
  animation: spin 1s ease-in-out infinite;
}

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

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-3 { margin-bottom: 3rem; }

.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-100 { opacity: 1; }

.pointer { cursor: pointer; }
.hidden { display: none; }
.visible { display: block; }

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--accent-primary), var(--accent-secondary));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(var(--accent-secondary), var(--accent-primary));
}

/* ===== BACK TO TOP BUTTON ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 55px;
  height: 55px;
  background: linear-gradient(135deg, #00d4ff, #ff6b35);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 9999;
  transition: all 0.4s ease;
  box-shadow: 0 8px 25px rgba(0, 212, 255, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.back-to-top:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 15px 35px rgba(0, 212, 255, 0.5);
  background: linear-gradient(135deg, #ff6b35, #00d4ff);
}

.back-to-top:active {
  transform: translateY(-2px) scale(1.05);
}

.back-to-top i {
  transition: transform 0.3s ease;
}

.back-to-top:hover i {
  transform: translateY(-2px);
  animation: bounce-gentle 1.5s ease-in-out infinite;
}

@keyframes bounce-gentle {
  0%, 100% {
    transform: translateY(-2px);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .back-to-top {
    width: 50px;
    height: 50px;
    bottom: 20px;
    right: 20px;
    font-size: 1rem;
  }
}