/*
Theme Name: Can Minh Huy
Theme URI: https://canminhhuy.com
Author: Can Dien Tu Minh Huy
Description: WordPress theme cho website bán cân điện tử Minh Huy
Version: 1.0
License: GNU General Public License v2 or later
Text Domain: canminhhuy
*/

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

body {
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: 13px;
    color: #333;
    background: #f0f0f0;
    line-height: 1.6;
}

a { color: #d00; text-decoration: none; }
a:hover { color: #f00; text-decoration: underline; }

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

ul { list-style: none; }

h1, h2, h3, h4, h5, h6 {
    font-weight: bold;
    color: #333;
    line-height: 1.3;
}

/* ================================================
   WRAPPER
   ================================================ */
#wrapper {
    width: 980px;
    margin: 0 auto;
    background: #fff;
}

/* ================================================
   TOP BAR
   ================================================ */
#topbar {
    background: #cc0000;
    color: #fff;
    font-size: 12px;
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#topbar a { color: #fff; }
#topbar .hotline-top {
    font-weight: bold;
    font-size: 13px;
}

/* ================================================
   HEADER
   ================================================ */
#header {
    background: #fff;
    border-bottom: 3px solid #cc0000;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#logo a img {
    max-height: 80px;
    width: auto;
}

#header-contact {
    text-align: right;
    font-size: 13px;
    color: #333;
}
#header-contact .phone {
    font-size: 22px;
    font-weight: bold;
    color: #cc0000;
}
#header-contact .phone a {
    color: #cc0000;
}

/* ================================================
   NAVIGATION
   ================================================ */
#navigation {
    background: #cc0000;
    position: relative;
    z-index: 999;
}

#navigation ul {
    display: flex;
    flex-wrap: wrap;
}

#navigation ul li {
    position: relative;
}

#navigation ul li a {
    display: block;
    color: #fff;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
}

#navigation ul li a:hover,
#navigation ul li.current-menu-item > a,
#navigation ul li.current-menu-parent > a {
    background: #990000;
    text-decoration: none;
}

/* Dropdown */
#navigation ul li ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #cc0000;
    min-width: 200px;
    z-index: 1000;
    border-top: 2px solid #fff;
}

#navigation ul li:hover > ul {
    display: block;
}

#navigation ul li ul li {
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

#navigation ul li ul li a {
    padding: 8px 14px;
    font-size: 12px;
    text-transform: none;
    font-weight: normal;
}

#navigation ul li ul li a:hover {
    background: #880000;
}

/* ================================================
   SLIDER
   ================================================ */
#slider-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
    background: #222;
}

#slider {
    position: relative;
    width: 100%;
}

#slider .slide {
    display: none;
    width: 100%;
}

#slider .slide.active {
    display: block;
}

#slider .slide img {
    width: 100%;
    height: auto;
    display: block;
}

.slider-nav {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

.slider-nav span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    display: inline-block;
}

.slider-nav span.active {
    background: #fff;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.4);
    color: #fff;
    border: none;
    font-size: 24px;
    padding: 8px 14px;
    cursor: pointer;
    z-index: 10;
}
.slider-btn:hover { background: rgba(200,0,0,0.7); }
.slider-btn.prev { left: 0; }
.slider-btn.next { right: 0; }

/* ================================================
   MAIN LAYOUT
   ================================================ */
#main {
    display: flex;
    gap: 0;
    padding: 10px;
}

#content {
    flex: 1;
    min-width: 0;
    padding-right: 10px;
}

#sidebar {
    width: 220px;
    flex-shrink: 0;
}

/* ================================================
   PRODUCT SECTIONS (Homepage)
   ================================================ */
.product-section {
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
}

.product-section-title {
    background: #cc0000;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    padding: 8px 12px;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-section-title a {
    color: #fff;
    font-size: 11px;
    font-weight: normal;
    text-decoration: underline;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: #ddd;
    padding: 1px;
}

.product-item {
    background: #fff;
    padding: 8px;
    text-align: center;
    position: relative;
}

