/*
Theme Name: Produtos Naturais Tiago Rocha
Theme URI: https://tiagurocha.com.br
Author: Tiago Rocha
Author URI: https://tiagurocha.com.br
Description: Tema de e-commerce de produtos naturais para Produtos Naturais Tiago Rocha. Desenvolvido com suporte completo ao WooCommerce.
Version: 1.0.8
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tiago-rocha
Tags: e-commerce, woocommerce, health, wellness, natural-products
WC requires at least: 7.0
WC tested up to: 8.5
*/

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
    --green:          #1e4d2b;
    --green-dark:     #163d22;
    --green-light:    #2a6b3c;
    --gold:           #c89b2a;
    --gold-hover:     #a87d1e;
    --gold-light:     #f0c84a;
    --white:          #ffffff;
    --off-white:      #f8f8f8;
    --light-gray:     #f0f0f0;
    --mid-gray:       #cccccc;
    --text-dark:      #1a1a1a;
    --text-mid:       #444444;
    --text-light:     #777777;
    --border-color:   #e0e0e0;
    --red:            #e02020;
    --red-dark:       #b81818;

    --font-primary:   'Montserrat', 'Segoe UI', Arial, sans-serif;
    --font-body:      'Open Sans', 'Segoe UI', Arial, sans-serif;

    --container-max:  1280px;
    --container-pad:  20px;

    --radius-sm:      4px;
    --radius-md:      8px;
    --radius-lg:      16px;
    --radius-full:    9999px;

    --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
    --shadow-md:      0 4px 12px rgba(0,0,0,.12);
    --shadow-lg:      0 8px 24px rgba(0,0,0,.16);

    --transition:     0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--green);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--gold);
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-dark);
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.tr-container {
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-pad);
    padding-right: var(--container-pad);
}

.tr-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.tr-col {
    flex: 1 1 0;
    min-width: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.tr-topbar {
    background: var(--green);
    color: var(--white);
    font-size: 0.78rem;
    font-family: var(--font-primary);
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 8px 0;
    text-transform: uppercase;
}

.tr-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
}

.tr-topbar__item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    white-space: nowrap;
    color: var(--white);
}

.tr-topbar__item + .tr-topbar__item {
    border-left: 1px solid rgba(255,255,255,0.25);
}

.tr-topbar__item .icon {
    font-size: 1em;
}

.tr-topbar__item strong {
    color: var(--gold-light);
}

/* ============================================================
   MAIN HEADER
   ============================================================ */
.tr-header {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.tr-header__inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-top: 14px;
    padding-bottom: 14px;
}

/* Logo */
.tr-header__logo {
    flex-shrink: 0;
}

