/* ==========================================
   1. 全域基礎設定 (Reset & Base Settings)
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, "Microsoft JhengHei";
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* ==========================================
   2. 頁首與導覽列 (Header & Navigation)
   ========================================== */
header {
    background-color: #ffffff;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .logo h1 {
    color: #ff7a45; /* 溫暖的寵物橘色 */
    font-size: 24px;
    display: flex;
    align-items: center;
}

header nav ul {
    display: flex;
    list-style: none;
}

header nav ul li {
    margin: 0 15px;
}

header nav ul li a {
    text-decoration: none;
    color: #555;
    font-weight: bold;
    font-size: 16px;
    transition: color 0.2s ease;
}

header nav ul li a:hover, 
header nav ul li a.active {
    color: #ff7a45;
}

/* 右上角購物車按鈕樣式 */
.cart-icon {
    background-color: #ff7a45;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    box-shadow: 0 4px 6px rgba(255, 122, 69, 0.2);
    transition: background 0.2s, transform 0.2s;
}

.cart-icon:hover {
    background-color: #e05e2b;
    transform: translateY(-2px);
}

/* ==========================================
   3. 首頁：分類篩選按鈕列 (Filter Section)
   ========================================== */
.filter-section {
    text-align: center;
    margin: 35px 0 25px 0;
}

.filter-btn {
    background-color: #fff;
    border: 2px solid #ff7a45;
    color: #ff7a45;
    padding: 8px 25px;
    margin: 0 6px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.filter-btn:hover, 
.filter-btn.active {
    background-color: #ff7a45;
    color: #fff;
    box-shadow: 0 4px 10px rgba(255, 122, 69, 0.3);
}

/* ==========================================
   4. 首頁：商品網格與卡片 (Product Grid & Card)
   ========================================== */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px 20px;
}

.product-grid {
    display: grid;
    /* 自動適應寬度：電腦4行、平板3行、手機1行 */
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 30px;
}

.product-card {
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #f0f0f0;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.08);
}

.product-card img {
    width: 100%;
    height: 190px;
    object-fit: cover; /* 確保圖片縮放不變形 */
    border-radius: 8px;
    background-color: #f7f7f7;
}

.product-card h3 {
    font-size: 17px;
    color: #333;
    margin: 15px 0 6px 0;
    font-weight: 600;
}

.product-card .price {
    color: #e63946; /* 顯眼的搶眼紅色 */
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.product-card .desc {
    color: #777;
    font-size: 13.5px;
    line-height: 1.45;
    margin-bottom: 15px;
    /* 限制文字最多顯示兩行，超出自動變 ... */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 38px; /* 固定的高度防止卡片高低不一 */
}

/* 加入購物車按鈕 */
.add-to-cart {
    background-color: #2a9d8f; /* 柔和舒適的綠色 */
    color: white;
    border: none;
    padding: 11px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    width: 100%;
    transition: background 0.2s, transform 0.1s;
}

.add-to-cart:hover {
    background-color: #21867a;
}

.add-to-cart:active {
    transform: scale(0.98); /* 點擊時有下壓回饋感 */
}

/* ==========================================
   5. 購物車頁面專用樣式 (Cart Page)
   ========================================== */
.cart-main {
    max-width: 850px;
    margin: 40px auto;
    background-color: #fff;
    padding: 35px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.cart-main h2 {
    font-size: 24px;
    color: #333;
    border-bottom: 3px solid #ff7a45;
    padding-bottom: 12px;
    margin-bottom: 25px;
}

/* 購物車單一商品列 */
.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    border-bottom: 1px solid #eee;
}

.cart-item img {
    width: 85px;
    height: 85px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

.cart-item-info {
    flex: 1;
    margin-left: 20px;
}

.cart-item-info h4 {
    font-size: 17px;
    color: #333;
    margin-bottom: 6px;
}

.cart-item-info p {
    color: #e63946;
    font-weight: 700;
    font-size: 16px;
}

/* 數量控制加減區 */
.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background-color: #fafafa;
}

.quantity-control button {
    background-color: transparent;
    border: none;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #555;
    transition: background 0.2s;
}

.quantity-control button:hover {
    background-color: #eee;
}

.quantity-control span {
    padding: 0 12px;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
    font-size: 15px;
}

/* 刪除按鈕 */
.delete-btn {
    background-color: #fff;
    color: #e63946;
    border: 1px solid #e63946;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 25px;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.2s;
}

.delete-btn:hover {
    background-color: #e63946;
    color: #fff;
}

/* 結帳金額總計區 */
.cart-summary {
    margin-top: 35px;
    text-align: right;
    border-top: 2px solid #f0f0f0;
    padding-top: 25px;
}

.summary-row {
    font-size: 19px;
    color: #555;
    margin-bottom: 20px;
}

.total-amount {
    color: #e63946;
    font-size: 28px;
    font-weight: 800;
    margin-left: 10px;
}

.checkout-btn {
    background-color: #ff7a45;
    color: white;
    border: none;
    padding: 14px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 122, 69, 0.2);
    transition: all 0.2s;
}

.checkout-btn:hover {
    background-color: #e05e2b;
    box-shadow: 0 6px 15px rgba(255, 122, 69, 0.3);
    transform: translateY(-2px);
}

/* ==========================================
   6. 頁尾 (Footer)
   ========================================== */
footer {
    text-align: center;
    padding: 25px;
    background-color: #2b2d42;
    color: #adb5bd;
    font-size: 14px;
    margin-top: 50px;
}

/* ====== 後台管理頁面專用樣式 ====== */
.admin-main {
    max-width: 1100px;
    margin: 40px auto;
    background-color: #fff;
    padding: 35px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.admin-main h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 5px;
}

.admin-tip {
    color: #888;
    font-size: 14px;
    margin-bottom: 25px;
}

/* 響應式表格容器 */
.table-responsive {
    overflow-x: auto;
}

/* 表格本體 */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    text-align: left;
}

.admin-table th, .admin-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    font-size: 15px;
}

.admin-table th {
    background-color: #f8f9fa;
    color: #555;
    font-weight: bold;
}

.admin-table tr:hover {
    background-color: #fdfdfd;
}

/* 狀態標籤樣式 */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: bold;
}

.status-pending { background-color: #ffeaa7; color: #d63031; } /* 備貨中 */
.status-shipped { background-color: #81ecec; color: #0984e3; } /* 已出貨 */
.status-completed { background-color: #55efc4; color: #00b894; } /* 已送達 */

/* 後台下拉選單與按鈕 */
.status-select {
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin-right: 10px;
}

.admin-delete-btn {
    background-color: #fff;
    color: #e63946;
    border: 1px solid #e63946;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.admin-delete-btn:hover {
    background-color: #e63946;
    color: #fff;
}