.product-item:hover {
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    z-index: 1;
}

.product-item img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    margin-bottom: 6px;
}

.product-item .product-name {
    font-size: 12px;
    color: #333;
    font-weight: bold;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 32px;
}

.product-item .product-price {
    color: #cc0000;
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 6px;
}

.product-item .btn-contact {
    display: inline-block;
    background: #cc0000;
    color: #fff;
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 3px;
    text-decoration: none;
}

.product-item .btn-contact:hover {
    background: #990000;
    text-decoration: none;
}

/* ================================================
   LATEST PRODUCTS (Mới nhất)
   ================================================ */
.latest-products {
    margin-bottom: 20px;
    border: 1px solid #ddd;
}

.latest-products .section-title {
    background: #333;
    color: #fff;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
}

.latest-product-item {
    display: flex;
    gap: 10px;
    padding: 8px;
    border-bottom: 1px solid #eee;
    align-items: flex-start;
}

.latest-product-item:last-child { border-bottom: none; }

.latest-product-item img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    flex-shrink: 0;
}

.latest-product-item .info .name {
    font-weight: bold;
    font-size: 12px;
    color: #c00;
    margin-bottom: 4px;
}

.latest-product-item .info .desc {
    font-size: 11px;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ================================================
   SIDEBAR WIDGETS
   ================================================ */
.widget {
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
}

.widget-title {
    background: #cc0000;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    padding: 7px 10px;
    text-transform: uppercase;
    cursor: pointer;
}

.widget-content {
    background: #fff;
}

/* Category tree */
.cat-tree li {
    border-bottom: 1px solid #eee;
}

.cat-tree li a {
    display: block;
    padding: 6px 10px;
    font-size: 12px;
    color: #333;
    border-left: 3px solid transparent;
}

.cat-tree li a:hover {
    color: #cc0000;
    border-left-color: #cc0000;
    background: #fafafa;
    text-decoration: none;
}

.cat-tree li ul {
    background: #f9f9f9;
}

.cat-tree li ul li a {
    padding-left: 20px;
    font-size: 11px;
}

/* Support box */
.support-box {
    background: #fff3f3;
    padding: 10px;
}

.support-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #ddd;
}

.support-row:last-child { border-bottom: none; margin-bottom: 0; }

.support-row img { width: 20px; height: 20px; }

.support-row .label {
    font-size: 11px;
    color: #666;
}

.support-row .value {
    font-size: 14px;
    font-weight: bold;
    color: #cc0000;
}

.support-row .value a { color: #cc0000; }

/* Partners */
.partners-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 8px;
}

.partners-grid img {
    width: 100%;
    height: 40px;
    object-fit: contain;
    border: 1px solid #eee;
    padding: 2px;
}

/* Sidebar banner */
.sidebar-banner {
    margin-bottom: 10px;
}
.sidebar-banner img { width: 100%; }

/* ================================================
   WOOCOMMERCE OVERRIDES
   ================================================ */
.woocommerce ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
}

.woocommerce ul.products li.product {
    margin: 0 !important;
    width: auto !important;
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    background: #fff;
}

.woocommerce ul.products li.product a img {
    width: 100%;
    height: 130px;
    object-fit: contain;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 12px;
    padding: 5px 0;
}

.woocommerce ul.products li.product .price {
    color: #cc0000;
    font-weight: bold;
}

.woocommerce .button {
    background: #cc0000 !important;
    color: #fff !important;
    border-radius: 3px !important;
    font-size: 11px !important;
    padding: 5px 10px !important;
}

.woocommerce .button:hover {
    background: #990000 !important;
}

/* Single product */
.woocommerce div.product .product_title {
    font-size: 18px;
    color: #cc0000;
    margin-bottom: 10px;
}