.tr-header__logo a {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tr-header__logo img {
    height: 60px;
    width: auto;
}

.tr-header__logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.tr-header__logo-text span:first-child {
    font-family: var(--font-primary);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tr-header__logo-text strong {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Search */
.tr-header__search {
    flex: 1 1 auto;
    max-width: 560px;
}

.tr-search-form {
    display: flex;
    align-items: stretch;
    border: 2px solid var(--green);
    border-radius: var(--radius-full);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.tr-search-form:focus-within {
    box-shadow: 0 0 0 3px rgba(30,77,43,0.15);
}

.tr-search-form input[type="search"] {
    flex: 1;
    border: none;
    outline: none;
    padding: 11px 20px;
    font-size: 0.95rem;
    color: var(--text-dark);
    background: var(--white);
    min-width: 0;
}

.tr-search-form input[type="search"]::placeholder {
    color: var(--text-light);
}

.tr-search-form button[type="submit"] {
    background: var(--green);
    color: var(--white);
    border: none;
    padding: 0 22px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    cursor: pointer;
}

.tr-search-form button[type="submit"]:hover {
    background: var(--green-dark);
}

/* Header actions */
.tr-header__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.tr-header__action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    color: var(--text-mid);
    font-size: 0.7rem;
    font-family: var(--font-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: color var(--transition), background var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.tr-header__action-btn:hover {
    color: var(--green);
    background: var(--off-white);
}

.tr-header__action-btn .icon {
    font-size: 1.35rem;
    line-height: 1;
}

/* Cart button special style */
.tr-header__action-btn--cart {
    background: none;
    color: var(--text-mid);
    padding: 8px 12px;
    border-radius: var(--radius-md);
}

.tr-header__action-btn--cart .icon {
    color: #fff;
    -webkit-text-stroke: 1.5px #111;
    paint-order: stroke fill;
}

.tr-header__action-btn--cart:hover {
    background: var(--off-white);
    color: var(--green);
}

/* Ícone do carrinho com badge posicionado em cima */
.tr-cart-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tr-cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background: var(--green, #1e4d2b);
    color: var(--white);
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--white);
    line-height: 1;
}

/* ============================================================
   NAVIGATION BAR
   ============================================================ */
.tr-navbar {
    background: var(--green);
    position: relative;
    z-index: 999;
}

.tr-navbar__inner {
    display: flex;
    align-items: stretch;
}

/* All categories mega button */
.tr-navbar__all-cats {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    background: var(--green-dark);
    color: var(--white);
    font-family: var(--font-primary);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--transition);
    border: none;
    text-decoration: none;
}

.tr-navbar__all-cats:hover {
    background: var(--gold);
    color: var(--white);
}

.tr-navbar__all-cats .icon {
    font-size: 1.1rem;
}

/* Primary nav menu */
.tr-navbar__menu {
    display: flex;
    align-items: stretch;
    flex: 1;
}

.tr-navbar__menu ul {
    display: flex;
    align-items: stretch;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tr-navbar__menu ul li {
    position: relative;
}

.tr-navbar__menu ul li a {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: rgba(255,255,255,0.88);
    font-family: var(--font-primary);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    text-decoration: none;
    transition: color var(--transition), background var(--transition);
}

.tr-navbar__menu ul li a:hover,
.tr-navbar__menu ul li.current-menu-item > a,
.tr-navbar__menu ul li.current-menu-ancestor > a {
    color: var(--gold-light);
    background: rgba(255,255,255,0.07);
}

.tr-navbar__menu ul li.menu-item-promo > a {
    color: var(--gold-light);
    font-weight: 700;
}

/* Dropdown */
.tr-navbar__menu ul li ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--white);
    border-top: 3px solid var(--gold);
    box-shadow: var(--shadow-lg);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    z-index: 9999;
    flex-direction: column;
}

.tr-navbar__menu ul li:hover > ul {
    display: flex;
}

.tr-navbar__menu ul li ul li a {
    color: var(--text-dark);
    padding: 10px 18px;
    font-size: 0.82rem;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
}

.tr-navbar__menu ul li ul li:last-child a {
    border-bottom: none;
}

.tr-navbar__menu ul li ul li a:hover {
    color: var(--green);
    background: var(--off-white);
}

/* Mobile hamburger */
.tr-navbar__toggle {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 14px 18px;
    color: var(--white);
    font-size: 1.4rem;
    cursor: pointer;
    background: none;
    border: none;
}

/* ============================================================
   MEGA DROPDOWN CATEGORIES
   ============================================================ */
.tr-navbar__cats-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
}

.tr-mega-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 280px;
    background: var(--white);
    border-top: 3px solid var(--gold);
    box-shadow: var(--shadow-lg);
    z-index: 9998;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 70vh;
    overflow-y: auto;
}

.tr-mega-menu.is-open {
    display: block;
}

.tr-mega-menu ul {
    padding: 8px 0;
}

.tr-mega-menu ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-dark);
    font-size: 0.88rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
}

.tr-mega-menu ul li:last-child a {
    border-bottom: none;
}

.tr-mega-menu ul li a:hover {
    background: var(--off-white);
    color: var(--green);
    padding-left: 24px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.tr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 28px;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
    text-decoration: none;
    border: 2px solid transparent;
    line-height: 1;
}

.tr-btn:active {
    transform: translateY(1px);
}

