/* =========================================================
   United Wire & Steel Industries — main stylesheet
   Palette sampled directly from the company logo:
   navy #212B5F and red #DE2F2B. Light, dependency-free, mobile-first.
========================================================= */

:root {
  --primary: #212b5f;
  --primary-light: #2e3b78;
  --accent: #de2f2b;
  --accent-dark: #b8241f;
  --accent-tint: #fdecea;
  --accent-tint-border: #f8cfce;
  --wa-green: #25d366;
  --wa-green-dark: #1ea952;
  --bg-light: #f8fafc;
  --bg-white: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 10px;
  --header-h: 68px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text-dark);
  background: var(--bg-light);
  line-height: 1.65;
  padding-top: var(--header-h);
  text-align: justify;
}
/* Justify is set on body and relied on via inheritance, so sections that
   explicitly center their own text (hero, CTA banners, stat cards, etc.)
   are unaffected — only flowing paragraph copy without their own
   text-align gets justified. */

img { max-width: 100%; display: block; }
a { color: inherit; }

/* ---------- Header & Nav ---------- */
header.site-header {
  background: var(--primary);
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 100;
  box-shadow: 0 1px 6px rgba(0,0,0,0.15);
}
.nav-container {
  max-width: 1140px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-decoration: none;
  white-space: nowrap;
}
.logo img { flex-shrink: 0; border-radius: 4px; }

nav.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
nav.main-nav a {
  color: #94a3b8;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 6px;
  text-decoration: none;
  transition: 0.15s;
}
nav.main-nav a.active,
nav.main-nav a:hover {
  color: #fff;
  background: var(--primary-light);
}
nav.main-nav a.nav-cta {
  background: var(--wa-green);
  color: #fff;
  margin-left: 6px;
}
nav.main-nav a.nav-cta:hover { background: var(--wa-green-dark); }

/* ---------- Products dropdown ---------- */
.nav-dropdown { position: relative; }
.nav-dropdown .caret { font-size: 0.6em; margin-left: 3px; vertical-align: 1px; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--primary-light);
  border-radius: 8px;
  padding: 6px;
  min-width: 210px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
  z-index: 200;
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-menu a {
  display: block;
  padding: 9px 14px;
  white-space: nowrap;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 6px 10px;
}

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  nav.main-nav {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--primary-light);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  nav.main-nav.open { max-height: 400px; }
  nav.main-nav a {
    padding: 14px 20px;
    border-radius: 0;
    border-bottom: 1px solid rgba(255,255,255,0.12);
  }
  nav.main-nav a.nav-cta { margin: 8px 20px; border-radius: 6px; border-bottom: none; text-align: center; }

  .nav-dropdown { position: static; }
  .dropdown-menu {
    display: block;
    position: static;
    background: rgba(0,0,0,0.15);
    box-shadow: none;
    padding: 0;
    border-radius: 0;
  }
  .dropdown-menu a {
    padding: 12px 20px 12px 36px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 0.88rem;
    font-weight: 500;
    color: #cbd5e1;
  }
}

/* ---------- Layout ---------- */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 40px 20px;
}
.container.narrow { max-width: 820px; }

section + section { margin-top: 48px; }