.woocommerce div.product p.price {
    color: #cc0000;
    font-size: 20px;
    font-weight: bold;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li.active a {
    color: #cc0000;
    border-bottom-color: #cc0000;
}

/* ================================================
   BREADCRUMB
   ================================================ */
.breadcrumb {
    background: #f5f5f5;
    padding: 6px 10px;
    font-size: 11px;
    color: #666;
    margin-bottom: 10px;
    border-radius: 3px;
}
.breadcrumb a { color: #cc0000; }
.breadcrumb span { margin: 0 5px; }

/* ================================================
   FOOTER
   ================================================ */
#footer {
    background: #222;
    color: #ccc;
    padding: 20px 10px;
    margin-top: 20px;
}

.footer-cols {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.footer-col h3 {
    color: #fff;
    font-size: 13px;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #444;
}

.footer-col p,
.footer-col li {
    font-size: 12px;
    margin-bottom: 5px;
    color: #aaa;
    line-height: 1.5;
}

.footer-col a { color: #ccc; }
.footer-col a:hover { color: #fff; }

.footer-map iframe {
    width: 100%;
    height: 150px;
    border: none;
}

/* Footer contact form */
.footer-form input,
.footer-form textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #444;
    background: #333;
    color: #eee;
    font-size: 12px;
    margin-bottom: 5px;
    border-radius: 3px;
}

.footer-form textarea { height: 70px; resize: vertical; }

.footer-form button {
    background: #cc0000;
    color: #fff;
    border: none;
    padding: 7px 20px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
}

.footer-form button:hover { background: #990000; }

/* Footer bottom */
.footer-bottom {
    border-top: 1px solid #444;
    padding-top: 10px;
    text-align: center;
    font-size: 11px;
    color: #777;
}

/* ================================================
   FLOATING CONTACT BUTTON
   ================================================ */
#float-contact {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.float-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #cc0000;
    color: #fff;
    padding: 8px 14px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    animation: pulse 1.5s infinite;
}

.float-btn:hover {
    background: #990000;
    text-decoration: none;
    color: #fff;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

/* ================================================
   PAGES - ABOUT, CONTACT
   ================================================ */
.page-content {
    background: #fff;
    padding: 15px;
}

.page-content h2 {
    color: #cc0000;
    font-size: 18px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #cc0000;
}

.contact-info-box {
    background: #fff3f3;
    border: 1px solid #ffcccc;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.contact-info-box table {
    width: 100%;
    border-collapse: collapse;
}

.contact-info-box table td {
    padding: 5px 10px;
    font-size: 13px;
    vertical-align: top;
}

.contact-info-box table td:first-child {
    font-weight: bold;
    color: #cc0000;
    width: 130px;
}

/* Contact form */
.contact-form-wrap {
    margin-top: 20px;
}

.contact-form-wrap .form-row {
    margin-bottom: 10px;
}

.contact-form-wrap label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 3px;
    color: #555;
}

.contact-form-wrap input,
.contact-form-wrap textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
}

.contact-form-wrap textarea { height: 120px; resize: vertical; }

.contact-form-wrap button[type="submit"] {
    background: #cc0000;
    color: #fff;
    border: none;
    padding: 10px 25px;
    font-size: 14px;
    border-radius: 3px;
    cursor: pointer;
}

.contact-form-wrap button[type="submit"]:hover {
    background: #990000;
}

/* ================================================
   BACK TO TOP
   ================================================ */
#backtotop {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: #333;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    z-index: 9998;
    opacity: 0.7;
    text-decoration: none;
}
#backtotop:hover { opacity: 1; text-decoration: none; color: #fff; }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 980px) {
    #wrapper { width: 100%; }
}

@media (max-width: 768px) {
    #main { flex-direction: column; }
    #sidebar { width: 100%; }
    #content { padding-right: 0; }

    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-cols { grid-template-columns: 1fr; }

    #navigation ul { display: none; }
    #mobile-menu-btn {
        display: block;
        background: #990000;
        color: #fff;
        padding: 10px;
        cursor: pointer;
        font-size: 20px;
        text-align: center;
    }
    #navigation.open ul { display: block; }
    #navigation ul li ul {
        position: static;
        border-top: 1px solid rgba(255,255,255,0.2);
    }
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .woocommerce ul.products { grid-template-columns: repeat(2, 1fr) !important; }
}
