:root {
    --primary-color: #d70018;
    --primary-hover: #e02424;
    --bg-color: #f4f6f8;
    --card-bg: #fff;
    --text-color: #333;
    --text-light: #777;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Notification Banner */
.notification-banner {
    background: linear-gradient(90deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    color: #d70018;
    font-weight: 600;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 100;
}

.notification-banner p {
    flex: 1;
    margin-right: 20px;
}

.edit-btn {
    background-color: rgba(255, 255, 255, 0.7);
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    color: var(--primary-color);
    transition: background 0.2s;
}

.edit-btn:hover {
    background-color: #fff;
}

/* Header */
.main-header {
    background-color: var(--primary-color);
    color: #fff;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 99;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.logo img {
    height: 50px;
    width: auto;
    object-fit: contain;
    background: white;
    padding: 5px;
    border-radius: 8px;
}

.search-bar {
    flex: 1;
    display: flex;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.search-bar input {
    width: 100%;
    padding: 12px 15px;
    border: none;
    outline: none;
    font-size: 14px;
}

.search-btn {
    background: #fff;
    border: none;
    padding: 0 15px;
    color: var(--text-light);
    cursor: pointer;
}

.header-actions {
    display: flex;
    gap: 20px;
}

.action-btn {
    background: none;
    border: none;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    cursor: pointer;
    position: relative;
}

.cart-btn .cart-count {
    position: absolute;
    top: -5px;
    right: 5px;
    background: #f59e0b;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Navigation */
.main-nav {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0;
}

.nav-links {
    display: flex;
    list-style: none;
    overflow-x: auto;
}

.nav-links li {
    margin-right: 30px;
}

.nav-links a {
    display: block;
    padding: 15px 0;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.nav-links a:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Hero Section */
.hero {
    margin: 20px 0;
}

.hero-banner {
    background: linear-gradient(135deg, #111827 0%, #374151 100%);
    color: #fff;
    padding: 60px 40px;
    border-radius: var(--radius);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-banner h1 {
    font-size: 36px;
    margin-bottom: 15px;
}

.hero-banner p {
    font-size: 18px;
    color: #d1d5db;
    margin-bottom: 25px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

/* Sections */
.category-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 24px;
    color: var(--text-color);
}

/* Filters */
.filter-pills {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-pill {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-pill.active,
.filter-pill:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* Product Card */
.product-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: transparent;
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 15px;
    border-radius: 8px;
}

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
}

.product-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-variants {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.variant-tag {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
}

.variant-tag.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.product-price-old {
    font-size: 14px;
    color: var(--text-light);
    text-decoration: line-through;
}

/* Footer */
.main-footer {
    background: #fff;
    padding: 30px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: var(--radius);
    width: 400px;
    max-width: 90%;
}

.modal-content h2 {
    margin-bottom: 15px;
}

.modal-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
}

.close-btn {
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.series-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.series-btn {
    border: 1px solid #e5e7eb;
    background: #fff;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    color: #333;
    text-transform: uppercase;
}

.series-btn.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-row {
    margin-bottom: 10px;
}

.filter-label {
    font-weight: 700;
    font-size: 16px;
    margin-right: 15px;
}

.filter-pills {
    margin-bottom: 25px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.advanced-filter-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f3f4f6;
    border: 1px solid transparent;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    color: #444;
}

.advanced-filter-btn:hover {
    background: #e5e7eb;
}

.advanced-filter-btn.border-red {
    border-color: red;
    background: #fff;
    color: red;
}

.advanced-filter-btn.border-red:hover {
    background: #fee2e2;
}

.sort-row {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.sort-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sort-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    color: #444;
}

.sort-btn:hover {
    background: #f9fafb;
}

.sort-btn.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Phone Product Card Specifics */
.p-discount {
    position: absolute;
    top: 0px;
    left: 0px;
    background: red;
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px 0 12px 0;
    font-weight: bold;
    z-index: 2;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.p-installment {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #e0f2fe;
    color: #0284c7;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: bold;
    z-index: 2;
    border: 1px solid #bae6fd;
}

.p-badge {
    background: #dcfce7;
    color: #166534;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 8px;
    border: 1px solid #bbf7d0;
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.p-smember {
    background: #e0f2fe;
    color: #0284c7;
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 4px;
    font-weight: 500;
    margin-bottom: 8px;
    width: fit-content;
    border: 1px solid #bae6fd;
    display: flex;
    align-items: center;
    gap: 4px;
}

.p-installment-text {
    background: #f3f4f6;
    color: #4b5563;
    font-size: 11px;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 12px;
    line-height: 1.4;
    border: 1px solid #e5e7eb;
}

.p-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e5e7eb;
    padding-top: 10px;
    margin-top: auto;
}

.p-rating {
    font-size: 13px;
    color: #f59e0b;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 4px;
}

.p-wishlist {
    font-size: 13px;
    color: #3b82f6;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: color 0.2s;
}

.p-wishlist:hover {
    color: #2563eb;
}

.product-card {
    padding: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.product-title {
    height: 42px;
    font-size: 15px;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 10px;
}

.product-image {
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Product Variants */
.product-variants-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.variant-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.variant-btn {
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.storage-btn {
    padding: 4px 8px;
    font-size: 11px;
    background: #fff;
    color: #4b5563;
}

.storage-btn:hover {
    border-color: #9ca3af;
}

.storage-btn.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
    background: #fff1f2;
}

.color-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
    padding: 0;
    position: relative;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border: 2px solid var(--primary-color);
    outline: 1px solid #fff;
    outline-offset: -2px;
}

/* Detail Modal Styles */
.detail-modal {
    align-items: flex-start;
    padding-top: 50px;
    overflow-y: auto;
}

.detail-content {
    max-width: 1000px;
    width: 95%;
    position: relative;
    padding: 20px;
}

.detail-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 30px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-image-container {
    text-align: center;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}

.detail-image-container img {
    max-width: 100%;
    height: 350px;
    object-fit: contain;
}

.detail-specs h3 {
    margin-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 5px;
}

.detail-specs table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.detail-specs table tr {
    border-bottom: 1px solid #f3f4f6;
}

.detail-specs table td {
    padding: 8px 5px;
}

.detail-specs table td:first-child {
    color: #6b7280;
    width: 40%;
}

.detail-right h2 {
    font-size: 24px;
    margin-bottom: 15px;
}

.detail-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 15px;
}

.detail-price-row .price-display {
    font-size: 28px;
    color: var(--primary-color);
    font-weight: bold;
}

.detail-price-row .old-price-display {
    font-size: 16px;
    color: #9ca3af;
    text-decoration: line-through;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    margin-bottom: 10px;
    font-size: 14px;
    color: #374151;
}

.color-select-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-select-group .color-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    border: 1px solid #d1d5db;
}

.color-select-group .color-btn:hover {
    border-color: var(--primary-color);
}

.detail-promotions {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.detail-promotions h4 {
    margin-bottom: 10px;
    color: #d70018;
}

.detail-promotions ul {
    list-style: none;
    padding-left: 0;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-actions {
    display: flex;
    gap: 10px;
}

.detail-actions button {
    flex: 1;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: 0.2s;
}

.buy-btn {
    background: var(--primary-color);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.buy-btn:hover {
    background: var(--primary-hover);
}

.buy-btn small {
    font-size: 11px;
    font-weight: normal;
}

.add-cart-btn {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: #fff;
}

.add-cart-btn:hover {
    background: #fff1f2;
}

/* Keyboard access and reliable small-screen layouts. */
:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
button:disabled { opacity: .55; cursor: default; }
.category-section { scroll-margin-top: 140px; }
.close-btn { background: none; border: 0; cursor: pointer; color: #333; }
.modal-open { overflow: hidden; }
.product-image-button, .product-detail-trigger {
    display: block; width: 100%; padding: 0; background: none;
    border: 0; color: inherit; text-align: inherit; cursor: pointer; font: inherit;
}
.filter-control { display: inline-flex; gap: 6px; align-items: center; }
.filter-control select { max-width: 155px; border: 0; background: transparent; font: inherit; }
.cart-content { position: relative; width: min(640px, 94vw); max-height: 85vh; overflow-y: auto; }
.cart-items { margin: 20px 0; display: grid; gap: 14px; }
.cart-item { padding-bottom: 14px; border-bottom: 1px solid var(--border-color); }
.cart-item-title { font-weight: 600; }
.cart-item-price { color: var(--primary-color); margin: 4px 0 8px; }
.cart-item-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cart-item-controls button { border: 1px solid var(--border-color); border-radius: 6px; background: #fff; padding: 5px 12px; cursor: pointer; }
.cart-total { font-size: 20px; font-weight: 700; }
.cart-note { margin-top: 12px; color: var(--text-light); font-size: 14px; }
.store-message { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1200; background: #111827; color: #fff; padding: 12px 18px; border-radius: 8px; max-width: 90vw; box-shadow: var(--shadow); }
.noscript-notice { padding: 20px; text-align: center; background: #fff7ed; }
@media (max-width: 600px) {
    .header-container { flex-wrap: wrap; gap: 12px; }
    .search-bar { order: 3; flex-basis: 100%; }
    .header-actions { margin-left: auto; }
    .hero-banner { padding: 32px 18px; }
    .hero-banner h1 { font-size: 26px; }
    .hero-banner p { font-size: 16px; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .product-card { padding: 10px; min-width: 0; }
    .detail-image-container img { height: auto; max-height: 300px; }
    .detail-actions { flex-direction: column; }
    .series-nav, .sort-options { overflow-x: auto; }
}
@media (max-width: 360px) { .product-grid { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
