/* El Sagà Bakery - Optimized Stylesheet */

/* Color Palette - Using CSS Variables */
:root {
  --primary-burgundy: #7C444F;
  --primary-rust: #9F5255;
  --primary-coral: #E16A54;
  --primary-peach: #F39E60;
  --light-cream: #F2EAE0;
  --dark-text: #333333;
  --light-text: #FFFFFF;
  --gray-text: #666666;
  --light-gray: #EEEEEE;
  
  /* Adding new variables for common values */
  --border-radius: 10px;
  --transition-standard: all 0.3s ease;
  --box-shadow-light: 0 5px 15px rgba(0, 0, 0, 0.05);
  --box-shadow-medium: 0 10px 20px rgba(0, 0, 0, 0.1);
  --standard-spacing: 1rem;
  --large-spacing: 2rem;
}

/* Reset & Base Styles */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  color: var(--dark-text);
  background-color: var(--light-cream);
  line-height: 1.6;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  margin-bottom: var(--standard-spacing);
}

h2 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin-bottom: 1.5rem;
  text-align: center;
}

h3 {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
}

p {
  margin-bottom: var(--standard-spacing);
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

section {
  padding: 5rem 0;
}

/* Image Handling */
img {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

img[loading="lazy"] {
  transition: opacity 0.3s;
}

.center {
  text-align: center;
  margin-top: var(--large-spacing);
}

/* Buttons - Combined Selectors */
.btn {
  display: inline-block;
  padding: 12px 30px;
  background-color: var(--primary-coral);
  color: var(--light-text);
  font-weight: 500;
  border-radius: 30px;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: var(--transition-standard);
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
}

.btn:hover,
.btn:focus {
  background-color: var(--primary-burgundy);
  transform: translateY(-3px);
  box-shadow: var(--box-shadow-light);
}

.btn-secondary {
  background-color: var(--primary-rust);
}

.btn-light {
  background-color: var(--light-text);
  color: var(--primary-rust);
}

.btn-light:hover,
.btn-light:focus {
  background-color: var(--light-cream);
  color: var(--primary-burgundy);
}

/* Layout Containers */
.content-wrapper {
  position: relative;
  z-index: 2;
  background-color: var(--light-cream);
  margin-top: -30px;
  overflow: hidden;
}

main.content-wrapper {
  position: relative;
  z-index: 2;
  background-color: var(--light-cream);
  overflow: hidden;
}

/* Navigation - Fixed Header */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: rgba(242, 234, 224, 0.95);
  box-shadow: var(--box-shadow-light);
  z-index: 1010;
  padding: 15px 0;
  backdrop-filter: blur(5px); /* Better visual effect */
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Logo Styling - Simplified */
.logo .logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo .logo-img img {
  width: 100px;
  height: auto;
  border-radius: 0;
}

.logo-text h1 {
  font-size: 2rem;
  color: var(--primary-burgundy);
  margin: 0;
}

.logo-text .tagline {
  font-size: 1rem;
  color: var(--primary-coral);
  margin: 0;
  letter-spacing: 1px;
}

/* Navigation Links - Improved Interaction */
.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-weight: 500;
  letter-spacing: 1px;
  padding: 5px 0;
  position: relative;
  transition: color 0.3s ease;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary-coral);
  transition: width 0.3s ease;
}

.nav-links a:hover,
.nav-links a:focus,
.nav-links a.active {
  color: var(--primary-coral);
}

.nav-links a:hover::after,
.nav-links a:focus::after,
.nav-links a.active::after {
  width: 100%;
}

.menu-toggle {
  display: none;
  font-size: 1.5rem;
  color: var(--primary-burgundy);
  cursor: pointer;
}

/* Hero Section - Optimized */
.hero {
  height: 100vh;
  background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), url('images/saga1.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--light-text);
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-content {
  max-width: 600px;
  text-align: center;
  margin: 0 auto;
  padding: 0 var(--standard-spacing);
}

.hero-content h2 {
  font-size: clamp(2rem, 8vw, 3.5rem);
  margin-bottom: 1.5rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.hero-content p {
  font-size: clamp(1rem, 3vw, 1.2rem);
  margin-bottom: 2rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Features & Cards - Grid Layout */
.features .container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--large-spacing);
}

/* Common Card Styling */
.feature,
.product,
.testimonial {
  background-color: #F8F3EB;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow-light);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.feature {
  text-align: center;
  padding: var(--large-spacing);
}

.feature:hover,
.product:hover {
  transform: translateY(-10px);
}

/* Icon Styling */
.feature-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--light-text);
  font-size: 1.8rem;
}

