* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: #f8fafc; color: #0f172a; }
a { color: inherit; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 24px; background: #ffffff; border-bottom: 1px solid #e2e8f0; }
.brand { font-size: 20px; font-weight: 800; text-decoration: none; }
.nav { display: flex; gap: 16px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: #334155; }

/* Управление юзером и корзиной */
.user-actions { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.cart-btn { background: #f1f5f9; color: #0f172a; border: 1px solid #cbd5e1; }
.cart-btn:hover { background: #e2e8f0; }

.user-profile { position: relative; display: flex; align-items: center; }
.avatar-btn { width: 40px; height: 40px; border-radius: 50%; background: #2563eb; color: #ffffff; border: none; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: bold; cursor: pointer; text-transform: uppercase; }
.avatar-btn:hover { background: #1d4ed8; }
.dropdown-menu { position: absolute; top: 50px; right: 0; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 10px 25px rgba(15, 23, 42, 0.1); display: none; flex-direction: column; min-width: 180px; overflow: hidden; z-index: 100; }
.dropdown-menu.show { display: flex; }
.dropdown-item { padding: 12px 16px; text-decoration: none; color: #0f172a; border-bottom: 1px solid #f1f5f9; background: none; border-left:none; border-right:none; border-top:none; text-align: left; cursor: pointer; font-size: 14px; }
.dropdown-item:hover { background: #f8fafc; }
.dropdown-item.logout { color: #dc2626; border-bottom: none; font-weight: bold; }

.page { max-width: 1100px; margin: 0 auto; padding: 32px 24px 64px; }
.hero { min-height: calc(100vh - 80px); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px; text-align: center; padding: 24px; }
.hero h1 { margin: 0; font-size: 58px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 20px; padding: 24px; box-shadow: 0 10px 25px rgba(15, 23, 42, 0.05); }
.auth-card { max-width: 460px; margin: 40px auto; }
.form-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

input { border: 1px solid #cbd5e1; border-radius: 12px; padding: 12px 14px; font-size: 16px; }
input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border: none; border-radius: 12px; background: #2563eb; color: #ffffff; text-decoration: none; font-weight: 600; cursor: pointer; }
.btn:hover { opacity: 0.95; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: #0f172a; }
.btn-small { padding: 9px 14px; font-size: 14px; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 15px; }
.status { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: #eff6ff; color: #1d4ed8; }
.status.error { background: #fef2f2; color: #b91c1c; }
.status:empty { display: none; }

.section-title { margin: 0 0 20px; font-size: 28px; }
.small-note { font-size: 14px; color: #64748b; }

.products-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.price-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.new-price { font-size: 28px; font-weight: 800; }
.old-price { color: #94a3b8; text-decoration: line-through; font-size: 18px; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #fee2e2; color: #991b1b; }

.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;}
.modal.hidden { display: none; }
.modal-content { width: 100%; max-width: 480px; background: #ffffff; border-radius: 20px; padding: 24px; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25); max-height: 90vh; overflow-y: auto;}

.product-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; background: #fff; padding: 30px; border-radius: 20px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); }
.product-image { background: #f8fafc; border-radius: 16px; min-height: 300px; display: flex; align-items: center; justify-content: center; font-size: 80px; color: #cbd5e1; border: 1px solid #e2e8f0;}
.qty-selector { display: flex; align-items: center; gap: 10px; margin: 20px 0; }
.qty-selector input { width: 80px; text-align: center; }
.meta { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 8px; color: #475569; }

.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #e2e8f0; }
.cart-total { font-size: 20px; font-weight: bold; text-align: right; margin: 20px 0; }
.checkout-form { display: grid; gap: 12px; margin-bottom: 20px; }
.checkout-form h3 { margin: 10px 0 0 0; font-size: 16px;}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-group { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; margin-top: 10px;}
.checkbox-group input { width: auto; }

.hidden { display: none !important; }

@media (max-width: 768px) {
  .product-layout { grid-template-columns: 1fr; }
}