/* ==========================================================================
   Trad Market — HelpScout Docs Custom Stylesheet
   Brand alignment for help.tradmarket.com
   ========================================================================== */

/* ---- Design Tokens ---- */
:root {
  --tm-green: #157146;
  --tm-green-light: #44be71;
  --tm-green-dark: #1f211f;
  --tm-success: #157147;
  --tm-green-bg: #dcf4e1;
  --tm-text: #121212;
  --tm-border: #e7e7e7;
  --tm-grey-bg: #eaeaea;
  --tm-grey50: hsl(240, 3%, 98%);
  --tm-white: #ffffff;
  --tm-font-heading: 'Space Grotesk', sans-serif;
  --tm-font-body: 'Inter', sans-serif;
  --tm-radius-btn: 8px;
  --tm-radius-card: 8px;
  --tm-radius-input: 6px;
  --tm-shadow: 0px 8px 16px rgba(0, 0, 0, 0.04);
  --tm-shadow-hover: 0px 8px 24px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   1. Global / Body
   ========================================================================== */

body {
  font-family: var(--tm-font-body);
  color: var(--tm-text);
  background-color: var(--tm-grey50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--tm-green);
  color: var(--tm-white);
}

a {
  color: var(--tm-green);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--tm-green-dark);
  text-decoration: underline;
}

/* ==========================================================================
   2. CTA Banner (injected via head-code.html script)
   ========================================================================== */

#tm-cta-bar {
  background-color: var(--tm-green);
  text-align: center;
  padding: 10px 16px;
  font-family: var(--tm-font-body);
  font-size: 14px;
  font-weight: 500;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  position: relative;
  left: 0;
}

#tm-cta-bar a {
  color: var(--tm-white);
  text-decoration: none;
}

#tm-cta-bar a:hover {
  text-decoration: underline;
  color: var(--tm-white);
}

/* ==========================================================================
   3. Navigation Bar
   ========================================================================== */

#mainNav,
.navbar {
  background-color: var(--tm-white) !important;
  border-bottom: 1px solid var(--tm-border);
  box-shadow: none;
}

.navbar .navbar-inner,
.navbar-inner {
  min-height: 68px !important;
  padding: 0 24px !important;
  background: var(--tm-white) !important;
  box-shadow: none !important;
  border: none !important;
}

#tm-back-link {
  font-family: var(--tm-font-body);
  font-weight: 400;
  font-size: 13px;
  color: #666 !important;
  text-decoration: none;
  margin-left: 16px;
  float: left;
  line-height: 68px;
}

#tm-back-link:hover {
  color: var(--tm-green) !important;
  text-decoration: underline;
}

.navbar .nav li a {
  font-family: var(--tm-font-heading);
  font-weight: 500;
  font-size: 16px;
  color: var(--tm-text) !important;
  transition: color 0.15s ease;
  line-height: 68px !important;
  padding: 0 !important;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
}

.navbar .nav li a:hover,
.navbar .nav li a:focus {
  color: var(--tm-green) !important;
  text-decoration: none;
  background: none !important;
  box-shadow: none !important;
}

.navbar .nav li.active a {
  color: var(--tm-green) !important;
  font-weight: 500;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
}

.navbar .brand {
  padding: 17px 0 !important;
  float: left !important;
  text-align: left !important;
  line-height: 0;
}

.navbar .brand img {
  height: 33px !important;
  width: 216px !important;
}

/* ==========================================================================
   4. Search Banner
   ========================================================================== */

#docsSearch {
  background-image: url('https://tradmarket.com/static/images/helpdesk/help-banner-mandolin-desktop.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--tm-border);
  padding: 48px 24px;
  position: relative;
}


#docsSearch h1,
#docsSearch form,
#docsSearch .search-form,
#docsSearch #searchBar {
  position: relative;
  z-index: 1;
}

#docsSearch form,
#docsSearch #searchBar {
  display: flex;
  max-width: 640px;
  margin: 0 auto;
  position: relative;
}

#docsSearch h1 {
  font-family: var(--tm-font-heading);
  font-weight: 700;
  color: var(--tm-white);
  font-size: 28px;
  line-height: 1.2;
  margin-bottom: 24px;
}

#searchBar .search-query,
#serp-dd .search-query,
#docsSearch input[type="text"] {
  font-family: var(--tm-font-body);
  font-size: 16px;
  border: 1px solid #cbcbcd;
  border-radius: 8px;
  min-height: 50px;
  padding: 12px 52px 12px 20px;
  color: var(--tm-text);
  background-color: var(--tm-white);
  box-shadow: none;
  transition: border-color 0.15s ease;
  flex: 1;
  min-width: 0;
  width: 100%;
}

#searchBar .search-query:focus,
#serp-dd .search-query:focus,
#docsSearch input[type="text"]:focus {
  border-color: var(--tm-text);
  outline: none;
  box-shadow: none;
}

/* Hide HelpScout's default search icons */
.icon-search {
  display: none !important;
}

/* Sidebar search form wrapper */
#serp-dd,
#serp-dd form,
#serp-dd .search-form {
  position: relative;
}

