/* Variables */
:root {
  --primary-color: #7b9c3a;
  --secondary-color: #6c757d;
  --dark-bg: #1a1a1a;
  --dark-card: #2d2d2d;
  --dark-text: #ffffff;
  --light-bg: #ffffff;
  --light-card: #f8f9fa;
  --light-text: #333333;
  --transition: all 0.3s ease;
}

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

.beta-badge {
  display: inline-block;
  background-color: var(--primary-color);
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
  box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
  animation: pulse 2s infinite;
  margin-left: 1rem;
  vertical-align: middle;
}

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

.title-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  transition: var(--transition);
  background-color: var(--light-bg);
  color: var(--light-text);
}

/* Header & Navigation */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  padding: 1rem 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.nav-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: var(--transition);
}

.nav-link:hover::after {
  width: 100%;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  transition: var(--transition);
}

.theme-toggle:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

/* Hamburger menu styles */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 2001;
}

.hamburger .bar {
  display: block;
  width: 28px;
  height: 3px;
  margin: 4px 0;
  background-color: var(--primary-color);
  transition: 0.3s;
  border-radius: 2px;
}

@media (max-width: 1490px) {
  .hamburger {
    display: flex;
    right: 1.5rem;
    position: absolute;
    top: 15px;
  }
  
  .nav-links {
    display: none;
    flex-direction: column;
    gap: 1.2rem;
    position: absolute;
    top: 70px;
    right: 2rem;
    background: var(--light-card);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-radius: 10px;
    padding: 2rem 2.5rem;
    z-index: 2000;
    align-items: center;
  }
  
  .nav-links li {
    width: 100%;
    display: flex;
    justify-content: center;
  }
  
  .nav-links .nav-link {
    width: 100%;
    text-align: center;
    justify-content: center;
    display: inline-block;
  }
  
  .nav-links .theme-toggle {
    margin-top: 0;
    justify-content: center;
  }
  
  .nav-links.active {
    display: flex;
  }
  
  .theme-toggle {
    width: 100%;
    justify-content: flex-start;
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
    display: flex;
  }
  
  #theme-toggle {
    display: none;
  }
  
  .nav-links .theme-toggle {
    display: flex !important;
    width: 100%;
    justify-content: flex-start;
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1rem;
    box-shadow: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
  }
  
  .theme-toggle {
    display: none;
  }
  
  .nav-links .theme-toggle {
    display: flex;
  }
}

@media (min-width: 1491px) {
  #theme-toggle-desktop {
    display: flex !important;
    position: absolute;
    right: 2.5rem;
    top: 30px;
    align-items: center;
    gap: 0.5rem;
    z-index: 1001;
  }
  
  .nav-links .theme-toggle {
    display: none !important;
  }
}

@media (max-width: 1490px) {
  #theme-toggle-desktop {
    display: none !important;
  }
}

body.dark .nav-links {
  background: var(--dark-card);
}

/* Main Content */
main {
  margin-top: 80px;
}

.section {
  padding: 5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: 2.5rem;
  margin-bottom: 3rem;
  text-align: center;
  color: var(--primary-color);
}

h2 {
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

/* Hero Section */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--dark-bg);
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  padding-left: 0;
  padding-right: 0;
  max-width: 100vw;
}

#matrix-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 10px;
  backdrop-filter: blur(5px);
}

.hero-title {
  color: var(--primary-color);
  font-size: 3.5rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

.hero-subtitle {
  color: #ffffff;
  font-size: 1.5rem;
  margin-bottom: 2rem;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  font-weight: 500;
}

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

.btn {
  padding: 1rem 2rem;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary-color);
  color: #fff !important;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  letter-spacing: 0.5px;
}

.btn-primary:visited,
.btn-primary:active {
  color: #fff !important;
}

.btn-primary:hover {
  background-color: #63782d;
  color: #fff !important;
}

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

.btn-secondary:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

/* About Section */
.about-content {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3rem;
  align-items: stretch;
}

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

.about-text p {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  line-height: 1.7;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  align-items: center;
}

.stat-item {
  text-align: center;
  padding: 2rem;
  background-color: var(--light-card);
  border-radius: 10px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--primary-color);
  display: block;
  margin-bottom: 0.5rem;
}

.carousel-container {
  position: relative;
  width: 100%;
  padding: 2rem 0;
  overflow: hidden;
}

.carousel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
  width: 100%;
  height: 100%;
  position: relative;
}

