/* Header Responsivo - CSS */

/* Variables específicas del header */
:root {
  --header-height: 80px;
  --nav-height: 60px;
  --topbar-height: 40px;
  --header-bg: #ffffff;
  --nav-bg: #1f2937;
  --primary-color: #6366f1;
  --text-dark: #1f2937;
  --text-light: #6b7280;
  --border-color: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Top Bar */
.top-bar {
  background: var(--nav-bg);
  color: white;
  padding: 0;
  font-size: 14px;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1001;
}

.top-bar.hidden {
  transform: translateY(-100%);
}

.top-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--topbar-height);
}

.contact-info {
  display: flex;
  gap: 24px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.contact-item a {
  color: white;
  text-decoration: none;
  transition: color 0.3s ease;
}

.contact-item a:hover {
  color: var(--primary-color);
}

.user-actions {
  display: flex;
  gap: 16px;
}

.user-link {
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 4px;
  transition: all 0.3s ease;
  font-size: 13px;
}

.user-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary-color);
}

/* Main Header */
.main-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.main-header.scrolled {
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.main-header.scroll-hidden {
  transform: translateY(-100%);
}

.header-content {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
  height: var(--header-height);
}

/* Logo */
.logo a {
  text-decoration: none;
  color: var(--text-dark);
  display: block;
}

.logo h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  line-height: 1;
}

.logo h1 span {
  color: var(--primary-color);
}

.logo .tagline {
  font-size: 11px;
  color: var(--text-light);
  margin: 0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Search Container */
.search-container {
  position: relative;
  max-width: 500px;
  width: 100%;
}

.search-form {
  position: relative;
}

.search-input-group {
  display: flex;
  background: var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.search-input-group:focus-within {
  background: white;
  box-shadow: 0 0 0 2px var(--primary-color);
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-dark);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-light);
}

.search-btn {
  background: var(--primary-color);
  border: none;
  color: white;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.3s ease;
  min-width: 50px;
}

.search-btn:hover {
  background: #4f46e5;
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: var(--shadow);
  z-index: 1002;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.action-btn {
  position: relative;
  color: var(--text-dark);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
  min-width: 60px;
}

.action-btn:hover {
  color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.action-btn i {
  font-size: 20px;
}

.action-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge {
  position: absolute;
  top: 4px;
  right: 8px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  transform: scale(0);
  transition: transform 0.3s ease;
}

.badge.has-items,
.badge:not(:empty) {
  transform: scale(1);
}

/* Cart Preview */
.cart-container {
  position: relative;
}

.cart-preview {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1003;
  margin-top: 8px;
}

.cart-preview.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.cart-preview-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-preview-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.cart-total {
  color: var(--primary-color);
  font-weight: 700;
}

.cart-preview-items {
  padding: 16px;
  max-height: 200px;
  overflow-y: auto;
}

.empty-cart {
  text-align: center;
  color: var(--text-light);
  margin: 0;
  padding: 20px 0;
}

.cart-preview-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  flex: 1;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.3s ease;
  position: relative;
  flex-direction: column;
  gap: 4px;
  width: 40px;
  height: 40px;
  justify-content: center;
  align-items: center;
}

.mobile-menu-toggle:hover {
  background: rgba(99, 102, 241, 0.1);
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background: var(--text-dark);
  transition: all 0.3s ease;
  border-radius: 2px;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Main Navigation */
.main-nav {
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 999;
}

.nav-content {
  height: var(--nav-height);
}

.nav-menu {
  display: flex;
  align-items: center;
  height: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 8px;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  text-decoration: none;
  padding: 16px 20px;
  border-radius: 6px;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 14px;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary-color);
}

.nav-link i {
  font-size: 16px;
  opacity: 0.8;
}

.dropdown-arrow {
  margin-left: auto;
  font-size: 12px;
  transition: transform 0.3s ease;
}

.nav-link.active .dropdown-arrow {
  transform: rotate(180deg);
}

.promo-badge {
  background: #ef4444;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 280px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1004;
  list-style: none;
  margin: 0;
  padding: 8px 0;
  margin-top: 8px;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  margin: 0;
}

.dropdown-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-dark);
  text-decoration: none;
  transition: background 0.3s ease;
}

.dropdown-link:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
}

.dropdown-link i {
  width: 20px;
  text-align: center;
  color: var(--primary-color);
  font-size: 16px;
}

.dropdown-content {
  flex: 1;
}

.dropdown-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.dropdown-desc {
  display: block;
  font-size: 12px;
  color: var(--text-light);
}