h1, h2, h3, h4 { color: var(--primary); line-height: 1.3; }
h2 { font-size: 1.7rem; margin-bottom: 8px; }
h2.section-title { text-align: center; }
.section-lead {
  text-align: center;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 28px;
}
p { color: var(--text-dark); }
p.muted { color: var(--text-muted); }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: #fff;
  padding: 64px 30px;
  border-radius: var(--radius);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-banner {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(33,43,95,0.85) 0%, rgba(46,59,120,0.82) 100%);
}
.hero-banner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-content {
  position: relative;
  z-index: 1;
}
.hero .eyebrow {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.hero h1 {
  color: #fff;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  margin-bottom: 14px;
}
.hero p {
  color: #94a3b8;
  max-width: 680px;
  margin: 0 auto 26px;
  font-size: 1.05rem;
}
.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.page-header {
  background: var(--primary);
  color: #fff;
  padding: 44px 30px;
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: 8px;
}
.page-header h1 { color: #fff; font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin-bottom: 8px; }
.page-header p { color: #94a3b8; max-width: 620px; margin: 0 auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-wa { background: var(--wa-green); color: #fff; }
.btn-wa:hover { background: var(--wa-green-dark); }
.btn-outline { background: transparent; color: #fff; border: 1px solid #475569; }
.btn-outline:hover { background: rgba(255,255,255,0.08); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }

/* ---------- Cards & Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card h3 { margin-bottom: 10px; font-size: 1.1rem; }
.card .icon {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-tint);
  border-radius: 8px;
  margin-bottom: 14px;
  color: var(--accent);
}
.card ul { margin: 12px 0 0 20px; font-size: 0.92rem; color: var(--text-muted); }
.card ul li { margin-bottom: 4px; }
.card .tag {
  display: inline-block;
  background: var(--accent-tint);
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}

/* ---------- Stats strip ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
}
.stats .stat b { display: block; font-size: 1.6rem; color: var(--accent); }
.stats .stat span { color: var(--text-muted); font-size: 0.85rem; }

/* ---------- Table / Estimator ---------- */
table { width: 100%; border-collapse: collapse; margin-top: 15px; }
th, td { border: 1px solid var(--border); padding: 10px; text-align: left; font-size: 0.92rem; }
th { background: #f1f5f9; font-weight: 700; color: var(--primary); }
.table-wrap { overflow-x: auto; }

/* On narrow screens, restack the estimator table into labeled cards
   instead of relying on hidden horizontal scroll (easy to miss on mobile). */
@media (max-width: 700px) {
  #calcTable thead { display: none; }
  #calcTable, #calcTable tbody, #calcTable tr, #calcTable td { display: block; width: 100%; }
  #calcTable { border: none; margin-top: 12px; }
  #calcTable tbody tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 14px;
    margin-bottom: 14px;
    background: var(--bg-white);
  }
  #calcTable tbody td {
    border: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
  }
  #calcTable tbody td:last-child { border-bottom: 0; justify-content: flex-end; padding-top: 6px; padding-bottom: 10px; }
  #calcTable tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--primary);
    font-size: 0.85rem;
    flex-shrink: 0;
  }
  #calcTable tbody td input { width: 130px; }
}

input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.remove-row {
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
}
.remove-row:hover { background: #fecaca; }

.formula-box {
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-border);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 4px;
}

/* ---------- Contact ---------- */
.contact-row { display: flex; gap: 12px; margin-bottom: 14px; align-items: flex-start; }
.contact-row .icon {
  width: 38px; height: 38px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-tint); border-radius: 8px; color: var(--accent);
}
.contact-row div b { display: block; color: var(--primary); }
.contact-row div span, .contact-row div a { color: var(--text-muted); text-decoration: none; }
.map-embed {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 20px;
}
.map-embed iframe { width: 100%; height: 320px; border: 0; display: block; }

/* ---------- Footer ---------- */
footer.site-footer {
  background: var(--primary);
  color: #94a3b8;
  margin-top: 60px;
}
.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 40px 20px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.footer-inner h4 { color: #fff; font-size: 0.95rem; margin-bottom: 12px; }
.footer-brand h4 { margin-bottom: 0; }
.footer-inner p, .footer-inner a { color: #94a3b8; font-size: 0.88rem; text-decoration: none; }
.footer-inner ul { list-style: none; }
.footer-inner ul li { margin-bottom: 8px; }
.footer-inner a:hover { color: #fff; }
.footer-contact-list li { display: flex; align-items: flex-start; gap: 8px; }
.footer-contact-list li svg { flex-shrink: 0; margin-top: 3px; color: var(--accent); }
.footer-bottom {
  border-top: 1px solid var(--primary-light);
  text-align: center;
  padding: 16px 20px;
  font-size: 0.82rem;
}

/* ---------- WhatsApp floating button ---------- */
.wa-float {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--wa-green);
  color: #fff;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  z-index: 90;
  text-decoration: none;
  transition: transform 0.15s;
}
.wa-float:hover { transform: scale(1.08); }

@media (max-width: 600px) {
  .container { padding: 28px 16px; }
  .hero { padding: 44px 20px; }
}

/* ---------- Admin panel utilities ---------- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.92rem;
  font-weight: 600;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; }

.admin-links { list-style: none; }
.admin-links li { margin-bottom: 10px; }
.admin-links a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px;
  text-decoration: none; color: var(--primary); font-weight: 600;
  background: var(--bg-white); transition: 0.15s;
}
.admin-links a:hover { border-color: var(--accent); background: var(--accent-tint); }
.admin-links small { display: block; font-weight: 400; color: var(--text-muted); margin-top: 3px; }

.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.thumb-placeholder {
  width: 56px; height: 56px; border-radius: 6px; border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.7rem; text-align: center;
}
.actions-cell { display: flex; gap: 8px; white-space: nowrap; }
.btn-secondary { background: var(--accent-tint); color: var(--accent-dark); }
.btn-secondary:hover { background: var(--accent-tint-border); }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }
.login-box { max-width: 400px; margin: 60px auto; }
.bullets-help { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
