/* 自訂樣式 */

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

main {
    flex: 1;
}

.card-img-top {
    transition: transform 0.3s;
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

.navbar-brand {
    font-weight: bold;
}

/* 客戶端導航欄美化樣式 - 現代電商風格 */
.custom-navbar {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.custom-navbar .navbar-brand {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff !important;
    transition: transform 0.3s ease;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.custom-navbar .navbar-brand:hover {
    transform: scale(1.05);
    color: #fff !important;
}

.custom-navbar .navbar-brand i {
    font-size: 1.5rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.custom-navbar .nav-link {
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 500;
    font-size: 1rem;
    padding: 0.6rem 1.2rem !important;
    margin: 0 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    letter-spacing: 0.2px;
}

.custom-navbar .nav-link i {
    font-size: 1.1rem;
    margin-right: 0.4rem;
}

.custom-navbar .nav-link:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.custom-navbar .dropdown-menu {
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

.custom-navbar .dropdown-item {
    transition: all 0.2s ease;
    padding: 0.65rem 1.5rem;
    color: #1f2937;
    font-weight: 500;
    font-size: 0.95rem;
}

.custom-navbar .dropdown-item i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

.custom-navbar .dropdown-item:hover {
    background-color: #3b82f6;
    color: #fff;
}

.custom-navbar .badge {
    margin-left: 0.5rem;
    background-color: #ef4444 !important;
    animation: pulse 2s infinite;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    min-width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.05);
    }
}

.table-responsive {
    overflow-x: auto;
}

.img-thumbnail {
    max-width: 100%;
    height: auto;
}

/* 後台專用樣式 */
.sidebar {
    min-height: calc(100vh - 56px);
    background-color: #212529;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    margin: 0.25rem 0.5rem;
    transition: all 0.3s;
}

.sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    color: #fff;
    background-color: #0d6efd;
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
}

/* 輪播圖樣式 */
#carousel {
    position: relative;
    background-color: #f8f9fa;
}

/* 輪播圖控制按鈕 - 使用更具體的選擇器覆蓋 Bootstrap 預設樣式 */
#carousel.carousel .carousel-control-prev,
#carousel.carousel .carousel-control-next {
    width: 50px !important;
    height: 50px !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
    border-radius: 50% !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    opacity: 0.9 !important;
    transition: opacity 0.3s ease, background-color 0.3s ease !important;
    z-index: 100 !important;
    border: none !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}

#carousel.carousel .carousel-control-prev:hover,
#carousel.carousel .carousel-control-next:hover {
    opacity: 1 !important;
    background-color: rgba(0, 0, 0, 0.85) !important;
}

#carousel.carousel .carousel-control-prev {
    left: 20px !important;
}

#carousel.carousel .carousel-control-next {
    right: 20px !important;
}

#carousel.carousel .carousel-control-prev-icon,
#carousel.carousel .carousel-control-next-icon {
    width: 20px !important;
    height: 20px !important;
    filter: brightness(0) invert(1) !important;
    background-size: 20px 20px !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    margin: 0 !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
}

/* 輪播圖圖片樣式 - 保持原始比例 */
#carousel .carousel-inner {
    text-align: center;
    background-color: #f8f9fa;
}

#carousel .carousel-item {
    text-align: center;
    background-color: #f8f9fa;
    min-height: 200px;
    position: relative;
    z-index: 1;
    transition: opacity 0.3s ease-in-out;
    /* Bootstrap 預設：非 active 項目是 display: none */
    /* 我們不覆蓋這個，讓 Bootstrap 自己控制 */
}

/* active 項目使用 flex 來居中內容 */
#carousel .carousel-item.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 確保輪播項目中的連結不會覆蓋控制按鈕 */
#carousel .carousel-item a {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
}

#carousel .carousel-item img {
    max-width: 100% !important;
    max-height: 500px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    display: block !important;
}

/* 熱門商品區塊美化樣式 */
.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: #1e3a8a;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.section-subtitle {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 0;
    font-weight: 400;
}

/* 商品卡片樣式 */
.product-card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    background: #fff;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.product-image-wrapper {
    position: relative;
    height: 240px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 1rem;
}

.product-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-card .card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    min-height: 2.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ef4444;
    margin-bottom: 1rem;
    font-family: 'Inter', sans-serif;
}

.product-btn {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border: none;
    border-radius: 0.5rem;
    padding: 0.65rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    margin-top: auto;
}

.product-btn:hover {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.product-btn i {
    margin-right: 0.5rem;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .section-title {
        font-size: 1.75rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    .product-image-wrapper {
        height: 200px;
    }
    
    .product-title {
        font-size: 1rem;
        min-height: 2.4rem;
    }
    
    .product-price {
        font-size: 1.25rem;
    }
}