.tr-btn--gold {
    background: var(--gold);
    color: var(--white);
    border-color: var(--gold);
}

.tr-btn--gold:hover {
    background: var(--gold-hover);
    border-color: var(--gold-hover);
    color: var(--white);
    box-shadow: 0 4px 16px rgba(200,155,42,0.35);
}

.tr-btn--green {
    background: var(--green);
    color: var(--white);
    border-color: var(--green);
}

.tr-btn--green:hover {
    background: var(--green-dark);
    border-color: var(--green-dark);
    color: var(--white);
    box-shadow: 0 4px 16px rgba(30,77,43,0.3);
}

.tr-btn--outline-white {
    background: transparent;
    color: var(--white);
    border-color: var(--white);
}

.tr-btn--outline-white:hover {
    background: var(--white);
    color: var(--green);
}

.tr-btn--outline-green {
    background: transparent;
    color: var(--green);
    border-color: var(--green);
}

.tr-btn--outline-green:hover {
    background: var(--green);
    color: var(--white);
}

.tr-btn--lg {
    padding: 16px 36px;
    font-size: 1rem;
}

.tr-btn--sm {
    padding: 9px 18px;
    font-size: 0.78rem;
}

/* ============================================================
   SECTION TITLES
   ============================================================ */
.tr-section-title {
    text-align: center;
    margin-bottom: 40px;
}

