/* ================================================= */
/* === CÀI ĐẶT CHUNG VÀ BIẾN (muadt.css) === */
/* ================================================= */

:root {
    --primary-color: #0070c9; /* Xanh dương Apple */
    --secondary-color: #86868b; 
    --accent-color: #fa5252; /* Màu đỏ cho giá và mua ngay */
    --text-color-dark: #1d1d1f;
    --text-color-light: #6e6e73;
    --bg-color-light: #f5f5f7;
    --card-bg: #fff;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.08); 
    --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.15); 
}

/* Cài đặt lại CSS cơ bản */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    line-height: 1.5;
    color: var(--text-color-dark);
    background-color: var(--bg-color-light);
}

/* --- 1. HEADER & NAVIGATION --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    background-color: var(--card-bg);
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.1); 
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Logo */
.logo-container .logo {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text-color-dark);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: color 0.3s;
}

.logo-container .logo:hover {
    color: var(--primary-color);
}

.logo-container .logo i {
    font-size: 1.2em;
    margin-right: 8px;
    color: #a2a2a7; 
    transition: color 0.3s;
}

.logo-container .logo:hover i {
    color: var(--primary-color);
}

.main-nav a {
    text-decoration: none;
    color: var(--text-color-light);
    margin: 0 18px;
    padding: 8px 0;
    transition: color 0.3s;
}

.main-nav a:hover {
    color: var(--primary-color);
}

.account-icon, .cart-icon {
    font-size: 1em;
    color: var(--text-color-light);
    transition: color 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-actions {
    display: flex;
    gap: 20px;
}

#cart-count {
    background-color: var(--accent-color); 
    color: white;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 50%;
    font-size: 0.7em;
    line-height: 1;
}

.account-icon:hover, .cart-icon:hover {
    color: var(--text-color-dark);
}

/* Nút Quay lại Trang chủ */
.elegant-button {
    text-decoration: none;
    font-weight: 500;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    background-color: transparent;
    border-radius: 8px;
    color: var(--text-color-light);
    transition: all 0.3s ease-in-out;
    display: flex;
    align-items: center;
    gap: 8px;
}

.elegant-button:hover {
    background-color: #f1f1f1;
    color: var(--primary-color);
    border-color: var(--primary-color);
}


/* --- 2. HERO BANNER & FOOTER --- */
.hero-banner {
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364); 
    height: 450px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    position: relative;
}

.banner-content {
    background-color: rgba(0, 0, 0, 0.5); 
    padding: 40px 60px;
    border-radius: 10px;
}

.banner-content h1 {
    font-size: 3.5em;
    font-weight: 700;
    margin-bottom: 15px;
}

.btn-shop-now {
    background-color: var(--card-bg); 
    color: var(--text-color-dark);
    padding: 10px 25px;
    border-radius: 999px; 
    font-weight: 600;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
}
.btn-shop-now:hover {
    background-color: #e0e0e0;
}

footer {
    text-align: center;
    padding: 25px;
    background-color: var(--text-color-dark);
    color: #e0e0e0;
    margin-top: 40px;
}

/* --- 3. PRODUCT LISTING (Trang Chủ) --- */
.product-listing {
    padding: 60px 5%;
    text-align: center;
}

