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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

a {
  color: #007bff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header & Navigation */
header {
  background-color: #2c3e50;
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
  font-size: 1.8rem;
}

nav {
  display: flex;
  gap: 2rem;
}

nav a {
  color: white;
  font-weight: 500;
}

nav a:hover {
  color: #ecf0f1;
  text-decoration: none;
}

.cart-link {
  background-color: #e74c3c;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  position: relative;
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #fff;
  color: #e74c3c;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
}

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

.product-card {
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

.product-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: #2c3e50;
}

.product-card p {
  color: #666;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.product-price {
  font-size: 1.5rem;
  color: #27ae60;
  font-weight: bold;
  margin-bottom: 1rem;
}

.product-id {
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 1rem;
}

/* Buttons */
button {
  background-color: #3498db;
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #2980b9;
}

button:active {
  transform: scale(0.98);
}

.btn-danger {
  background-color: #e74c3c;
}

.btn-danger:hover {
  background-color: #c0392b;
}

.btn-success {
  background-color: #27ae60;
}

.btn-success:hover {
  background-color: #229954;
}

.btn-secondary {
  background-color: #95a5a6;
}

.btn-secondary:hover {
  background-color: #7f8c8d;
}

/* Cart Table */
.cart-table {
  width: 100%;
  border-collapse: collapse;
  background-color: white;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.cart-table thead {
  background-color: #2c3e50;
  color: white;
}

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

.cart-table tbody tr:hover {
  background-color: #f9f9f9;
}

.cart-table th {
  font-weight: 600;
}

.cart-subtotal {
  font-weight: bold;
  color: #27ae60;
  font-size: 1.1rem;
}

/* Cart Summary */
.cart-summary {
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  max-width: 400px;
  margin-left: auto;
}

.cart-summary h2 {
  margin-bottom: 1.5rem;
  color: #2c3e50;
}

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

.summary-row.total {
  border-top: 2px solid #ddd;
  padding-top: 1rem;
  font-weight: bold;
  font-size: 1.2rem;
  color: #27ae60;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #2c3e50;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 4px rgba(52, 152, 219, 0.3);
}

/* Messages */
.alert {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error,
.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Loading & Empty States */
.loading {
  text-align: center;
  padding: 2rem;
  font-size: 1.1rem;
  color: #666;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  background-color: white;
  border-radius: 8px;
  color: #666;
}

.empty-state h2 {
  margin-bottom: 1rem;
  color: #2c3e50;
}

/* Responsive */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 1rem;
  }

  nav {
    gap: 1rem;
    width: 100%;
    justify-content: space-around;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }

  .product-card {
    padding: 1rem;
  }

  .cart-summary {
    max-width: 100%;
    margin-left: 0;
    margin-top: 2rem;
  }

  .container {
    padding: 0 1rem;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.4rem;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }

  nav {
    flex-direction: column;
  }

  nav a {
    padding: 0.5rem 0;
  }

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

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

  button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
}
