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

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

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-brand h1 {
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: white;
}

.cart-badge {
    background: #ef4444;
    color: white;
    padding: 0.1rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

/* Main container */
#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Products grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

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

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-card-body {
    padding: 1.25rem;
}

.product-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #1e3a8a;
}

.product-card .description {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    min-height: 2.8rem;
}

.product-card .price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #3b82f6;
}

.product-card .rating {
    color: #f59e0b;
    margin: 0.5rem 0;
}

.btn {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

/* Search & Sort bar */
.search-sort-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.6rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #3b82f6;
}

.sort-select {
    padding: 0.6rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    outline: none;
}

.sort-select:focus {
    border-color: #3b82f6;
}

/* Filter */
.filter-bar {
    margin-bottom: 2rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: white;
    border: 2px solid #e5e7eb;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

/* Product detail */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.product-detail img {
    width: 100%;
    border-radius: 8px;
}

.product-detail h2 {
    color: #1e3a8a;
    margin-bottom: 1rem;
}

.product-detail .price {
    font-size: 2rem;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 1rem;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.quantity-selector button {
    width: 40px;
    height: 40px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
}

.quantity-selector span {
    font-size: 1.25rem;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

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

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 1.5rem;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-summary {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e5e7eb;
}

.cart-summary .total {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e3a8a;
    margin-bottom: 1.5rem;
}

/* Checkout form */
.checkout-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.order-summary {
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: 8px;
    height: fit-content;
}

.order-summary h3 {
    color: #1e3a8a;
    margin-bottom: 1rem;
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

/* Order Confirmation Page */
.order-confirmation {
    max-width: 640px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    padding: 3rem 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}

.order-success-icon {
    width: 64px;
    height: 64px;
    background: #059669;
    color: white;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 64px;
    margin: 0 auto 1.5rem;
}

.order-confirmation h2 {
    color: #059669;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.order-id {
    font-size: 0.9rem;
    color: #6b7280;
    font-family: monospace;
    margin-bottom: 0.5rem;
}

.order-meta {
    color: #6b7280;
    margin-bottom: 2rem;
}

.order-summary {
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: left;
    margin-top: 1.5rem;
}

.order-summary h3 {
    color: #1e3a8a;
    margin-bottom: 1rem;
}

.order-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.order-table th {
    text-align: left;
    padding: 0.5rem 0;
    border-bottom: 2px solid #e5e7eb;
    color: #374151;
}

.order-table td {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.order-table tfoot td {
    border-bottom: none;
    border-top: 2px solid #3b82f6;
    padding-top: 0.75rem;
    color: #1e3a8a;
}

/* Success message */
.success-message {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.success-message h2 {
    color: #059669;
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

/* Responsive */
@media (max-width: 768px) {
    .product-detail {
        grid-template-columns: 1fr;
    }
    
    .checkout-form {
        grid-template-columns: 1fr;
    }
    
    .cart-item {
        grid-template-columns: 60px 1fr;
    }
    
    .cart-item-actions {
        grid-column: 2;
    }
}

/* ===== Phase 4: Auth styles ===== */
.auth-container {
    max-width: 420px;
    margin: 3rem auto;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.auth-container h2 { margin-bottom: 1.5rem; color: #1e293b; }
.auth-form .form-group { margin-bottom: 1.2rem; }
.auth-switch { margin-top: 1.2rem; text-align: center; color: #64748b; font-size: 0.9rem; }
.auth-switch a { color: #3b82f6; text-decoration: none; }
.form-error { color: #ef4444; font-size: 0.875rem; padding: 0.5rem; background: #fef2f2; border-radius: 6px; margin-bottom: 0.8rem; }
.btn-secondary { background: #64748b; color: white; border: none; padding: 0.5rem 1.2rem; border-radius: 8px; cursor: pointer; font-size: 0.9rem; }
.btn-secondary:hover { background: #475569; }

/* Account page */
.account-container { max-width: 800px; margin: 2rem auto; padding: 0 1rem; }
.account-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.account-header h2 { margin: 0; }
.account-email { color: #64748b; flex: 1; }
.order-card { background: white; border-radius: 10px; padding: 1.2rem 1.5rem; margin-bottom: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.order-card-header { display: flex; gap: 1rem; align-items: center; margin-bottom: 0.8rem; flex-wrap: wrap; }
.order-id { font-family: monospace; font-size: 0.85rem; color: #64748b; }
.order-date { color: #94a3b8; font-size: 0.875rem; }
.order-total { font-weight: 700; color: #1e293b; margin-left: auto; }
.order-items-list { list-style: none; padding: 0; margin: 0; }
.order-items-list li { font-size: 0.9rem; color: #475569; padding: 0.25rem 0; border-top: 1px solid #f1f5f9; }
.empty-state { color: #94a3b8; text-align: center; padding: 2rem; }
.error-message { color: #ef4444; }
