/* ======================================================
Theme: GeneratePress Child - Liber Hall Publishing
Author: Tom Usborne
Description: Child theme styles
====================================================== */

/* ================== Root Colors ================== */
:root {
  --brand-white: #FFFFFF;
  --brand-light: #F9F9F9;
  --brand-red: #900F0A; /* Brand red */
  --brand-blue: #000000; /* Hover black */
  --brand-dark: #222;
}

/* ================== Topbar ================== */
.topbar {
  background: var(--brand-light);
  color: var(--brand-blue);
  font-size: 13px;
  padding: 6px 20px;
  border-bottom: 1px solid #eee;
}
.topbar:after {
  content: "";
  display: table;
  clear: both;
}
.topbar .topbar-left {
  float: left;
  font-size: 14px;
  color: var(--brand-dark);
}
.topbar .topbar-right {
  float: right;
}
.topbar .topbar-right .topbar-link {
  color: var(--brand-blue);
  margin-left: 15px;
  font-weight: bold;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.3s ease;
  font-size: 14px;
}
.topbar .topbar-right .topbar-link:hover {
  color: var(--brand-red);
}
.topbar .topbar-right .wishlist-count,
.topbar .topbar-right .cart-count {
  background: var(--brand-red);
  color: var(--brand-white);
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 12px;
}

/* ================== Header ================== */
.custom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 20px;
  background: var(--brand-white);
  flex-wrap: nowrap;
}
.header-left img {
  max-height: 80px;
  width: auto;
  display: block;
}
.header-center {
  flex: 1 1 400px;
  display: flex;
  justify-content: center;
  max-width: 600px;
  margin: 0 20px;
}
.header-center input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
}
.header-right {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}
.header-account {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.account-btn {
  background: var(--brand-red);
  color: var(--brand-white);
  padding: 6px 14px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
  transition: 0.3s ease;
}
.account-btn:hover {
  background: var(--brand-blue);
}
.signin-text {
  font-size: 13px;
  color: var(--brand-dark);
  margin-top: 2px;
}
.signin-text a {
  color: var(--brand-red);
  text-decoration: none;
}
.signin-text a:hover {
  text-decoration: underline;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
}

/* ================== Buttons ================== */
button,
.button,
.wp-block-button__link,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce #place_order {
  background: #B81D13; /* Updated brand color */
  color: var(--brand-white);
  border: none;
  border-radius: 0;
  padding: 10px 20px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
button:hover,
.button:hover,
.wp-block-button__link:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce #respond input#submit:hover,
.woocommerce #place_order:hover {
  background: #B81D13; /* Updated brand color */
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(144, 15, 10, 0.25);
}

/* ================== WooCommerce Products ================== */
.woocommerce div.quantity .qty,
.woocommerce div.quantity .plus,
.woocommerce div.quantity .minus {
  border: 1px solid var(--brand-red);
  color: var(--brand-blue);
  background: var(--brand-white);
  transition: all 0.3s ease;
}
.woocommerce div.quantity .plus:hover,
.woocommerce div.quantity .minus:hover {
  background: var(--brand-red);
  color: var(--brand-white);
}
.woocommerce ul.products li.product {
  background: var(--brand-light);
  border-radius: 0;
  padding: 15px;
  text-align: center;
  transition: box-shadow 0.3s ease;
}
.woocommerce ul.products li.product:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}
.woocommerce ul.products li.product .woocommerce-loop-product__title {
  color: var(--brand-dark);
  font-size: 12px;
  margin-top: 10px;
}
.woocommerce-breadcrumb a:hover,
.woocommerce a:hover {
  color: var(--brand-red);
}
.woocommerce span.onsale {
  background-color: var(--brand-red);
  color: var(--brand-white);
}

/* ================== Footer ================== */
.custom-footer {
  background: var(--brand-red);
  color: var(--brand-white);
  padding: 30px 20px;
  font-family: Arial, sans-serif;
}
.custom-footer a {
  color: var(--brand-white);
  text-decoration: none;
  transition: 0.3s ease;
}
.custom-footer a:hover {
  color: var(--brand-blue);
}
.footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
}
.footer-about,
.footer-links,
.footer-social {
  flex: 1 1 200px;
  min-width: 200px;
}
.footer-about h3,
.footer-links h3,
.footer-social h3 {
  margin-bottom: 10px;
  color: var(--brand-white);
}
.footer-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-links ul li {
  margin-bottom: 6px;
}
.footer-social a {
  margin-right: 10px;
}
.footer-bottom {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--brand-white);
}

/* ================== Responsive ================== */
@media (max-width: 768px) {
  .custom-header {
    flex-wrap: wrap;
    justify-content: center;
  }
  .header-center {
    order: 2;
    width: 100%;
    margin: 10px 0;
  }
  .header-right {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 15px;
  }
  .menu-toggle {
    display: block;
  }
  .header-account {
    flex-direction: row;
    justify-content: center;
    gap: 10px;
  }
  .main-navigation .main-nav ul {
    display: none;
    flex-direction: column;
    width: 100%;
  }
  .main-navigation.toggled ul {
    display: flex;
  }
  .footer-container {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }
  .footer-social a {
    display: inline-block;
    margin: 5px 5px 0 0;
  }
}