.carousel-slide {
  width: 100%;
  flex: 0 0 auto;
  margin: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  z-index: 10;
  transition: background 0.3s ease;
  font-size: 1.5rem;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.carousel-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.prev-btn {
  left: 2rem;
}

.next-btn {
  right: 2rem;
}

@media (max-width: 768px) {
  .carousel-slide {
    width: 100%;
    margin: 0;
  }
  
  .carousel-btn {
    display: none;
  }
  
  .carousel-track {
    width: 100%;
  }
  
  .carousel {
    padding: 0 1rem;
  }
}

/* Skills Section */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.skill-category {
  background-color: var(--light-card);
  padding: 2rem;
  border-radius: 10px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.skill-category:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.skill-category h3 {
  margin-bottom: 1.5rem;
  color: var(--primary-color);
}

.skill-list {
  list-style: none;
}

.skill-list li {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  line-height: 1.7;
}

.skill-list i {
  color: var(--primary-color);
}

/* Projects Section */
.project-category {
  margin-bottom: 3rem;
}

.project-category h3 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  color: var(--primary-color);
  text-align: center;
}

.web-projects,
.game-projects {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.game-projects .carousel-container {
  width: 100%;
  max-width: 1200px;
}

.project-card {
  background: var(--light-card);
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 1000px;
  height: 100%;
  min-height: 500px;
}

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

.project-image {
  width: 100%;
  height: 400px;
  position: relative;
  overflow: hidden;
  background: #f0f0f0;
}

.project-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: transform 0.3s;
}

.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 8px; /* Puedes poner 0 si prefieres esquinas rectas */
  transition: transform 0.3s;
  position: absolute;
  top: 0;
  left: 0;
}

.project-card h3 {
  font-size: 1.4rem;
  margin: 1rem;
  color: var(--primary-color);
  text-align: center;
}

.project-card p {
  margin: 0 1rem 1rem;
  color: var(--primary-color);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 1rem 1rem;
  justify-content: center;
}

.project-tech span {
  background: var(--primary-color);
  color: #fff !important;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
}

.project-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* Contact Section */
.contact-container {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
}

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

.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background-color: var(--light-card);
  border-radius: 10px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.contact-item:hover {
  transform: translateX(10px) translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.contact-item i {
  font-size: 1.5rem;
  color: var(--primary-color);
}

.contact-details h3 {
  margin-bottom: 0.5rem;
}

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

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 1rem;
  background-color: var(--light-card);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 5px;
  color: var(--light-text);
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

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

/* Toasts */
#toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.toast {
  min-width: 240px;
  max-width: 350px;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  color: #fff;
  font-weight: 500;
  font-size: 1rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  opacity: 0.95;
  animation: fadeInToast 0.3s;
}

.toast.toast-error {
  background: #e74c3c;
}

.toast.toast-success {
  background: #63782d;
  color: #fff;
}

@keyframes fadeInToast {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 0.95; transform: translateY(0); }
}

/* Footer */
footer {
  background-color: var(--light-card);
  padding: 2rem;
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.footer-content p {
  margin: 0;
  color: var(--text-color);
}

.footer-content p:first-child {
  font-weight: 500;
}

.footer-content p:nth-child(2) {
  font-size: 0.9rem;
  opacity: 0.8;
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.social-links a {
  color: var(--light-text);
  font-size: 1.5rem;
  transition: var(--transition);
}

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

/* Light Mode (Default) */
body {
  background-color: var(--light-bg);
  color: var(--light-text);
}

body header {
  background-color: rgba(255, 255, 255, 0.95);
}

body .nav-link {
  color: var(--primary-color);
}

body .theme-toggle {
  color: var(--primary-color);
}

body .theme-toggle:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

body .stat-item,
body .skill-category,
body .project-card,
body .contact-item,
body .form-group input,
body .form-group textarea {
  background-color: var(--light-card);
}

body footer {
  background-color: var(--light-card);
}

body .social-links a {
  color: var(--light-text);
}

body a {
  color: var(--primary-color);
}

/* Dark Mode */
body.dark {
  background-color: var(--dark-bg);
  color: var(--dark-text);
}

body.dark header {
  background-color: rgba(26, 26, 26, 0.95);
}

body.dark .nav-link {
  color: var(--primary-color);
}

body.dark .theme-toggle {
  color: var(--primary-color);
}

body.dark .theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

body.dark .stat-item,
body.dark .skill-category,
body.dark .project-card,
body.dark .contact-item,
body.dark .form-group input,
body.dark .form-group textarea {
  background-color: var(--dark-card);
  color: #fff;
}

body.dark footer {
  background-color: var(--dark-card);
}

body.dark .social-links a {
  color: var(--dark-text);
}

body.dark a {
  color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  
  .about-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .about-stats {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .about-text p {
    font-size: 1rem;
    line-height: 1.5;
  }
  
  .contact-container {
    grid-template-columns: 1fr;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.2rem;
  }
  
  .section {
    padding: 3rem 1rem;
  }
  
  .footer-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .web-projects,
  .game-projects {
    grid-template-columns: 1fr;
  }
  
  .project-card {
    max-width: 100%;
  }

  .hero-section {
    width: 100vw;
    margin-left: -50vw;
    left: 50%;
    right: 50%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
  }

  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .logo {
    font-size: 1.1rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .section-title, h2 {
    font-size: 1.4rem !important;
    line-height: 1.2;
  }

  h2 {
    will-change: transform;
    transition: transform 0.2s;
  }
}