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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

header {
    background: #f5f0e8;
    color: #333;
    padding: 0.15rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 800;
    border-bottom: 1px solid #ddd;
}

header h1 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    line-height: 1;
}

.header-logo {
    height: 227px;
    width: auto;
    margin: -49px -32px;
    object-fit: cover;
}

header nav a {
    color: #333;
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
}

header nav a:hover {
    text-decoration: underline;
}

.cart-count {
    background: #e94560;
    color: white;
    border-radius: 50%;
    padding: 0.1rem 0.5rem;
    font-size: 0.8rem;
    margin-left: 0.3rem;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.product-card:hover {
    transform: translateY(-4px);
}

.product-card img {
    width: 100%;
    height: 250px;
    object-fit: contain;
    background: white;
    padding: 0.5rem;
}

.product-info {
    padding: 1rem;
}

.product-brand {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.5px;
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.3rem 0;
}

.product-name a {
    color: #333;
    text-decoration: none;
}

.product-name a:hover {
    color: #1a1a2e;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #e94560;
}

.product-price .original {
    text-decoration: line-through;
    color: #999;
    font-size: 0.9rem;
    font-weight: 400;
    margin-left: 0.5rem;
}

.product-price .discount-badge {
    background: #e94560;
    color: white;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-left: 0.5rem;
}

.size-selector {
    margin: 0.8rem 0;
}

.size-selector label {
    font-size: 0.85rem;
    font-weight: 500;
}

.size-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.size-stock {
    font-size: 0.7rem;
}

.size-stock.in-stock {
    color: #28a745;
}

.size-stock.no-stock {
    color: #dc3545;
}

.size-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.3rem;
}

.size-btn {
    padding: 0.3rem 0.7rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
}

.size-btn:hover:not(:disabled) {
    border-color: #1a1a2e;
}

.size-btn.selected {
    border-color: #1a1a2e;
    background: #1a1a2e;
    color: white;
}

.size-btn:disabled {
    background: #f0f0f0;
    color: #bbb;
    border-color: #eee;
    cursor: not-allowed;
    text-decoration: line-through;
}

.qty-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 0;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.15s;
}

.qty-btn:hover {
    background: #e0e0e0;
}

.qty-minus {
    border-radius: 4px 0 0 4px;
}

.qty-plus {
    border-radius: 0 4px 4px 0;
}

.qty-row input {
    width: 40px;
    height: 32px;
    padding: 0;
    border: 1px solid #ddd;
    border-left: none;
    border-right: none;
    border-radius: 0;
    text-align: center;
    font-size: 0.9rem;
    -moz-appearance: textfield;
}

.qty-row input::-webkit-outer-spin-button,
.qty-row input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.add-to-cart-btn {
    width: 100%;
    padding: 0.6rem;
    background: #1a1a2e;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}

.add-to-cart-btn:hover:not(:disabled) {
    background: #16213e;
}

.add-to-cart-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Cart page */
.cart-container {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.cart-table th,
.cart-table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.cart-table th {
    font-weight: 600;
    color: #666;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.cart-total {
    text-align: right;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 1rem 0;
}

.remove-btn {
    background: none;
    border: none;
    color: #e94560;
    cursor: pointer;
    font-size: 0.9rem;
}

.remove-btn:hover {
    text-decoration: underline;
}

.checkout-form {
    max-width: 400px;
    margin-top: 2rem;
}

.checkout-form h2 {
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
}

.form-group input:focus {
    outline: none;
    border-color: #1a1a2e;
}

.submit-btn {
    padding: 0.8rem 2rem;
    background: #e94560;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-btn:hover:not(:disabled) {
    background: #c23152;
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.empty-cart {
    text-align: center;
    padding: 3rem;
    color: #888;
}

.empty-cart a {
    color: #1a1a2e;
    font-weight: 600;
}

.message {
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    display: block;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    display: block;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: #888;
}

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

.modal-box {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    max-width: 420px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-box p {
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    cursor: pointer;
}

.modal-yes {
    background: #1a1a2e;
    color: white;
}

.modal-yes:hover {
    background: #16213e;
}

.modal-no {
    background: #eee;
    color: #333;
}

.modal-no:hover {
    background: #ddd;
}

/* Cart sidebar */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 33.33%;
    min-width: 320px;
    height: 100%;
    background: white;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 950;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.cart-sidebar.open {
    transform: translateX(0);
}

.cart-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    background: #1a1a2e;
    color: white;
}

.cart-sidebar-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.cart-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.3rem;
}

.cart-close-btn:hover {
    opacity: 0.7;
}

#cart-content {
    flex: 1;
    padding: 1rem 1.5rem;
    overflow-y: auto;
}

#cart-content .empty-cart {
    padding: 2rem 0;
}

#cart-content .cart-table {
    font-size: 0.9rem;
}

#cart-content .cart-table th,
#cart-content .cart-table td {
    padding: 0.5rem 0.4rem;
}

#cart-content .checkout-form {
    max-width: 100%;
    margin-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.cart-sidebar .message {
    margin: 0 1.5rem 1rem;
}