/* ================== Misc & Utilities ================== */
.fallback-search {
  width: 100%;
  max-width: 500px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}
button,
input,
textarea,
select,
.wp-block-button__link,
.woocommerce a.button,
.woocommerce ul.products li.product {
  border-radius: 0 !important;
}
.avatar,
img.circle {
  border-radius: 50% !important;
}

/* ================== Animations ================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== Topbar Responsive ==================== */
@media (max-width: 1024px) {
  .topbar {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 15px;
  }
  .topbar .topbar-left,
  .topbar .topbar-right {
    float: none;
    margin: 5px 0;
  }
  .topbar .topbar-right .topbar-link {
    font-size: 13px;
    gap: 4px;
  }
}

/* ==================== Header Responsive ==================== */
@media (max-width: 1024px) {
  .custom-header {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    gap: 10px;
    padding: 10px 15px;
  }
  .header-left img {
    max-height: 50px;
    margin: 0 auto;
  }
  .header-center {
    order: 2;
    flex: 1 1 100%;
    max-width: 90%;
    margin: 10px 0;
  }
  .header-center input[type="text"] {
    width: 100%;
  }
  .header-right {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .header-account {
    flex-direction: row;
    justify-content: center;
    gap: 8px;
  }
}

/* ==================== Mobile Menu Toggle ==================== */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }
  .main-navigation .main-nav ul {
    display: none;
    flex-direction: column;
    width: 100%;
  }
  .main-navigation.toggled ul {
    display: flex;
  }
  .main-navigation .main-nav ul li a {
    padding: 10px;
    border-bottom: 1px solid #e7e7e7;
    text-align: center;
  }
}

/* ===== Center Main Navigation Menu ===== */
.main-navigation {
  background: var(--brand-white);
  text-align: center;
  padding: 10px 0;
}
.main-navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center; /* Centers menu items */
  gap: 20px;
  flex-wrap: wrap;
}
.main-navigation ul li a {
  color: var(--brand-blue);
  text-decoration: none;
  padding: 5px 10px;
  display: inline-block;
}
.main-navigation ul li a:hover {
  color: var(--brand-red);
}

/* ===== Toggle Button for Mobile ===== */
.menu-toggle {
  display: none;
  background: #B81D13; /* Updated brand color */
  color: var(--brand-white);
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin: 10px auto;
}

/* ===== Responsive Menu ===== */
@media (max-width: 768px) {
  .main-navigation ul {
    display: none;
    flex-direction: column;
    width: 100%;
    margin-top: 10px;
  }
  .main-navigation.active ul {
    display: flex;
  }
  .menu-toggle {
    display: block;
  }
}

/* ===== Product Buttons ===== */
.product-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0;
}
.product-buttons .button {
  margin: 5px 0;
  display: inline-block;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  background: #B81D13; /* Updated brand color */
  color: var(--brand-white);
  font-size: 13px;
}
.product-buttons .button:hover {
  background: var(--brand-blue);
  color: var(--brand-white);
}

/* ===== Badge ===== */
.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--brand-red);
  color: var(--brand-white);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: bold;
  border-radius: 3px;
}

/* ===== Product Hover Overlay ===== */
.product-hover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(144, 15, 10, 0.5); /* semi-transparent brand red */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}
.product-hover .hover-btn {
  background: var(--brand-red);
  color: var(--brand-white);
  padding: 6px 12px;
  margin: 5px 0;
  text-decoration: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  display: inline-block;
}
.product-hover .hover-btn:hover {
  background: var(--brand-blue);
  color: var(--brand-white);
}

/* Make custom top bar sticky */
.topbar {
  position: sticky;
  top: 0;
  z-index: 9999;
}

/* Hide Page Titles */
.woocommerce-page .entry-title,
.home .entry-title,
.page-id-62 .entry-title,
.page-id-342 .entry-title,
.page-id-5929 .entry-title,
.page-id-621 .entry-title,
.page-id-622 .entry-title,
.page-id-6775 .entry-title,
.page-id-6786 .entry-title,
.page-id-393 .entry-title,
.page-id-9 .entry-title {
  display: none;
}

/* Single Product Styles */
.single-product p strong {
  color: #003A54; /* brand color */
  font-weight: 600;
}
.single-product img {
  border: 1px solid #ccc;
  padding: 5px;
  margin-top: 10px;
}

/* ACF Book Table */
.acf-book-table td {
  vertical-align: top;
}
.acf-book-table tr:nth-child(even) {
  background-color: #f9f9f9;
}
.acf-book-table img {
  border: 1px solid #ccc;
  padding: 5px;
}

/* Sell Your Book Page (Page ID 6040) */
.page-id-6040 .sell-your-book-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  text-align: center;
}
.page-id-6040 h2 {
  color: #003A54;
  margin-bottom: 10px;
}
.page-id-6040 .vendor-links p {
  margin: 10px 0;
}
.page-id-6040 .vendor-btn,
.page-id-6040 .submit-book-btn {
  display: inline-block;
  background: #003A54;
  color: #fff;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  transition: 0.3s;
}
.page-id-6040 .vendor-btn:hover,
.page-id-6040 .submit-book-btn:hover {
  background: #005580;
}
.page-id-6040 .instructions {
  text-align: left;
  margin-top: 20px;
}
.page-id-6040 ol {
  padding-left: 20px;
}

