/* =====================================================
   SAIBOT METALÚRGICA - Estilos del sitio público
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #1b3464;
  --primary-d: #122347;
  --accent:    #c8960a;
  --text:      #333;
  --text-light:#666;
  --bg:        #f4f4f4;
  --white:     #fff;
  --border:    #ddd;
  --shadow:    0 2px 8px rgba(0,0,0,.12);
  --radius:    4px;
}

body {
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.site-wrapper { max-width: 1100px; margin: 0 auto; background: transparent; }

.main-content {
  background: var(--bg);
  min-height: 300px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }

img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Banners ── */
.banner-top { width: 100%; background: #fff; line-height: 0; }
.banner-top a { display: block; line-height: 0; }
.banner-top img { width: 100%; height: auto; display: block; }
.banner-bottom { width: 100%; background: #fff; line-height: 0; }
.banner-bottom a { display: block; line-height: 0; }
.banner-bottom img { width: 100%; height: auto; display: block; }

/* ── Navegación ── */
.main-nav {
  background: #e8e8e8;
  position: sticky; top: 0; z-index: 900;
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
  border-bottom: 2px solid #c8c8c8;
}
.main-nav .container { display: flex; align-items: center; justify-content: center; min-height: 48px; }
.nav-menu { list-style: none; display: flex; gap: 0; }
.nav-menu > li { position: relative; }
.nav-menu > li > a {
  display: block; padding: 14px 18px;
  color: #2a2a2a; font-size: 14px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  transition: background .2s;
}
.nav-menu > li > a:hover,
.nav-menu > li > a.active { background: var(--accent); color: #fff; }

/* Dropdown */
.has-dropdown:hover .dropdown { display: block; }
.dropdown {
  display: none;
  position: absolute; top: 100%; left: 0; min-width: 240px;
  background: #f0f0f0; list-style: none;
  box-shadow: var(--shadow); z-index: 1000;
  border: 1px solid #d0d0d0;
}
.dropdown li a { display: block; padding: 10px 18px; color: #333; font-size: 13px; border-bottom: 1px solid rgba(0,0,0,.07); }
.dropdown li a:hover { background: var(--accent); color: #fff; }

/* Toggle móvil */
.nav-toggle {
  display: none; background: none; border: none;
  color: #333; font-size: 22px; cursor: pointer; padding: 8px;
}

/* ── Alertas ── */
.alert {
  padding: 14px 18px; margin: 14px 0;
  border-radius: 8px; font-size: 14px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert p { margin: 0; line-height: 1.5; }
.alert-success {
  background: #edfaf1; color: #1a6e38;
  border-left: 4px solid #28a745;
  box-shadow: 0 2px 8px rgba(40,167,69,.12);
}
.alert-success::before { content: '✓'; font-weight: 900; font-size: 16px; margin-top: 1px; }
.alert-error {
  background: #fff5f5; color: #8b1a1a;
  border-left: 4px solid #dc3545;
  box-shadow: 0 2px 8px rgba(220,53,69,.12);
}
.alert-error::before { content: '⚠'; font-size: 16px; margin-top: 1px; }

/* ── Contenido principal ── */
.main-content { background: #e8e8e8; min-height: 400px; padding: 30px 0; }

.page-title {
  font-size: 26px; font-weight: 700; color: var(--primary);
  margin-bottom: 20px; padding-bottom: 10px;
  border-bottom: 3px solid var(--accent);
}
.section-subtitle { font-size: 20px; color: var(--text-light); margin-bottom: 16px; }

/* ── Home ── */
.home-featured { text-align: center; margin: 20px 0 30px; }
.home-catalog-img {
  max-width: 100%; width: 100%; height: auto; display: block; margin: 0 auto;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.home-categories { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 24px; margin-top: 30px; }
.home-category-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  text-align: center;
}
.home-category-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.home-category-card a { display: block; padding: 20px; }
.home-category-card img { margin: 0 auto 12px; max-height: 160px; object-fit: contain; }
.home-category-card h3 { color: var(--primary); font-size: 15px; font-weight: 700; }

/* ── Productos ── */
.products-categories-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 28px; margin-top: 20px; }
.product-category-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .2s;
}
.product-category-card:hover { transform: translateY(-4px); }
.product-category-card > a { display: block; }
.product-category-img { background: var(--bg); padding: 20px; text-align: center; min-height: 180px; display: flex; align-items: center; justify-content: center; }
.product-category-img img { max-height: 160px; object-fit: contain; margin: 0 auto; }
.product-category-info { padding: 18px 20px; }
.product-category-info h2 { font-size: 17px; color: var(--primary); margin-bottom: 8px; }
.product-category-info p { font-size: 13px; color: var(--text-light); margin-bottom: 14px; }
.btn-ver { color: var(--accent); font-weight: 700; font-size: 13px; }

/* ── Categoría de producto (tabla) ── */
.breadcrumb { font-size: 13px; color: var(--text-light); margin-bottom: 16px; }
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { color: var(--accent); }

.category-description { display: flex; gap: 24px; align-items: flex-start; margin-bottom: 28px; flex-wrap: wrap; }
.category-main-img { max-width: 220px; border: 1px solid var(--border); border-radius: var(--radius); }
.category-desc-text p { margin-bottom: 10px; font-size: 14px; }

.products-table-wrapper { overflow-x: auto; }
.products-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.products-table thead { background: var(--primary); color: #fff; }
.products-table th, .products-table td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; }
.products-table tbody tr:nth-child(even) { background: #f9f9f9; }
.products-table tbody tr:hover { background: #eef3fb; }
.prod-code { font-weight: 700; white-space: nowrap; }
.prod-measures { font-size: 13px; color: var(--text-light); white-space: nowrap; }
.product-thumb { max-width: 100px; max-height: 80px; object-fit: contain; cursor: zoom-in; border: 1px solid var(--border); border-radius: 2px; }

/* ── Galería ── */
.gallery-categories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 24px; margin-top: 20px; }
.gallery-category-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--white); box-shadow: var(--shadow); transition: transform .2s; }
.gallery-category-card:hover { transform: translateY(-3px); }
.gallery-category-thumb { height: 180px; overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.gallery-category-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-placeholder { color: var(--text-light); font-size: 13px; }
.gallery-category-info { padding: 14px; }
.gallery-category-info h3 { font-size: 15px; font-weight: 700; color: var(--primary); }
.gallery-count { font-size: 13px; color: var(--text-light); }
.gallery-subtitle { color: var(--text-light); font-size: 13px; margin-bottom: 8px; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 14px; margin-top: 20px; }
.gallery-item { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.gallery-item-thumb { height: 150px; overflow: hidden; background: var(--bg); }
.gallery-item-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery-item:hover .gallery-item-thumb img { transform: scale(1.05); }
.gallery-link { display: block; }
.gallery-item-title { font-size: 12px; color: var(--text-light); padding: 6px 8px; text-align: center; }
.empty-message { color: var(--text-light); padding: 20px 0; }

/* ── Lightbox ── */
.lightbox {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.75); z-index: 9999;
  align-items: center; justify-content: center;
}
.lightbox.active { display: flex; }
.lightbox-content {
  max-width: 90vw; max-height: 90vh; text-align: center; position: relative;
  background: #f0f0f0; border-radius: 6px; padding: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.lightbox-content img { max-width: 100%; max-height: 80vh; border-radius: 2px; display: block; margin: 0 auto; }
.lightbox-caption { color: #333; margin-top: 10px; font-size: 14px; font-weight: 600; }
.lightbox-close {
  position: absolute; top: 6px; right: 10px;
  background: none; border: none; color: #333; font-size: 30px; cursor: pointer; z-index: 10000;
  line-height: 1; opacity: .7; transition: opacity .2s;
}
.lightbox-close:hover { opacity: 1; }

/* ── Contacto ── */
.contact-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 32px; margin-top: 24px; align-items: start; }

.contact-form-wrapper {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  border-top: 4px solid var(--primary);
  padding: 30px 32px;
}
.contact-form-wrapper h3 {
  font-size: 18px; color: var(--primary); margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}
.contact-form-wrapper h3::before { content: '✉'; font-size: 20px; }

.contact-info {
  background: var(--primary);
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
  padding: 28px 24px;
  color: #fff;
}
.contact-info h3 { font-size: 17px; color: #fff; margin-bottom: 20px; }
.contact-info-item {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 18px; padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.contact-info-item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.contact-info-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.contact-info-text { flex: 1; }
.contact-info-text strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; opacity: .75; margin-bottom: 3px; }
.contact-info-text span, .contact-info-text a { font-size: 14px; color: #fff; font-weight: 600; word-break: break-all; }
.contact-info-text a:hover { color: var(--accent); }

/* ── Inputs modernos ── */
.form-required-note { font-size: 12px; color: var(--text-light); margin-bottom: 20px; background: #f8f9fa; padding: 7px 12px; border-radius: 6px; border-left: 3px solid var(--accent); }
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 6px; color: var(--primary);
}
.form-group input[type=text],
.form-group input[type=email],
.form-group input[type=tel],
.form-group input[type=date],
.form-group input[type=number],
.form-group select,
.form-group textarea {
  width: 100%; padding: 11px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--text);
  background: #fafbfc;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(27,52,100,.10);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.form-group select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231b3464' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; cursor: pointer; }
.field-error { color: #dc3545; font-size: 12px; margin-top: 5px; display: flex; align-items: center; gap: 4px; }
.field-error::before { content: '⚠'; }

.btn-submit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, #2a4a8a 100%);
  color: #fff; border: none;
  font-size: 15px; font-weight: 700; letter-spacing: .3px;
  border-radius: 8px; cursor: pointer;
  transition: transform .15s, box-shadow .2s;
  margin-top: 8px;
}
.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(27,52,100,.35);
}
.btn-submit:active { transform: translateY(0); }
.btn-submit::after { content: '→'; font-size: 18px; }

/* ── CAPTCHA widget ── */
.captcha-widget {
  display: flex; align-items: stretch;
  background: #fff; border: 1px solid #dadce0; border-radius: 8px;
  overflow: hidden; max-width: 370px;
  box-shadow: 0 2px 8px rgba(0,0,0,.10); margin: 18px 0;
}
.captcha-body {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  gap: 10px; padding: 16px 18px;
}
.captcha-label { font-size: 14px; color: #333; margin: 0; }
.captcha-label strong { font-size: 15px; color: #1b3464; }
.captcha-input {
  width: 70px; padding: 7px 10px; text-align: center;
  border: 2px solid #ccc; border-radius: 5px;
  font-size: 16px; font-weight: 700; color: #222;
  transition: border-color .2s;
}
.captcha-input:focus { outline: none; border-color: #1b3464; }
.captcha-brand {
  width: 72px; flex-shrink: 0;
  background: linear-gradient(180deg, #4285f4 0%, #1a73e8 50%, #1557b0 100%);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 12px 8px; gap: 5px;
}
.captcha-brand svg { width: 30px; height: 30px; }
.captcha-brand-name {
  display: block; font-size: 9px; font-weight: 800;
  letter-spacing: 1.5px; text-transform: uppercase; color: rgba(255,255,255,.9);
}
.captcha-privacy {
  display: block; font-size: 8px; color: rgba(255,255,255,.6);
  text-align: center; line-height: 1.5;
}

/* ── Presupuesto form ── */
.presupuesto-form { max-width: 900px; }
.presupuesto-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  border-top: 4px solid var(--primary);
  box-shadow: 0 4px 18px rgba(0,0,0,.08);
  padding: 26px 28px;
  margin-bottom: 24px;
}
.presupuesto-section h3 {
  font-size: 15px; color: var(--primary);
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: .5px;
}
.presupuesto-section h3 small { font-weight: 400; font-size: 12px; color: #888; text-transform: none; letter-spacing: 0; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
@media (max-width: 600px) { .form-grid-2 { grid-template-columns: 1fr; } }
.presupuesto-cat { margin-bottom: 22px; }
.presupuesto-cat h4 { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 6px 10px; background: #f0f4ff; border-radius: 6px; }
.presupuesto-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.presupuesto-code-item { display: flex; flex-direction: column; gap: 5px; }
.presupuesto-code-item label { font-size: 12px; font-weight: 700; color: #444; letter-spacing: .3px; }
.qty-input { width: 80px; padding: 8px; border: 2px solid #e2e8f0; border-radius: 8px; text-align: center; font-size: 14px; font-weight: 600; transition: border-color .2s; }
.qty-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,52,100,.10); }
.presupuesto-actions { display: flex; gap: 12px; margin-top: 10px; }
.btn-reset {
  background: #6c757d; color: #fff; border: none; padding: 12px 24px;
  font-size: 14px; font-weight: 600; border-radius: 8px; cursor: pointer;
  transition: background .2s;
}
.btn-reset:hover { background: #5a6268; }

/* ── Footer ── */
.footer-products { background: #fff; padding: 20px 0; border-top: 1px solid #ddd; }
.footer-products-grid { display: flex; justify-content: center; gap: 30px; flex-wrap: wrap; }
.footer-product-item img { max-height: 80px; object-fit: contain; opacity: .85; transition: opacity .2s; }
.footer-product-item img:hover { opacity: 1; }
.site-footer { background: #fff; color: #666; text-align: center; padding: 14px; font-size: 13px; border-top: 1px solid #ddd; }
.site-footer p { margin: 0; }
.footer-credit { margin-top: 0 !important; font-size: 12px; color: #888; }
.footer-credit a { color: #999; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.footer-credit a:hover { color: #ccc; text-decoration: underline; }
.footer-favicon { width: 14px; height: 14px; display: inline-block; }
.footer-credit a { color: #999; text-decoration: none; }
.footer-credit a:hover { color: #ccc; text-decoration: underline; }

/* ── Página de error ── */
.error-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.error-box { text-align: center; padding: 40px; }
.error-code { font-size: 80px; color: var(--accent); font-weight: 900; }
.error-box h2 { font-size: 24px; margin: 8px 0 16px; }
.btn-home { display: inline-block; padding: 10px 24px; background: var(--primary); color: #fff; border-radius: var(--radius); margin-top: 16px; }

/* ── Página Nosotros ── */
.page-content img { display: block !important; width: 100% !important; max-width: 640px !important; height: auto !important; margin: 24px auto !important; border-radius: var(--radius); }
.page-content p { margin-bottom: 14px; }
.page-content h2 { color: var(--primary); font-size: 22px; margin: 24px 0 10px; }
.page-content ul, .page-content ol { margin: 0 0 14px 1.5rem; padding: 0; }
.page-content li { margin-bottom: 6px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-menu {
    display: none; flex-direction: column; position: absolute; top: 48px; left: 0; right: 0;
    background: #e8e8e8; z-index: 999; border-bottom: 2px solid #c8c8c8;
  }
  .nav-menu.open { display: flex; }
  .dropdown { position: static; box-shadow: none; }
  .has-dropdown:hover .dropdown { display: none; }
  .has-dropdown.open .dropdown { display: block; }

  .contact-layout { grid-template-columns: 1fr; }
  .category-description { flex-direction: column; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); }
}