#serp-dd button,
#searchBar button,
#sidebar form button,
#docsSearch button[type="submit"],
#docsSearch .search-btn {
  position: absolute !important;
  right: 16px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  min-height: auto !important;
  width: 20px !important;
  height: 20px !important;
  cursor: pointer;
  font-size: 0 !important;
  color: transparent !important;
  overflow: hidden;
  line-height: 0 !important;
}

#serp-dd button::before,
#searchBar button::before,
#docsSearch button[type="submit"]::before,
#docsSearch .search-btn::before {
  content: '';
  display: block;
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='matrix(-1 0 0 1 17 1)' stroke='%23999' stroke-width='2' fill='none' fill-rule='evenodd' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11.733 11.733l3.727 3.727'/%3E%3Ccircle cx='6.4' cy='6.4' r='6.4'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
}

#serp-dd button:hover::before,
#searchBar button:hover::before,
#docsSearch button[type="submit"]:hover::before,
#docsSearch .search-btn:hover::before {
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='matrix(-1 0 0 1 17 1)' stroke='%23666' stroke-width='2' fill='none' fill-rule='evenodd' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11.733 11.733l3.727 3.727'/%3E%3Ccircle cx='6.4' cy='6.4' r='6.4'/%3E%3C/g%3E%3C/svg%3E");
}

/* ==========================================================================
   4. Category Cards
   ========================================================================== */

.category-list {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 16px !important;
  float: none !important;
}

.category-list .category {
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius-card);
  background-color: var(--tm-white);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  overflow: hidden;
  margin: 0 !important;
  float: none !important;
  width: calc(50% - 8px) !important;
  flex: 0 0 calc(50% - 8px) !important;
  box-sizing: border-box !important;
  position: relative;
  padding-top: 240px !important;
}

/* Category card images via ::before */
.category-list .category::before {
  content: '';
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 240px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.category-list .category:first-child::before {
  background-image: url('https://tradmarket.com/static/images/helpdesk/category-faq.jpg');
}

.category-list .category:nth-child(2)::before {
  background-image: url('https://tradmarket.com/static/images/helpdesk/category-policy.jpg');
}

.category-list .category:hover {
  box-shadow: var(--tm-shadow-hover);
  transform: translateY(-1px);
}

.category-list .category h2,
.category-list .category .category-name {
  font-family: var(--tm-font-heading);
  font-weight: 600;
  color: var(--tm-text);
}

.category-list .category .article-count {
  font-family: var(--tm-font-body);
  color: var(--tm-success);
  font-weight: 500;
  font-size: 14px;
}

.category-list .category p,
.category-list .category .category-description {
  font-family: var(--tm-font-body);
  color: #666;
  font-size: 14px;
  line-height: 1.5;
}

/* ==========================================================================
   5. Article List
   ========================================================================== */

.articleList,
.article-list {
  list-style: none;
  padding: 0;
}

.articleList a,
.article-list a {
  font-family: var(--tm-font-body);
  font-weight: 400;
  color: var(--tm-green);
  font-size: 16px;
  line-height: 1.6;
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--tm-border);
  transition: color 0.15s ease;
}

.articleList a:hover,
.article-list a:hover {
  color: var(--tm-green-dark);
  text-decoration: underline;
}

.articleList .icon-article,
.article-list .icon-article {
  color: var(--tm-success);
}

/* ==========================================================================
   6. Popular Articles
   ========================================================================== */

.most-pop-articles h3,
.most-pop-articles .title {
  font-family: var(--tm-font-heading);
  font-weight: 700;
  color: var(--tm-text);
}

.most-pop-articles a {
  font-family: var(--tm-font-body);
  color: var(--tm-green);
}

.most-pop-articles a:hover {
  color: var(--tm-green-dark);
  text-decoration: underline;
}

/* ==========================================================================
   7. Article Content
   ========================================================================== */

#fullArticle h1.title,
#fullArticle h1 {
  font-family: var(--tm-font-heading);
  font-weight: 700;
  color: var(--tm-text);
  font-size: 32px;
  line-height: 1.2;
  margin-bottom: 24px;
}

#fullArticle h2 {
  font-family: var(--tm-font-heading);
  font-weight: 600;
  color: var(--tm-text);
  font-size: 24px;
  line-height: 1.3;
  margin-top: 32px;
  margin-bottom: 16px;
}

#fullArticle h3 {
  font-family: var(--tm-font-heading);
  font-weight: 600;
  color: var(--tm-text);
  font-size: 20px;
  line-height: 1.3;
  margin-top: 24px;
  margin-bottom: 12px;
}

#fullArticle p,
#fullArticle li,
#fullArticle div {
  font-family: var(--tm-font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--tm-text);
}

#fullArticle a {
  color: var(--tm-green);
}

#fullArticle a:hover {
  text-decoration: underline;
}

#fullArticle blockquote {
  border-left: 3px solid var(--tm-green);
  background-color: var(--tm-green-bg);
  padding: 16px 20px;
  margin: 20px 0;
  border-radius: 0 var(--tm-radius-card) var(--tm-radius-card) 0;
  font-family: var(--tm-font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--tm-text);
}

