@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #0f766e;
  --primary-dark: #065f46;
  --primary-light: #10b981;
  --bg: #f0fdf4;
  --dark: #0f172a;
  --muted: #64748b;
  --white: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --radius: 16px;
  --danger: #ef4444;
  --success: #22c55e;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--dark);
  line-height: 1.6;
}

/* ===== TOP NAV ===== */
.top-nav {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0.8rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-nav .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--primary);
  text-decoration: none;
}

.top-nav .brand img { width: 32px; height: 32px; border-radius: 6px; }

.top-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.top-nav .nav-links a {
  text-decoration: none;
  color: var(--dark);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.3s;
}

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

.top-nav .nav-links a.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 2px;
}

.cart-icon {
  position: relative;
  font-size: 1.3rem;
  cursor: pointer;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--danger);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-menu .user-name {
  font-size: 0.85rem;
  color: var(--muted);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.3s;
}

.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ===== PAGE CONTAINER ===== */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.page-subtitle {
  color: var(--muted);
  margin-bottom: 2rem;
}

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

.product-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}

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

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

.product-info {
  padding: 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-category {
  font-size: 0.75rem;
  color: var(--primary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 0.3rem;
}

.product-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.product-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.product-stock {
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 500;
}

.product-stock.out { color: var(--danger); }

.btn-add-cart {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-add-cart:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

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

/* ===== CART PAGE ===== */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2rem;
  align-items: start;
}

.cart-items { display: flex; flex-direction: column; gap: 1rem; }

.cart-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  box-shadow: var(--shadow);
}

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

.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; margin-bottom: 0.2rem; }
.cart-item-price { color: var(--primary-dark); font-weight: 700; }

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

.qty-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

.qty-value {
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.4rem;
  transition: opacity 0.3s;
}

.btn-remove:hover { opacity: 0.7; }

/* ===== ORDER SUMMARY ===== */
.order-summary {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 80px;
}

.order-summary h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
}

.summary-row.total {
  font-weight: 700;
  font-size: 1.15rem;
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
  margin-top: 0.8rem;
  color: var(--primary-dark);
}

.btn-checkout {
  width: 100%;
  padding: 0.9rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  transition: all 0.3s;
}

.btn-checkout:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15,118,110,0.3);
}

/* ===== CHECKOUT FORM ===== */
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  align-items: start;
}

.shipping-form {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.shipping-form h3 { margin-bottom: 1.5rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--dark);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border 0.3s;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}

.btn-pay {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 1rem;
  transition: all 0.3s;
}

.btn-pay:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15,118,110,0.3);
}

/* ===== ORDERS PAGE ===== */
.order-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.2rem;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.order-id { font-weight: 700; }
.order-date { color: var(--muted); font-size: 0.85rem; }

.order-status {
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending { background: #fef3c7; color: #d97706; }
.status-confirmed { background: #dbeafe; color: #2563eb; }
.status-shipped { background: #e0e7ff; color: #4f46e5; }
.status-delivered { background: #dcfce7; color: #16a34a; }
.status-cancelled { background: #fee2e2; color: #dc2626; }

.order-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.order-item-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.9rem;
}

.order-item-row img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
}

.order-total {
  text-align: right;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary-dark);
}

/* ===== NOTIFICATIONS DROPDOWN ===== */
.notif-dropdown {
  position: absolute;
  top: 50px;
  right: 0;
  width: 340px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  z-index: 2000;
  display: none;
}

.notif-dropdown.open { display: block; }

.notif-dropdown-header {
  padding: 1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.notif-item {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #ecfdf5; }

.notif-title { font-weight: 600; font-size: 0.85rem; }
.notif-message { font-size: 0.8rem; color: var(--muted); margin-top: 0.2rem; }
.notif-time { font-size: 0.7rem; color: #94a3b8; margin-top: 0.2rem; }

/* ===== ALERTS ===== */
.alert {
  padding: 1rem 1.2rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: none;
}

.alert.show { display: block; animation: fadeIn 0.3s ease; }
.alert.error { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.alert.success { background: #dcfce7; color: #16a34a; border: 1px solid #86efac; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.empty-state p { color: var(--muted); margin-bottom: 1.5rem; }

.btn-primary {
  display: inline-block;
  padding: 0.7rem 1.6rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .cart-layout, .checkout-layout {
    grid-template-columns: 1fr;
  }

  .form-row { grid-template-columns: 1fr; }

  .top-nav {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .top-nav .nav-links {
    gap: 0.8rem;
    font-size: 0.85rem;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}