/* Product Grid & Card Styling */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--large-spacing);
  margin-top: 3rem;
}

.featured-products {
  background-color: #F8F3EB;
}

/* Product Image Container */
.product-image {
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product:hover .product-image img {
  transform: scale(1.05);
}

.product h3, 
.product p {
  padding: 0 1.5rem;
}

.product h3 {
  margin-top: 1.5rem;
  color: var(--primary-burgundy);
}

.product p {
  color: var(--gray-text);
  padding-bottom: 1.5rem;
}

/* Testimonials Section */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--large-spacing);
  margin-top: 3rem;
}

.testimonial {
  padding: var(--large-spacing);
  position: relative;
}

.testimonial::before {
  content: '"';
  position: absolute;
  top: 10px;
  left: 15px;
  font-size: 5rem;
  color: var(--primary-peach);
  opacity: 0.2;
  font-family: 'Georgia', serif;
  line-height: 1;
}

.quote {
  font-style: italic;
  margin-bottom: var(--standard-spacing);
  position: relative;
  z-index: 1;
}

.client {
  font-weight: 600;
  color: var(--primary-rust);
}

/* CTA Section */
.cta {
  color: var(--light-text);
  text-align: center;
}

.cta-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 var(--standard-spacing);
}

.cta h2 {
  font-size: clamp(2rem, 6vw, 2.8rem);
}

.cta p {
  font-size: clamp(1rem, 3vw, 1.2rem);
  margin-bottom: var(--large-spacing);
}

/* Footer - Simplified */
footer {
  background-color: var(--dark-text);
  color: var(--light-text);
  padding: 5rem 0 2rem;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-logo h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  text-align: left;
  margin-bottom: 0.5rem;
  color: var(--primary-peach);
}

.footer-logo p,
.footer-section p {
  color: var(--light-gray);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.footer-info {
  display: flex;
  flex-wrap: wrap;
  gap: 3rem;
}

.footer-section h3 {
  color: var(--primary-coral);
  margin-bottom: 1.2rem;
  font-size: 1.2rem;
}

/* Address Styling */
address {
  font-style: normal;
  color: var(--light-gray);
  font-size: 0.9rem;
}

address p {
  margin-bottom: 0.5rem;
}

/* Social Icons */
.social-icons {
  display: flex;
  gap: 1rem;
  font-size: 1.5rem;
}

.social-icons a {
  color: var(--light-gray);
  transition: color 0.3s ease;
}

.social-icons a:hover,
.social-icons a:focus {
  color: var(--primary-peach);
}

.copyright {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
  color: var(--light-gray);
}

/* Page Header - Dynamic Positioning */
.page-header {
  height: 40vh;
  min-height: 300px;
  background-size: cover;
  background-position: center;
  color: var(--light-text);
  display: flex;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
  /* Removed the !important rule to allow JS to adjust this */
}

/* Breadcrumb Navigation */
.breadcrumb-container {
  background-color: rgba(242, 234, 224, 0.9);
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 5;
  /* Removed fixed margin-top to allow JS to dynamically adjust this */
}

.breadcrumb {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
}

.breadcrumb-item {
  display: inline-block;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  color: var(--gray-text);
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  display: inline-block;
  margin: 0 0.5rem;
  color: var(--primary-rust);
}

.breadcrumb-item a {
  color: var(--primary-burgundy);
}

.breadcrumb-item a:hover,
.breadcrumb-item a:focus {
  color: var(--primary-coral);
}

.breadcrumb-item.active {
  color: var(--primary-coral);
}

/* Sobre Nosotros Page */
.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.about-image {
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow-medium);
}

.about-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  border-radius: var(--border-radius);
}

/* Timeline */
.timeline {
  margin-top: 4rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.year {
  font-weight: 700;
  color: var(--primary-burgundy);
  font-size: 1.5rem;
  text-align: right;
}

/* Team Section */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--large-spacing);
  margin-top: 3rem;
}

.team-member {
  text-align: center;
}

.member-image {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 1.5rem;
  border: 5px solid var(--primary-peach);
}

.member-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.member-name {
  color: var(--primary-burgundy);
  margin-bottom: 0.5rem;
}

.member-title {
  color: var(--primary-coral);
  font-style: italic;
  margin-bottom: var(--standard-spacing);
}