.product-listing h2 {
    font-size: 2em;
    font-weight: 600;
    margin-bottom: 40px;
    color: var(--text-color-dark);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.product-card {
    border-radius: 12px;
    overflow: hidden; 
    box-shadow: var(--shadow-light);
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
    background-color: var(--card-bg);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    justify-content: space-between; 
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.product-link {
    text-decoration: none;
    color: inherit;
    flex-grow: 1;
}

.product-image {
    background-color: var(--bg-color-light); 
    padding: 20px;
    position: relative;
    border-bottom: 1px solid #eee;
}

.product-image img {
    height: 150px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
}

.badge.new { background-color: var(--primary-color); }
.badge.sale { background-color: var(--accent-color); }

.product-card h3 {
    padding: 15px 15px 0;
    font-size: 1.2em;
    font-weight: 600;
}

.price {
    padding: 0 15px;
    font-size: 1.3em;
    color: var(--text-color-dark);
    font-weight: 700;
}

/* Nút "Xem thông tin chi tiết" trên Trang Chủ */
.btn-detail-view {
    display: block; 
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 999px; 
    margin: 15px;
    background-color: #f1f1f1; 
    color: var(--primary-color); 
    border: 1px solid var(--primary-color);
    font-weight: 600;
    transition: all 0.2s;
    align-self: flex-end; 
}

.btn-detail-view:hover {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 8px rgba(0, 112, 201, 0.3);
}


/* --- MODAL --- */
.modal {
    display: none; 
    position: fixed;
    z-index: 1001; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; 
    background-color: rgba(0,0,0,0.6); 
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    text-align: center;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
}

.auth-form {
    margin-top: 20px;
    transition: opacity 0.3s, transform 0.3s;
}

.auth-form.hidden {
    display: none;
}

.toggle-buttons button {
    padding: 10px 20px;
    border: none;
    background: #e9ecef;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}
.toggle-buttons button.active {
    background-color: var(--primary-color);
    color: white;
}

.input-group {
    text-align: left;
    margin-bottom: 15px;
}
.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}
.input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.submit-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
}
.submit-btn:hover {
    background-color: #005bb5;
}

.forgot-password {
    display: block;
    margin-top: 10px;
    color: var(--text-color-light);
    text-decoration: none;
}


/* ================================================= */
/* === TRANG CHI TIẾT SẢN PHẨM (iphone-16.html) === */
/* ================================================= */

.main-content-wrapper {
    max-width: 1280px;
    margin: 20px auto 40px;
    padding: 0 20px;
}

.product-detail-container {
    display: flex;
    gap: 40px;
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-light);
    margin-bottom: 30px;
}

/* 1. Cột Hình ảnh */
.product-images {
    flex: 1; 
    max-width: 50%;
    background-color: var(--bg-color-light);
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    overflow: hidden; 
    position: relative;
    cursor: zoom-in;
}

#main-product-image {
    max-height: 450px; 
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 15px;
    box-shadow: none;
    border-radius: 0;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94); 
}

.product-images:hover #main-product-image {
    transform: scale(1.05); 
}

.thumbnail-images {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.thumbnail {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    border: 2px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}

.thumbnail.active {
    border: 3px solid var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 112, 201, 0.3);
    opacity: 1;
}

/* 2. Cột Thông tin */
.product-info-column {
    flex: 1;
    padding: 0 20px;
}

.product-title {
    font-size: 2.2em;
    font-weight: 700;
    margin-bottom: 15px;
}

.price-section {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 25px;
}

.current-price {
    font-size: 2em;
    color: var(--accent-color);
    font-weight: 700;
    margin-right: 15px;
}

.old-price {
    text-decoration: line-through;
    color: var(--secondary-color);
    font-size: 1.1em;
}

.discount-badge {
    background-color: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    margin-left: 10px;
}