#fullArticle code,
#fullArticle kbd {
  background-color: var(--tm-grey-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
}

#fullArticle pre {
  background-color: #f5f5f5;
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius-card);
  padding: 16px;
  overflow-x: auto;
}

#fullArticle pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

#fullArticle img {
  max-width: 100%;
  height: auto;
  border-radius: var(--tm-radius-card);
}

#fullArticle .callout,
#fullArticle .callout-green {
  background-color: var(--tm-green-bg);
  border-left: 3px solid var(--tm-success);
  border-radius: 0 var(--tm-radius-card) var(--tm-radius-card) 0;
  padding: 16px 20px;
  margin: 20px 0;
}

/* ==========================================================================
   8. Sidebar
   ========================================================================== */

#sidebar a,
.sidebar a {
  font-family: var(--tm-font-body);
  color: var(--tm-green);
  font-size: 15px;
  transition: color 0.15s ease;
}

#sidebar a:hover,
.sidebar a:hover {
  color: var(--tm-green-dark);
  text-decoration: underline;
}

#sidebar .active a,
.sidebar .active a {
  font-weight: 700;
  color: var(--tm-text);
}

#sidebar ul,
.sidebar ul {
  border-bottom: 1px solid var(--tm-border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

/* ==========================================================================
   9. Footer
   ========================================================================== */

/* Hide default HelpScout footers — replaced by injected #tm-footer */
.articleFoot,
.contentFooter,
footer {
  display: none !important;
}

/* "Still need help?" block moved into article body via JS */
.article-footer-help {
  background-color: var(--tm-grey50);
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius-card);
  padding: 24px;
  margin-top: 32px;
  text-align: center;
  font-family: var(--tm-font-body);
  font-size: 15px;
  color: var(--tm-text);
}

.article-footer-help a {
  color: var(--tm-green) !important;
  font-weight: 600;
}

.article-footer-help a:hover {
  text-decoration: underline;
}

/* Custom injected footer */
#tm-footer {
  background-color: var(--tm-green);
  padding: 40px 24px;
  text-align: center;
  font-family: var(--tm-font-body);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  position: relative;
}

#tm-footer a {
  color: var(--tm-white) !important;
  opacity: 0.85;
}

#tm-footer a:hover {
  opacity: 1;
  text-decoration: underline;
}


/* ==========================================================================
   10. Breadcrumbs
   ========================================================================== */

.breadcrumbs,
.breadcrumb {
  font-family: var(--tm-font-body);
  font-size: 13px;
  color: #999;
  margin-bottom: 16px;
}

.breadcrumbs a,
.breadcrumb a {
  color: #999;
  font-weight: 400;
}

.breadcrumbs a:hover,
.breadcrumb a:hover {
  color: var(--tm-green);
  text-decoration: underline;
}

.breadcrumbs .current,
.breadcrumb .active,
.breadcrumbs > span:last-child {
  color: var(--tm-text);
  font-weight: 600;
}

.breadcrumbs .divider,
.breadcrumb .divider {
  margin: 0 6px;
  color: #ccc;
}

/* ==========================================================================
   11. Search Results
   ========================================================================== */

#serp-dd .result,
.search-results .result {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--tm-border);
}

#serp-dd .result h3,
#serp-dd .result .title,
.search-results .result h3,
.search-results .result .title {
  font-family: var(--tm-font-heading);
  font-weight: 600;
  color: var(--tm-green);
  font-size: 18px;
  margin-bottom: 4px;
}

#serp-dd .result p,
#serp-dd .result .description,
.search-results .result p,
.search-results .result .description {
  font-family: var(--tm-font-body);
  color: #666;
  font-size: 14px;
  line-height: 1.5;
}

/* Contact form button overrides */
.contact-btn,
a.contact-btn,
.btn-primary {
  background-color: var(--tm-green) !important;
  border-color: var(--tm-green) !important;
  color: var(--tm-white) !important;
  font-family: var(--tm-font-body);
  font-weight: 600;
  border-radius: var(--tm-radius-btn);
  transition: background-color 0.15s ease;
}

.contact-btn:hover,
a.contact-btn:hover,
.btn-primary:hover {
  background-color: var(--tm-green-dark) !important;
  border-color: var(--tm-green-dark) !important;
}

/* ==========================================================================
   12. Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
  #docsSearch {
    padding: 32px 16px;
  }

  #docsSearch h1 {
    font-size: 24px;
  }


  .category-list .category {
    width: 100% !important;
    flex: 0 0 100% !important;
    padding-top: 160px !important;
  }

  .category-list .category::before {
    height: 160px;
  }

  #fullArticle h1.title,
  #fullArticle h1 {
    font-size: 26px;
  }

  #fullArticle h2 {
    font-size: 20px;
  }

  #fullArticle h3 {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  #docsSearch h1 {
    font-size: 20px;
  }

  #fullArticle h1.title,
  #fullArticle h1 {
    font-size: 22px;
  }
}