/* Mobile Navigation Footer */
.mobile-nav-footer {
  display: none;
  padding: 24px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.mobile-contact {
  margin-bottom: 20px;
}

.mobile-contact h4 {
  color: white;
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
}

.mobile-contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  padding: 6px 0;
  font-size: 13px;
  transition: color 0.3s ease;
}

.mobile-contact-item:hover {
  color: var(--primary-color);
}

.mobile-user-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-user-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  text-decoration: none;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  transition: color 0.3s ease;
}

.mobile-user-link:hover {
  color: var(--primary-color);
}

/* Mobile Overlay */
.mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Responsive Breakpoints */

/* Tablet */
@media (max-width: 1024px) {
  .header-content {
    gap: 20px;
  }
  
  .search-container {
    max-width: 400px;
  }
  
  .action-label {
    display: none;
  }
  
  .contact-info {
    gap: 16px;
  }
  
  .contact-item span {
    display: none;
  }
}

/* Mobile Large */
@media (max-width: 768px) {
  :root {
    --header-height: 70px;
    --nav-height: 0;
  }
  
  .top-bar-content {
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
    height: auto;
  }
  
  .contact-info {
    gap: 12px;
  }
  
  .user-actions {
    gap: 12px;
  }
  
  .header-content {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
  }
  
  .search-container {
    order: 3;
    grid-column: 1 / -1;
    margin-top: 12px;
  }
  
  .header-actions {
    gap: 8px;
  }
  
  .action-btn {
    min-width: 40px;
    padding: 8px 4px;
  }
  
  .mobile-menu-toggle {
    display: flex;
  }
  
  /* Mobile Navigation */
  .main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: var(--nav-bg);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 999;
  }
  
  .main-nav.mobile-open {
    transform: translateX(0);
  }
  
  .nav-content {
    height: auto;
    padding: 80px 0 0 0;
  }
  
  .nav-menu {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    gap: 0;
    padding: 20px 0;
  }
  
  .nav-link {
    padding: 16px 20px;
    border-radius: 0;
    justify-content: flex-start;
  }
  
  .dropdown-menu {
    position: static;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  
  .dropdown-menu.show {
    max-height: 400px;
  }
  
  .dropdown-link {
    padding: 12px 40px;
    color: rgba(255, 255, 255, 0.8);
  }
  
  .dropdown-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
  }
  
  .mobile-nav-footer {
    display: block;
  }
  
  body.mobile-menu-open {
    overflow: hidden;
  }
}

/* Mobile Small */
@media (max-width: 480px) {
  :root {
    --header-height: 60px;
  }
  
  .top-bar {
    font-size: 12px;
  }
  
  .logo h1 {
    font-size: 20px;
  }
  
  .logo .tagline {
    font-size: 10px;
  }
  
  .search-input {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  .search-btn {
    padding: 10px 12px;
    min-width: 44px;
  }
  
  .action-btn i {
    font-size: 18px;
  }
  
  .cart-preview {
    width: calc(100vw - 40px);
    right: -10px;
  }
  
  .main-nav {
    width: 280px;
  }
}

/* Extra Small */
@media (max-width: 360px) {
  .container {
    padding: 0 12px;
  }
  
  .header-content {
    gap: 8px;
  }
  
  .logo h1 {
    font-size: 18px;
  }
}

/* Landscape Mobile */
@media (max-height: 600px) and (orientation: landscape) {
  .main-nav {
    padding-top: 60px;
  }
  
  .nav-content {
    padding-top: 60px;
  }
  
  .mobile-nav-footer {
    padding: 16px 20px;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .logo h1 {
    font-weight: 700;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --header-bg: #1f2937;
    --text-dark: #f9fafb;
    --text-light: #d1d5db;
    --border-color: #374151;
  }
  
  .main-header.scrolled {
    background: rgba(31, 41, 55, 0.95);
  }
  
  .search-input-group {
    background: #374151;
  }
  
  .search-input {
    color: #f9fafb;
  }
  
  .search-input::placeholder {
    color: #9ca3af;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus States */
.nav-link:focus,
.action-btn:focus,
.user-link:focus,
.search-input:focus,
.search-btn:focus,
.mobile-menu-toggle:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .top-bar,
  .main-nav,
  .mobile-menu-toggle,
  .mobile-overlay {
    display: none !important;
  }
  
  .main-header {
    position: static;
    box-shadow: none;
    border-bottom: 1px solid #000;
  }
}