/********** Template CSS - Mobile Optimized **********/
:root {
    --primary: #3CB815;
    --secondary: #F65005;
    --light: #F7F8FC;
    --dark: #111111;
}

/* 基礎響應式設置 */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    width: 100%;
}

/* 圖片響應式 */
img {
    max-width: 100%;
    height: auto;
}

.back-to-top {
    position: fixed;
    display: none;
    right: 15px;
    bottom: 15px;
    z-index: 99;
    width: 40px;
    height: 40px;
}

/* 手機版優化返回頂部按鈕 */
@media (max-width: 768px) {
    .back-to-top {
        right: 10px;
        bottom: 10px;
        width: 35px;
        height: 35px;
    }
}

.my-6 {
    margin-top: 6rem;
    margin-bottom: 6rem;
}

.py-6 {
    padding-top: 6rem;
    padding-bottom: 6rem;
}

/* 手機版減少間距 */
@media (max-width: 768px) {
    .my-6 {
        margin-top: 3rem;
        margin-bottom: 3rem;
    }
    
    .py-6 {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
}

.bg-icon {
    background: url(../img/bg-icon.png) center center repeat;
    background-size: contain;
}


/*** Spinner ***/
#spinner {
    opacity: 0;
    visibility: hidden;
    transition: opacity .5s ease-out, visibility 0s linear .5s;
    z-index: 99999;
}

#spinner.show {
    transition: opacity .5s ease-out, visibility 0s linear 0s;
    visibility: visible;
    opacity: 1;
}


/*** Button ***/
.btn {
    font-weight: 500;
    transition: .5s;
}

.btn.btn-primary,
.btn.btn-secondary,
.btn.btn-outline-primary:hover,
.btn.btn-outline-secondary:hover {
    color: #FFFFFF;
}

.btn-square {
    width: 38px;
    height: 38px;
}

.btn-sm-square {
    width: 32px;
    height: 32px;
}

.btn-lg-square {
    width: 48px;
    height: 48px;
}

.btn-square,
.btn-sm-square,
.btn-lg-square {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: normal;
}

/* 手機版按鈕優化 */
@media (max-width: 768px) {
    .btn {
        font-size: 14px;
        padding: 10px 20px;
    }
    
    .btn-lg {
        font-size: 16px;
        padding: 12px 25px;
    }
}


/*** Navbar ***/
.fixed-top {
    transition: .5s;
}

.top-bar {
    height: 45px;
    border-bottom: 1px solid rgba(0, 0, 0, .07);
    font-size: 14px;
}

/* 手機版隱藏頂部欄 */
@media (max-width: 991.98px) {
    .top-bar {
        display: none !important;
    }
}

.navbar .dropdown-toggle::after {
    border: none;
    content: "\f107";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    vertical-align: middle;
    margin-left: 8px;
}

.navbar .navbar-nav .nav-link {
    padding: 25px 15px;
    color: #555555;
    font-weight: 500;
    outline: none;
    white-space: nowrap;
}

.navbar .navbar-nav .nav-link:hover,
.navbar .navbar-nav .nav-link.active {
    color: var(--primary);
}

/* 改進手機版導航欄 */
@media (max-width: 991.98px) {
    .navbar .navbar-nav {
        margin-top: 10px;
        border-top: 1px solid rgba(0, 0, 0, .07);
        background: #FFFFFF;
        padding: 10px 0;
    }

    .navbar .navbar-nav .nav-link {
        padding: 10px 15px;
        font-size: 15px;
    }
    
    .navbar-brand img {
        max-width: 150px !important;
    }
    
    .navbar-toggler {
        border: none;
        padding: 5px 10px;
    }
}

@media (min-width: 992px) {
    .navbar .nav-item .dropdown-menu {
        display: block;
        visibility: hidden;
        top: 100%;
        transform: rotateX(-75deg);
        transform-origin: 0% 0%;
        transition: .5s;
        opacity: 0;
    }

    .navbar .nav-item:hover .dropdown-menu {
        transform: rotateX(0deg);
        visibility: visible;
        transition: .5s;
        opacity: 1;
    }
}


/*** Header ***/
.carousel-caption {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: start;
    z-index: 1;
    padding: 0 15px;
}