/* Biến thể và số lượng */
.product-variants {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.variant-label {
    font-weight: 600;
    color: var(--text-color-dark);
    margin-bottom: 10px;
    font-size: 1.1em;
}

.color-options {
    display: flex;
    gap: 15px;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ccc;
    transition: transform 0.2s, border-color 0.2s;
}

.color-swatch.active {
    border: 3px solid var(--primary-color);
    transform: scale(1.1);
}

.storage-options {
    display: flex;
    gap: 10px;
}

.storage-btn {
    padding: 10px 20px;
    border: 1px solid #ccc;
    background-color: var(--bg-color-light);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.storage-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.quantity-input {
    width: 80px;
    padding: 8px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 5px;
}


/* --- NÚT BẤM (ADD TO CART & BUY NOW) --- */
.action-buttons-group {
    display: flex;
    gap: 15px;
    margin-top: 35px;
}

.btn-add-to-cart, .btn-buy-now {
    padding: 16px 30px;
    border: none;
    border-radius: 999px; 
    cursor: pointer;
    font-size: 1.15em;
    font-weight: 600;
    transition: all 0.2s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: white;
}

.btn-add-to-cart {
    flex: 1.5;
    background-color: var(--primary-color); 
    box-shadow: 0 4px 15px rgba(0, 112, 201, 0.4); 
}

.btn-add-to-cart:hover {
    background-color: #005bb5; 
    box-shadow: 0 8px 20px rgba(0, 112, 201, 0.6); 
}

.btn-add-to-cart:active {
    transform: translateY(1px); 
    box-shadow: 0 2px 5px rgba(0, 112, 201, 0.4);
}

.btn-buy-now {
    flex: 1;
    background-color: var(--accent-color); 
    box-shadow: 0 4px 15px rgba(250, 82, 82, 0.4); 
}

.btn-buy-now:hover {
    background-color: #e54c4c;
    box-shadow: 0 8px 20px rgba(250, 82, 82, 0.6); 
}

.btn-buy-now:active {
    transform: translateY(1px); 
    box-shadow: 0 2px 5px rgba(250, 82, 82, 0.4);
}

/* 3. Phần Thông số & Mô tả */
.spec-detail-section {
    display: flex;
    gap: 30px;
    margin-top: 30px;
    padding: 0 20px;
    max-width: 1280px;
    margin: 30px auto 40px;
}

.specs-box, .description-box {
    flex: 1;
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--shadow-light);
}

.box-title {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 2px solid var(--bg-color-light);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.spec-list {
    list-style: none;
    padding: 0;
}

.spec-list li {
    padding: 10px 0;
    border-bottom: 1px dashed #eee;
    color: var(--text-color-dark);
    font-size: 1.05em;
}

.spec-list li:last-child {
    border-bottom: none;
}

.spec-list li i {
    color: var(--secondary-color);
    margin-right: 10px;
}

.description-box p {
    color: var(--text-color-light);
    line-height: 1.8;
}

/* ================================================= */
/* === TRANG GIỎ HÀNG (cart.html) === */
/* ================================================= */

.cart-page-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.cart-title {
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-color-dark);
}

.cart-content-wrapper {
    display: flex;
    gap: 30px;
}

/* 1. Danh sách sản phẩm (Chiếm phần lớn) */
.cart-items-list {
    flex: 2;
}

.cart-item {
    display: grid;
    /* Cột hình ảnh, chi tiết, giá/sp, số lượng, tổng phụ, xóa */
    grid-template-columns: 80px 3fr 1.5fr 1fr 1.5fr 0.5fr; 
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    background-color: var(--card-bg);
    margin-bottom: 10px;
    border-radius: 8px;
    padding-left: 15px;
    padding-right: 15px;
    position: relative;
}

.cart-item-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

.item-details {
    padding-left: 20px;
}

.item-name {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 5px;
}

.item-variant {
    color: var(--text-color-light);
    font-size: 0.9em;
}

.item-price, .item-subtotal {
    font-weight: 600;
    color: var(--text-color-dark);
    text-align: right;
    padding-right: 15px;
}

.item-quantity {
    text-align: center;
}

.quantity-input-cart {
    width: 60px;
    padding: 5px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.btn-remove-item {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 1.1em;
    transition: color 0.2s;
}
.btn-remove-item:hover {
    color: darkred;
}

/* 2. Tóm tắt đơn hàng */
.cart-summary {
    flex: 1;
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    height: fit-content; 
}

.summary-title {
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 1.05em;
    color: var(--text-color-dark);
}

.total-line {
    border-top: 1px solid #ddd;
    padding-top: 15px;
    margin-top: 15px;
    font-size: 1.2em;
    color: var(--accent-color);
}

.btn-checkout {
    width: 100%;
    padding: 15px;
    margin-top: 20px;
    background-color: var(--accent-color); 
    color: white;
    border: none;
    border-radius: 999px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn-checkout:hover {
    background-color: #e54c4c;
    box-shadow: 0 4px 10px rgba(250, 82, 82, 0.4);
}

.btn-continue-shopping {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}


/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    .product-detail-container {
        flex-direction: column;
        padding: 30px;
    }
    .product-images, .product-info-column {
        max-width: 100%;
        padding: 0;
    }
    .action-buttons-group {
        flex-direction: column;
    }
    .spec-detail-section {
        flex-direction: column;
    }
}
@media (max-width: 900px) {
    .cart-content-wrapper {
        flex-direction: column;
    }
    .cart-summary {
        margin-top: 20px;
    }
    .cart-item {
        grid-template-columns: 80px 3fr 1fr 1fr 0.5fr; 
        font-size: 0.9em;
    }
    .item-price {
        display: none; 
    }
    .item-details {
        padding-left: 10px;
    }
}
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 10px;
    }
    .main-nav {
        order: 3;
    }
    .header-actions {
        order: 2;
    }
    .product-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 600px) {
    .cart-item {
        grid-template-columns: 80px auto; 
        grid-template-rows: auto auto;
        gap: 5px 10px;
    }
    .item-details {
        grid-row: 1;
        grid-column: 2;
    }
    .item-quantity, .item-subtotal {
        grid-row: 2;
        padding-right: 0;
    }
    .item-quantity {
        grid-column: 1;
        text-align: left;
        padding-left: 10px;
    }
    .item-subtotal {
        grid-column: 2;
        text-align: right;
    }
    .btn-remove-item {
        position: absolute;
        top: 10px;
        right: 10px;
    }
}