/**
 * style.css - Estilos principales de High Reliability Systems
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* TEMA AZUL (POR DEFECTO) */
  --primary: #06233a; /* más profundo */
  --secondary: #1f6aa8; /* azul más definido */
  --accent: #ff8a00; /* naranja más brillante */
  --text-dark: #071427;
  --text-light: #9fb3c5;
  --bg-light: #f4f8fb;
  --white: #ffffff;
  --border: rgba(255,255,255,0.08);
  /* Colores para hero section */
  --hero-color-1: rgba(6,35,58,1);
  --hero-color-2: rgba(31,106,168,0.95);
  /* Rutas de imágenes */
  --bg-image: url("../assets/images/azul/pcb.png");
  --logo-path: "./assets/images/azul/HRS.png";
}

/* TEMA VERDE */
[data-theme="green"] {
  --primary: #1a4d2e; /* verde oscuro */
  --secondary: #2d8659; /* verde vivo */
  --accent: #ff8a00; /* naranja mantiene */
  --text-dark: #0a2614;
  --text-light: #4a6f5e;
  --bg-light: #e8f3ed;
  --hero-color-1: rgba(26,77,46,1);
  --hero-color-2: rgba(45,134,89,0.95);
  /* Rutas de imágenes para tema verde */
  --bg-image: url("../assets/images/verde/pcb.png");
  --logo-path: "./assets/images/verde/HRS.png";
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-dark);
  line-height: 1.6;
  overflow-x: hidden;
  background: linear-gradient(135deg, var(--hero-color-1) 0%, var(--hero-color-2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* NAVEGACIÓN */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  padding: 1rem 2rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 0 0 12px 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.logo-image {
  /* Mostrar la imagen tal cual: sin brillo, sin relieve ni recortes.
     Mantener un tamaño máximo para ajustar el layout del nav. */
  height: auto;
  max-height: 64px;
  width: auto;
  border-radius: 0;
  box-shadow: none;
  filter: none;
  background: transparent;
  display: block;
}

nav .logo-image {
  border: none;
  background: #000;
  padding: 6px;
  box-shadow: none;
  border-radius: 4px;
}

.logo-text {
  font-size: 1.2rem;
  color: var(--primary);
}

.hero-logo {
  margin-bottom: 1.5rem;
}

.hero-logo img {
  width: 260px;
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.22), 0 6px 18px rgba(0,0,0,0.12);
  border: 6px solid rgba(255, 255, 255, 0.70); /* marco menos brillante */
  background: rgba(255,255,255,0.01);
  filter: brightness(0.92); /* reducir un poco la luminosidad */
}

nav ul {
  display: flex;
  list-style: none;
  gap: 2.5rem;
}

nav a {
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

nav a:hover {
  color: var(--primary);
}

/* HERO SECTION */
.hero {
  margin-top: 60px;
  background: transparent;
  color: var(--white);
  padding: 8rem 2rem;
  text-align: center;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  opacity: 0.12;
  z-index: 0;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.hero p {
  font-size: 1.3rem;
  margin-bottom: 2rem;
  opacity: 1;
  color: white;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.cta-btn {
  display: inline-block;
  background: var(--accent);
  color: var(--white);
  padding: 1rem 2.5rem;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  transition: transform 0.3s, box-shadow 0.3s;
  border: none;
  cursor: pointer;
}

.cta-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}

/* SECCIONES GENERALES */
section {
  padding: 5rem 2rem;
}

section h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary);
  text-align: center;
}

section > p {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 3rem;
  font-size: 1.1rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* ABOUT SECTION */
.about {
  background: var(--bg-light);
}

.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.about-text h3 {
  font-size: 1.8rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
}

.about-text p {
  text-align: left;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.about-image {
  width: 100%;
  height: 400px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 4rem;
}

.about-image img {
  max-width: 80%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  background: rgba(255,255,255,0.02);
}

/* SERVICES SECTION */
.services {
  background: transparent;
  padding: 4rem 0;
}

.services h2,
.services p {
  color: var(--white);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.service-card {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 2.5rem;
  border-radius: 16px;
  transition: transform 0.3s, box-shadow 0.3s;
  text-align: center;
}

.service-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.service-card h3 {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.service-card p {
  color: var(--text-light);
  line-height: 1.8;
}

.service-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* PRODUCTS SECTION */
.products {
  background: var(--white);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.product-card {
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.1);
  border-color: var(--primary);
}

.product-image {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.product-card h3 {
  color: var(--primary);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.product-card p {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.6;
  flex-grow: 1;
  margin-bottom: 1rem;
}

.product-card .price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin: 1rem 0;
}

.product-card .cta-btn {
  align-self: center;
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
}

/* COURSES SECTION */
.courses {
  background: var(--bg-light);
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.course-card {
  background: var(--white);
  padding: 2rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
  display: flex;
  flex-direction: column;
  position: relative;
}

.course-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.1);
  border-color: var(--primary);
}

.course-level {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--primary);
  color: var(--white);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.course-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  margin-top: 1rem;
}

.course-card h3 {
  color: var(--primary);
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
}

.course-card p {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0.8rem;
}

.course-card .duration {
  font-weight: 600;
  color: var(--secondary);
  margin-top: 1rem !important;
}

.course-card .price-course {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  margin: 1rem 0;
}

.course-card .cta-btn {
  align-self: center;
  padding: 0.8rem 2rem;
  font-size: 0.95rem;
  margin-top: auto;
}

/* PORTFOLIO SECTION */
.portfolio {
  background: var(--bg-light);
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.portfolio-item {
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transition: transform 0.3s;
}

.portfolio-item:hover {
  transform: translateY(-5px);
}

.portfolio-image {
  width: 100%;
  height: 250px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--white);
}

.portfolio-content {
  padding: 1.5rem;
}

.portfolio-content h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.portfolio-content p {
  color: var(--text-light);
  font-size: 0.95rem;
}

/* CONTACT SECTION */
.contact {
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, var(--hero-color-1) 0%, var(--hero-color-2) 100%);
  overflow: hidden;
  padding: 6rem 2rem;
  color: var(--white);
}

.contact::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.contact::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 1;
}

.contact > * {
  position: relative;
  z-index: 2;
}

.contact h2 {
  color: var(--white);
}

.contact p {
  color: var(--white);
}

.contact-form {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.8rem;
  border: none;
  border-radius: 5px;
  font-family: inherit;
  font-size: 1rem;
}

..form-group textarea {
  resize: vertical;
  min-height: 150px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: 2px solid var(--accent);
}

.contact-message {
  margin-top: 1.25rem;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.contact-message.success {
  background: rgba(56, 189, 248, 0.18);
  color: #dbf7ff;
  border: 1px solid rgba(56, 189, 248, 0.6);
}

.contact-message.error {
  background: rgba(248, 113, 113, 0.18);
  color: #ffe1e1;
  border: 1px solid rgba(248, 113, 113, 0.6);
}

/* FOOTER */
footer {
  background: var(--text-dark);
  color: var(--white);
  text-align: center;
  padding: 2rem;
}

footer p {
  margin: 0.5rem 0;
}

.social-links {
  margin: 1rem 0;
}

.social-links a {
  color: var(--accent);
  text-decoration: none;
  margin: 0 1rem;
  font-weight: 600;
}

/* THEME SELECTOR */
.theme-selector-container {
  position: relative;
  margin-left: 2rem;
}

.theme-selector-btn {
  background: var(--primary);
  color: var(--white);
  border: 2px solid var(--accent);
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.theme-selector-btn:hover {
  background: var(--accent);
  color: var(--primary);
  transform: scale(1.05);
}

.theme-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--white);
  border: 2px solid var(--primary);
  border-radius: 5px;
  min-width: 150px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  margin-top: 0.5rem;
}

.theme-dropdown.active {
  display: block;
}

.theme-dropdown button {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-dark);
  transition: all 0.2s ease;
  font-weight: 500;
}

.theme-dropdown button:hover {
  background: var(--bg-light);
  color: var(--primary);
}

.theme-dropdown button.active {
  background: var(--primary);
  color: var(--white);
}

/* RESPONSIVE */
@media (max-width: 768px) {
  nav {
    flex-wrap: wrap;
    padding: 1rem 1rem;
    gap: 0.75rem;
  }

  .logo {
    width: 100%;
    justify-content: space-between;
  }

  .logo-text {
    font-size: 1rem;
  }

  nav ul {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.85rem;
  }

  nav ul li {
    flex: none;
  }

  .hero {
    margin-top: 80px;
    padding: 6rem 1.5rem;
  }

  .hero-logo img {
    width: 220px;
  }

  .hero h1 {
    font-size: 2.7rem;
  }

  .hero p {
    font-size: 1rem;
    max-width: 95%;
    margin: 0 auto 2rem;
  }

  .cta-btn {
    padding: 1rem 2rem;
  }

  .about-content {
    grid-template-columns: 1fr;
  }

  .about-image {
    order: -1;
    height: auto;
  }

  .about-image img {
    max-width: 100%;
  }

  section h2 {
    font-size: 2rem;
  }

  section {
    padding: 3rem 1rem;
  }

  .services-grid,
  .products-grid,
  .courses-grid,
  .portfolio-grid {
    gap: 1.5rem;
  }

  .service-card,
  .product-card,
  .course-card {
    padding: 1.5rem;
  }

  .contact-form {
    padding: 0 0.5rem;
  }
}

@media (max-width: 480px) {
  nav {
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
  }

  .logo {
    justify-content: center;
    gap: 0.75rem;
  }

  .logo-text {
    font-size: 0.95rem;
  }

  nav ul {
    gap: 0.8rem;
  }

  .hero {
    margin-top: 120px;
    padding: 3rem 1rem;
  }

  .hero-logo img {
    width: 180px;
  }

  .hero h1 {
    font-size: 1.9rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .cta-btn {
    width: 100%;
    padding: 0.95rem 1rem;
  }

  section h2 {
    font-size: 1.5rem;
  }

  section {
    padding: 2rem 1rem;
  }
}

/* MODAL STYLES */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background-color: var(--white);
  margin: 5% auto;
  padding: 2rem;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideDown 0.3s;
}

.theme-standard {
  background-color: var(--white);
  color: var(--text-dark);
}

.theme-dark {
  background-color: #0f172a;
  color: #f8fafc;
}

.theme-dark .close {
  color: #f8fafc;
}

.theme-dark .cart-item {
  background: #111827;
  border-left-color: #3b82f6;
}

.theme-dark .cart-summary {
  background: #111827;
  border-top-color: #3b82f6;
}

.theme-dark .quantity-btn,
.theme-dark .remove-btn,
.theme-dark .cart-icon {
  background: #2563eb;
}

.theme-minimalist {
  background-color: #f9fafb;
  color: #111827;
  box-shadow: none;
  border: 1px solid #d1d5db;
}

.theme-minimalist .cart-item {
  background: #ffffff;
  border-left-color: #6b7280;
}

.theme-minimalist .cart-summary {
  background: #ffffff;
  border-top-color: #d1d5db;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close {
  color: #aaa;
  float: right;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover {
  color: var(--primary);
}

.modal h2 {
  color: var(--primary);
  margin-bottom: 1.5rem;
  clear: both;
}

.cart-items {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 1.5rem;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 5px;
  margin-bottom: 0.8rem;
  border-left: 4px solid var(--primary);
}

.item-info {
  flex: 1;
}

.item-name {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.item-price {
  color: var(--accent);
  font-size: 0.95rem;
}

.item-quantity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 1rem;
}

.quantity-btn {
  background: var(--primary);
  color: var(--white);
  border: none;
  width: 25px;
  height: 25px;
  border-radius: 3px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

.quantity-btn:hover {
  background: var(--secondary);
}

.item-total {
  font-weight: 600;
  color: var(--text-dark);
  min-width: 80px;
  text-align: right;
}

.remove-btn {
  background: #e74c3c;
  color: var(--white);
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.3s;
}

.remove-btn:hover {
  background: #c0392b;
}

.cart-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
  font-size: 1.1rem;
}

.cart-summary {
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: 5px;
  border-top: 2px solid var(--primary);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  color: var(--text-light);
}

.summary-row.total {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
  margin-top: 0.8rem;
}

/* FLOATING CART ICON */
.cart-icon {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--white);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  transition: transform 0.3s, box-shadow 0.3s;
  z-index: 999;
}

.cart-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

#cartCount {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--accent);
  color: var(--white);
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
}

@media (max-width: 768px) {
  .modal-content {
    margin: 20% auto;
    width: 95%;
  }

  .cart-item {
    flex-wrap: wrap;
  }

  .item-quantity {
    margin: 0.5rem 0;
  }
}