/* 手機版輪播標題優化 */
@media (max-width: 768px) {
    .carousel-caption {
        text-align: center !important;
    }
    
    .carousel-caption h1 {
        font-size: 1.8rem !important;
        line-height: 1.2;
        margin-bottom: 1rem !important;
    }
    
    .carousel-caption .btn {
        padding: 10px 25px;
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    .carousel-caption h1 {
        font-size: 1.5rem !important;
    }
}

.carousel-control-prev,
.carousel-control-next {
    width: 15%;
}

/* 手機版輪播控制按鈕 */
@media (max-width: 768px) {
    .carousel-control-prev,
    .carousel-control-next {
        width: 10%;
    }
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 3rem;
    height: 3rem;
    background-color: var(--primary);
    border: 10px solid var(--primary);
    border-radius: 3rem;
}

/* 手機版縮小控制按鈕 */
@media (max-width: 768px) {
    .carousel-control-prev-icon,
    .carousel-control-next-icon {
        width: 2rem;
        height: 2rem;
        border: 6px solid var(--primary);
    }
}

@media (max-width: 768px) {
    #header-carousel .carousel-item {
        position: relative;
        min-height: 400px;
    }
    
    #header-carousel .carousel-item img {
        position: absolute;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

@media (max-width: 576px) {
    #header-carousel .carousel-item {
        min-height: 300px;
    }
}

.page-header {
    padding-top: 12rem;
    padding-bottom: 6rem;
    background: url(../img/about-header.jpg) top right no-repeat;
    background-size: cover;
}

/* 手機版頁面標題優化 */
@media (max-width: 768px) {
    .page-header {
        padding-top: 8rem;
        padding-bottom: 4rem;
        background-position: center;
    }
    
    .page-header h1 {
        font-size: 2rem !important;
    }
}

.breadcrumb-item+.breadcrumb-item::before {
    color: #999999;
}


/*** Section Header ***/
.section-header {
    position: relative;
    padding-top: 25px;
}

.section-header::before {
    position: absolute;
    content: "";
    width: 60px;
    height: 2px;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
}

.section-header::after {
    position: absolute;
    content: "";
    width: 90px;
    height: 2px;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary);
}

.section-header.text-start::before,
.section-header.text-start::after {
    left: 0;
    transform: translateX(0);
}

/* 手機版標題優化 */
@media (max-width: 768px) {
    .section-header h1,
    .section-header .display-5 {
        font-size: 1.8rem !important;
    }
    
    .section-header p {
        font-size: 0.95rem;
    }
}


/*** About ***/
.about-img img {
    position: relative;
    z-index: 2;
}