.tr-section-title__tag {
    display: inline-block;
    background: var(--gold);
    color: var(--white);
    font-family: var(--font-primary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    margin-bottom: 10px;
}

.tr-section-title h2 {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: var(--text-dark);
    margin-bottom: 10px;
}

.tr-section-title h2 span {
    color: var(--green);
}

.tr-section-title p {
    color: var(--text-light);
    font-size: 1rem;
    max-width: 560px;
    margin: 0 auto;
}

.tr-section-title--left {
    text-align: left;
}

.tr-section-title--left p {
    margin-left: 0;
}

/* Mobile-only elements — hidden by default on desktop */
.tr-header__hamburger         { display: none; }
.tr-header__mobile-search-btn { display: none; }
.tr-header__mobile-search     { display: none; }
/* Wishlist hidden on mobile — shown on desktop only */
.tr-header__action-btn--wishlist { display: flex; }

/* ============================================================
   RESPONSIVE - Mobile
   ============================================================ */
@media (max-width: 1024px) {
    .tr-topbar__item:nth-child(n+4) {
        display: none;
    }
}

@media (max-width: 768px) {
    /* ---- Topbar: hide on mobile ---- */
    .tr-topbar { display: none !important; }

    /* ---- Header: compact green bar ---- */
    .tr-header {
        background: var(--green);
        border-bottom: none;
        box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    }

    .tr-header__inner {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 4px;
        padding: 8px 0;
    }

    /* Hamburger button (mobile-only) */
    .tr-header__hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        color: var(--white);
        background: none;
        border: none;
        font-size: 1.4rem;
        cursor: pointer;
        flex-shrink: 0;
        padding: 0;
    }

    /* Logo: centered, white */
    .tr-header__logo {
        flex: 1;
        display: flex;
        justify-content: center;
    }

    .tr-header__logo img {
        max-height: 44px;
        height: auto;
        filter: brightness(0) invert(1);
    }

    .tr-header__logo-text strong { color: var(--white); }
    .tr-header__logo-text span   { color: rgba(255,255,255,0.75); }

    /* Hide center search bar */
    .tr-header__search { display: none; }

    /* Actions: icon-only, white */
    .tr-header__actions {
        display: flex;
        align-items: center;
        gap: 0;
        flex-shrink: 0;
    }

    .tr-header__action-btn {
        color: var(--white);
        min-height: 44px;
        min-width: 44px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 6px 8px;
    }

    .tr-header__action-btn:hover {
        background: rgba(255,255,255,0.15);
        color: var(--white);
    }

    .tr-header__action-btn span.label { display: none; }

    /* Cart icon: white on mobile */
    .tr-header__action-btn--cart .icon {
        color: var(--white);
        -webkit-text-stroke: 0;
    }

    /* Logo: constrain width so it doesn't eat all space */
    .tr-header__logo img {
        width: auto !important;
        max-width: 150px;
        max-height: 44px;
        height: auto;
        filter: brightness(0) invert(1);
    }

    /* Hide wishlist on mobile */
    .tr-header__action-btn--wishlist { display: none !important; }

    /* Search toggle — direct flex child, always visible on mobile */
    .tr-header__mobile-search-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        min-height: 44px;
        color: var(--white);
        background: none;
        border: none;
        font-size: 1.3rem;
        cursor: pointer;
        flex-shrink: 0;
        padding: 0 6px;
    }

    /* ---- Inline mobile search form (inside header row) ---- */
    /* Hidden by default; shown when header has .is-searching */
    .tr-header__mobile-search { display: none; }

    /* Search open: show form, hide logo + mobile-search-btn + actions */
    .tr-header.is-searching .tr-header__logo          { display: none; }
    .tr-header.is-searching .tr-header__mobile-search-btn { display: none; }
    .tr-header.is-searching .tr-header__actions       { display: none; }
    .tr-header.is-searching .tr-header__mobile-search {
        display: flex;
        flex: 1;
        align-items: center;
        gap: 0;
        min-width: 0;
    }

    .tr-header__mobile-search input[type="search"] {
        flex: 1;
        border: none;
        border-radius: var(--radius-md);
        padding: 10px 14px;
        font-size: 0.95rem;
        color: var(--text-dark);
        background: var(--white);
        outline: none;
        min-width: 0;
        height: 40px;
    }

    .tr-mobile-search-close {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        color: var(--white);
        background: none;
        border: none;
        font-size: 1.3rem;
        cursor: pointer;
        flex-shrink: 0;
        padding: 0;
    }

    /* ---- Navbar: collapses to panel on mobile ---- */
    .tr-navbar {
        position: static;
        display: none;
    }

    .tr-navbar.is-mobile-open {
        display: block;
    }

    .tr-navbar__inner {
        flex-direction: column;
        align-items: stretch;
        padding: 0;
    }

    .tr-navbar__all-cats { display: none; }
    .tr-navbar__toggle   { display: none; }

    .tr-navbar__menu {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .tr-navbar__menu ul {
        flex-direction: column;
        width: 100%;
    }

    .tr-navbar__menu ul li a {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 0.9rem;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .tr-navbar__menu ul li ul {
        position: static;
        display: block;
        background: rgba(0,0,0,0.15);
        border-top: none;
        box-shadow: none;
        border-radius: 0;
    }

    .tr-navbar__menu ul li ul li a {
        color: rgba(255,255,255,0.8);
        background: transparent;
        border-bottom-color: rgba(255,255,255,0.08);
        padding-left: 32px;
    }
}

/* --- 576px: mobile grande --- */
@media (max-width: 576px) {
    /* Header */
    .tr-header__logo img { max-height: 40px; }
    .tr-header__actions { gap: 4px; }
    .tr-header__action-btn { padding: 6px 8px; font-size: 0.78rem; }

    /* Mega menu: tela cheia */
    .tr-mega-menu { width: 100vw; left: 0; right: 0; }
}

@media (max-width: 480px) {
    /* Cart badge smaller */
    .tr-cart-count { width: 16px; height: 16px; font-size: 0.62rem; }
}

/* ============================================================
   TOUCH TARGET GLOBAL — all buttons & links min 44px on mobile
   ============================================================ */
@media (max-width: 768px) {
    .tr-btn,
    button,
    [role="button"],
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
    }

    /* Ensure sidebar cat links are touch-friendly */
    .tr-sidebar-cats li a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Myaccount nav touch targets */
    .tr-myaccount-nav__item a {
        min-height: 44px;
    }

    /* Archive bar select */
    .tr-archive-bar__sort select,
    .woocommerce-ordering select {
        min-height: 44px;
    }
}