/* Admin Related Styles */
.admin-link {
  color: var(--primary-burgundy);
  font-weight: 500;
}

.admin-link i {
  margin-right: 5px;
}

/* Login Form Styling */
.login-container {
  max-width: 400px;
  margin: 150px auto 50px;
  padding: 30px;
  background-color: #F8F3EB;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow-light);
}

.login-form h2 {
  color: var(--primary-burgundy);
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.form-group input:focus {
  border-color: var(--primary-coral);
  outline: none;
}

.error-message {
  color: #e74c3c;
  font-size: 14px;
  margin-top: 5px;
  display: none;
}

/* Admin Panel Styling */
.admin-panel {
  margin-top: 100px;
  padding: 30px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.admin-section {
  background-color: #F8F3EB;
  border-radius: var(--border-radius);
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: var(--box-shadow-light);
}

.admin-section h2 {
  color: var(--primary-burgundy);
  font-size: 1.8rem;
  text-align: left;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ddd;
}

.admin-form-group {
  margin-bottom: 25px;
}

.admin-form-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 500;
}

.admin-form-group input[type="text"],
.admin-form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}

.admin-form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.image-preview {
  margin-top: 15px;
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 5px;
  background-color: #f9f9f9;
}

.image-preview img {
  max-width: 100%;
  max-height: 200px;
  margin: 0 auto;
}

/* Button Variations */
.save-btn {
  background-color: var(--primary-coral);
  color: white;
  padding: 12px 25px;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
  border: none;
}

.save-btn:hover,
.save-btn:focus {
  background-color: var(--primary-burgundy);
}

.logout-btn {
  background-color: #f1c40f;
  color: #333;
  padding: 8px 15px;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s;
  border: none;
}

.logout-btn:hover,
.logout-btn:focus {
  background-color: #e67e22;
  color: white;
}

/* Login Button */
.login-btn, 
input[type="submit"].login-btn,
button.login-btn,
a.login-btn {
  width: 100%;
  padding: 12px;
  background-color: var(--primary-coral);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
  text-align: center;
  display: inline-block;
  text-decoration: none;
}

.login-btn:hover,
input[type="submit"].login-btn:hover,
button.login-btn:hover,
a.login-btn:hover,
.login-btn:focus,
input[type="submit"].login-btn:focus,
button.login-btn:focus,
a.login-btn:focus {
  background-color: var(--primary-burgundy);
}

/* Accessibility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Focus states for accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--primary-coral);
  outline-offset: 2px;
}

/* Media Queries - Consolidated and Improved */
@media (max-width: 992px) {
  .about-content {
    grid-template-columns: 1fr;
  }
  
  section {
    padding: 3rem 0;
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }
  
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    flex-direction: column;
    background-color: var(--light-cream);
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  }
  
  .nav-links.active {
    max-height: 300px;
  }
  
  .nav-links a {
    display: block;
    padding: 15px;
    text-align: center;
  }
  
  .footer-content {
    flex-direction: column;
  }
  
  .footer-info {
    flex-direction: column;
    gap: 2rem;
  }
  
  .breadcrumb-container {
    padding: 0.5rem 0;
    /* Removed fixed margin-top to allow JS to adjust this */
  }
  
  .breadcrumb-item {
    font-size: 0.8rem;
  }
  
  .page-header {
    min-height: 30vh;
    /* Let the JavaScript handle the margin-top */
  }
}

@media (max-width: 480px) {
  .page-header {
    min-height: 25vh;
  }
  
  .container {
    width: 95%;
    padding: 0 15px;
  }
  
  .hero-content h2 {
    font-size: 2rem;
  }
  
  .products-grid,
  .features .container,
  .testimonials-grid {
    grid-template-columns: 1fr;
  }
}

/* Print styles for better paper output */
@media print {
  .navbar,
  .menu-toggle,
  .breadcrumb-container,
  .cta,
  footer {
    display: none;
  }
  
  body {
    background-color: white;
    font-size: 12pt;
  }
  
  .container {
    width: 100%;
    max-width: none;
  }
  
  a {
    text-decoration: underline;
    color: black;
  }
  
  .page-header {
    height: auto;
    min-height: 0;
    padding: 20px 0;
    margin: 0 !important;
  }
  
  img {
    max-width: 100% !important;
  }
  
  h2 {
    font-size: 18pt;
    margin-top: 20px;
  }
  
  p {
    orphans: 3;
    widows: 3;
  }
}