.about-img::before {
    position: absolute;
    content: "";
    top: 0;
    left: -50%;
    width: 100%;
    height: 100%;
    background-image: -webkit-repeating-radial-gradient(#FFFFFF, #EEEEEE 5px, transparent 5px, transparent 10px);
    background-image: -moz-repeating-radial-gradient(#FFFFFF, #EEEEEE 5px, transparent 5px, transparent 10px);
    background-image: -ms-repeating-radial-gradient(#FFFFFF, #EEEEEE 5px, transparent 5px, transparent 10px);
    background-image: -o-repeating-radial-gradient(#FFFFFF, #EEEEEE 5px, transparent 5px, transparent 10px);
    background-image: repeating-radial-gradient(#FFFFFF, #EEEEEE 5px, transparent 5px, transparent 10px);
    background-size: 20px 20px;
    transform: skew(20deg);
    z-index: 1;
}

/* 手機版關於我們區域優化 */
@media (max-width: 991.98px) {
    .about-img {
        margin-bottom: 30px;
    }
    
    .about-img::before {
        display: none;
    }
}


/*** Product ***/
.nav-pills .nav-item .btn {
    color: var(--dark);
}

.nav-pills .nav-item .btn:hover,
.nav-pills .nav-item .btn.active {
    color: #FFFFFF;
}

.product-item {
    box-shadow: 0 0 45px rgba(0, 0, 0, .07);
    transition: transform .3s;
}

.product-item img {
    transition: .5s;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.product-item:hover {
    transform: translateY(-5px);
}

.product-item:hover img {
    transform: scale(1.05);
}

.product-item small a:hover {
    color: var(--primary) !important;
}

/* 手機版產品卡片優化 */
@media (max-width: 768px) {
    .product-item {
        margin-bottom: 20px;
    }
    
    .product-item .text-center {
        padding: 15px !important;
    }
    
    .product-item h5 {
        font-size: 1rem;
    }
    
    .product-item .text-primary {
        font-size: 1.1rem;
    }
}


/*** Testimonial ***/
.testimonial-carousel .owl-item .testimonial-item img {
    width: 60px;
    height: 60px;
}

.testimonial-carousel .owl-item .testimonial-item,
.testimonial-carousel .owl-item .testimonial-item * {
    transition: .5s;
}

.testimonial-carousel .owl-item.center .testimonial-item {
    background: var(--primary) !important;
}

.testimonial-carousel .owl-item.center .testimonial-item * {
    color: #FFFFFF !important;
}

.testimonial-carousel .owl-item.center .testimonial-item i {
    color: var(--secondary) !important;
}

.testimonial-carousel .owl-nav {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

.testimonial-carousel .owl-nav .owl-prev,
.testimonial-carousel .owl-nav .owl-next {
    margin: 0 12px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
    border: 2px solid var(--primary);
    border-radius: 50px;
    font-size: 18px;
    transition: .5s;
}

.testimonial-carousel .owl-nav .owl-prev:hover,
.testimonial-carousel .owl-nav .owl-next:hover {
    color: #FFFFFF;
    background: var(--primary);
}

/* 手機版見證輪播優化 */
@media (max-width: 768px) {
    .testimonial-carousel .owl-nav .owl-prev,
    .testimonial-carousel .owl-nav .owl-next {
        width: 40px;
        height: 40px;
        margin: 0 8px;
        font-size: 16px;
    }
}


/*** Footer ***/
.footer {
    color: #999999;
}

.footer .btn.btn-link {
    display: block;
    margin-bottom: 5px;
    padding: 0;
    text-align: left;
    color: #999999;
    font-weight: normal;
    text-transform: capitalize;
    transition: .3s;
}

.footer .btn.btn-link::before {
    position: relative;
    content: "\f105";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #999999;
    margin-right: 10px;
}

.footer .btn.btn-link:hover {
    color: var(--light);
    letter-spacing: 1px;
    box-shadow: none;
}

.footer .copyright {
    padding: 25px 0;
    font-size: 15px;
    border-top: 1px solid rgba(256, 256, 256, .1);
}

.footer .copyright a {
    color: var(--light);
}

.footer .copyright a:hover {
    color: var(--primary);
}

/* 手機版頁腳優化 */
@media (max-width: 768px) {
    .footer .col-lg-3,
    .footer .col-md-6 {
        margin-bottom: 30px;
    }
    
    .footer h4 {
        font-size: 1.2rem;
    }
    
    .footer p,
    .footer .btn-link {
        font-size: 14px;
    }
    
    .footer .copyright {
        font-size: 13px;
        text-align: center !important;
    }
}


/*** 響應式容器優化 ***/
@media (max-width: 768px) {
    .container,
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .row > * {
        padding-left: 10px;
        padding-right: 10px;
    }
}


/*** 文字響應式優化 ***/
@media (max-width: 768px) {
    h1, .h1 {
        font-size: 2rem;
    }
    
    h2, .h2 {
        font-size: 1.75rem;
    }
    
    h3, .h3 {
        font-size: 1.5rem;
    }
    
    h4, .h4 {
        font-size: 1.25rem;
    }
    
    h5, .h5 {
        font-size: 1.1rem;
    }
    
    .display-1 {
        font-size: 3rem;
    }
    
    .display-2 {
        font-size: 2.5rem;
    }
    
    .display-3 {
        font-size: 2rem;
    }
    
    .display-4 {
        font-size: 1.75rem;
    }
    
    .display-5 {
        font-size: 1.5rem;
    }
    
    .display-6 {
        font-size: 1.25rem;
    }
    
    p, .lead {
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    .display-1 {
        font-size: 2.5rem;
    }
    
    .display-2 {
        font-size: 2rem;
    }
}


/*** 表格響應式 ***/
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}


/*** 卡片間距優化 ***/
@media (max-width: 768px) {
    .card {
        margin-bottom: 20px;
    }
    
    .card-body {
        padding: 15px;
    }
}


/*** 購物車徽章優化 ***/
.badge {
    font-size: 0.75rem;
    padding: 0.25em 0.5em;
}

@media (max-width: 768px) {
    .badge {
        font-size: 0.65rem;
        padding: 0.2em 0.4em;
    }
}


/*** 模態框手機優化 ***/
@media (max-width: 768px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 10px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }
}


/*** 表單優化 ***/
@media (max-width: 768px) {
    .form-control,
    .form-select {
        font-size: 16px; /* 防止 iOS 放大 */
    }
    
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea {
        font-size: 16px; /* 防止 iOS 放大 */
    }
}


/*** 觸控優化 ***/
@media (max-width: 768px) {
    /* 增加可點擊區域 */
    .nav-link,
    .btn,
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}


/*** 防止橫向滾動 ***/
body {
    overflow-x: hidden;
}

.container-fluid {
    overflow-x: hidden;
}


/*** 圖片懶加載優化 ***/
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}