.yith-wcwl-add-to-wishlist a:hover,
.yith-wcwl-add-to-wishlist button:hover {
  background-color: var(--gp-button-background-hover, #003A54);
  color: var(--gp-button-text-hover, #fff);
}
.yith-wcwl-add-to-wishlist a:before,
.yith-wcwl-add-to-wishlist button:before {
  font-size: 16px !important;
  margin-right: 5px;
  vertical-align: middle;
}

/* Centered WooCommerce Forms */
.custom-woocommerce-form-wrapper {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  min-height: 100vh;
  width: 100%;
  background-color: #fff;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.woocommerce-form.register,
.woocommerce-form.login {
  background-color: #ffffff;
  padding: 40px 30px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  max-width: 450px;
  width: 100%;
  font-family: 'Arial', sans-serif;
  text-align: left;
}
.woocommerce-form.register h2,
.woocommerce-form.login h2 {
  text-align: center;
  font-size: 26px;
  margin-bottom: 25px;
  color: #B81D13;
}
@media (max-width: 768px) {
  .custom-woocommerce-form-wrapper {
    display: block;
    padding: 40px 20px;
  }
  .woocommerce-form.register,
  .woocommerce-form.login {
    margin: 0 auto;
  }
}

/* Input Field Sizes */
.woocommerce-form.register input.input-text,
.woocommerce-form.register input[type="password"],
.woocommerce-form.register input[type="email"],
.woocommerce-form.login input.input-text,
.woocommerce-form.login input[type="password"],
.woocommerce-form.login input[type="email"] {
  width: 100% !important;
  padding: 12px 15px !important;
  box-sizing: border-box !important;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid #000;
  color: #000;
}
.woocommerce-form.register input:focus,
.woocommerce-form.login input:focus {
  border-color: #B81D13;
  box-shadow: 0 0 5px rgba(184,29,19,0.3);
  outline: none;
}

/* Unified Input Fields */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  background-color: #fff !important;
  color: #000 !important;
  border: 1px solid #ddd !important;
  border-radius: 6px !important;
  padding: 10px 14px !important;
  font-size: 15px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  border-color: #B81D13 !important;
  box-shadow: 0 0 5px rgba(184, 29, 19, 0.2);
  outline: none;
}
body input,
body textarea,
body select {
  border-radius: 6px !important;
}
.header-center input[type="text"] {
  border-radius: 6px;
  border: 1px solid #fff;
  padding: 10px 14px;
}
.woocommerce-form input.input-text,
.woocommerce-form input[type="password"],
.woocommerce-form input[type="email"] {
  border-radius: 6px;
  border: 1px solid #ddd;
  padding: 10px 14px;
}

/* Mega Menu */
.mega-menu {
  position: relative;
}
.mega-menu > .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 9999;
  width: auto;
  min-width: 400px;
}
.mega-menu:hover > .sub-menu {
  display: block;
}
.mega-menu .sub-menu {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 20px;
  row-gap: 10px;
}
.mega-menu .sub-menu li {
  list-style: none;
  position: relative;
}
.mega-menu .sub-menu li a {
  display: block;
  padding: 5px 0;
  color: #333;
  text-decoration: none;
}
.mega-menu .sub-menu li a:hover {
  color: #0073aa;
}
.mega-menu .sub-menu li .sub-menu {
  display: none;
  position: absolute;
  top: 0;
  left: 100%;
  background: #f9f9f9;
  padding: 10px;
  min-width: 180px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.mega-menu .sub-menu li:hover > .sub-menu {
  display: block;
}
@media (max-width: 1024px) {
  .mega-menu > .sub-menu {
    position: static;
    display: block !important;
    grid-template-columns: 1fr;
    box-shadow: none;
    padding: 10px 0;
  }
  .mega-menu .sub-menu li .sub-menu {
    position: static;
    width: 100%;
    box-shadow: none;
    padding-left: 20px;
  }
}
/* Submenu styling */
.main-navigation ul ul {
  display: none;
  position: absolute;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  padding: 15px 0;
  top: 100%; /* ensures submenu appears directly below parent */
  left: 0;
  z-index: 9999; /* prevents it from being hidden behind other elements */
}

/* Show submenu on hover */
.main-navigation ul li:hover > ul,
.main-navigation ul li:focus-within > ul {
  display: block;
}

/* Center submenu items below parent */
.main-navigation ul ul li {
  text-align: left;
  white-space: nowrap; /* prevent text wrapping */
}

/* Prevent flicker when moving mouse */
.main-navigation ul li {
  position: relative;
}

.main-navigation ul li:hover > a,
.main-navigation ul li:focus-within > a {
  color: #900F0A;
}

/* Remove border between header and navigation */
.main-navigation {
  border-top: none !important;
}
