/* Global Styles & Variables */
:root {
  --primary-color: #2874f0; /* Flipkart-ish Blue */
  --primary-dark: #1a5ac7;
  --secondary-color: #fb641b; /* Accent Orange */
  --text-color: #212121;
  --light-text: #878787;
  --bg-color: #f1f3f6;
  --white: #ffffff;
  --border-color: #e0e0e0;
  --success-color: #388e3c;
  --shadow: 0 2px 4px 0 rgba(0,0,0,.08);
  --radius: 4px;
  --container-width: 1200px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  padding-top: 80px; /* Space for sticky header */
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.main-header {
  background-color: var(--primary-color);
  color: var(--white);
  height: 64px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
  font-style: italic;
  margin-right: 2rem;
}

.logo span {
  color: #ffe500;
}

.search-bar {
  flex: 1;
  max-width: 500px;
  position: relative;
  margin: 0 20px;
}

.search-bar input {
  width: 100%;
  padding: 10px 16px;
  border-radius: 2px;
  border: none;
  outline: none;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
  font-weight: 500;
}

.nav-links a {
  color: var(--white);
  font-size: 16px;
  transition: opacity 0.2s;
}

.nav-links a:hover {
  opacity: 0.9;
}

.cart-icon {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-count {
  position: absolute;
  top: -8px;
  left: 12px;
  background-color: var(--secondary-color);
  color: var(--white);
  font-size: 10px;
  font-weight: bold;
  height: 16px;
  min-width: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 4px;
}

/* Footer */
footer {
  background-color: #172337;
  color: var(--white);
  padding: 40px 0;
  margin-top: 60px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
}

.footer-col h3 {
  color: #878787;
  font-size: 12px;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.footer-col a {
  display: block;
  color: var(--white);
  margin-bottom: 8px;
  font-size: 12px;
}

.footer-col a:hover {
  text-decoration: underline;
}

/* Components */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 2px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary {
  background-color: var(--secondary-color);
  color: var(--white);
  box-shadow: 0 1px 2px 0 rgba(0,0,0,.2);
}

.btn-primary:hover {
  background-color: #e45b18;
}

.btn-secondary {
  background-color: var(--white);
  color: var(--primary-color);
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 2px 0 rgba(0,0,0,.1);
}

.btn-secondary:hover {
  box-shadow: 0 2px 4px 0 rgba(0,0,0,.15);
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Utility */
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.section-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

/* Home Page */
.hero {
  height: 400px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--white);
  position: relative;
  margin-bottom: 24px;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 48px;
  margin-bottom: 16px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.category-card {
  background: var(--white);
  padding: 16px;
  text-align: center;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.2s;
  cursor: pointer;
}

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

.category-card img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  margin-bottom: 12px;
}

.category-card h3 {
  font-size: 16px;
  font-weight: 500;
}

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

.product-card {
  background: var(--white);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  transition: box-shadow 0.2s;
}

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

.product-card button:hover { background-color: #218838; }

.product-card h3 { margin-top: 0; }
.product-card button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

.product-card img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  margin-bottom: 16px;
}

.product-info h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-price {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 12px;
}

.like-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #c2c2c2;
  transition: color 0.2s;
}

.like-btn.active {
  color: #ff4343;
}

/* Checkout Section */
#checkout-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Admin Table */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}
th { background-color: #f8f9fa; }

/* My Orders */
.order-card {
    background: white;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border-left: 5px solid #007bff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.status.pending { color: orange; }
.status.shipped { color: blue; }
.status.delivered { color: green; }
.status.cancelled { color: red; }

/* Single Product */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.gallery-main {
  width: 100%;
  height: 400px;
  object-fit: contain;
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.gallery-thumbs {
  display: flex;
  gap: 10px;
}

.gallery-thumbs img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.gallery-thumbs img:hover {
  border-color: var(--primary-color);
}

.product-actions {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

.product-actions .btn {
  flex: 1;
}

/* Cart */
.cart-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.cart-items {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cart-item {
  display: flex;
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
}

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

.cart-item-img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  margin-right: 24px;
}

.cart-item-details {
  flex: 1;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--white);
  cursor: pointer;
}

.price-details {
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  height: fit-content;
}

.price-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.price-row.total {
  border-top: 1px dashed var(--border-color);
  padding-top: 16px;
  font-weight: 600;
  font-size: 18px;
}

/* Forms */
.auth-form {
  max-width: 400px;
  margin: 40px auto;
  background: var(--white);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--light-text);
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  font-size: 14px;
}

.form-group input:focus {
  border-color: var(--primary-color);
}

/* Profile */
.profile-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 24px;
}

.sidebar-nav {
  background: var(--white);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
}

.sidebar-nav a {
  display: block;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 500;
  color: var(--light-text);
}

.sidebar-nav a:hover, .sidebar-nav a.active {
  background-color: #f5faff;
  color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links {
    display: none; /* Mobile menu implementation optional for this scope */
  }
  
  .cart-container, .product-detail, .profile-layout {
    grid-template-columns: 1fr;
  }
}

/* Order Timeline & Status */
.timeline { position: relative; padding: 20px 0; margin-left: 20px; border-left: 2px solid #eee; }
.timeline-item { margin-bottom: 20px; padding-left: 20px; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; background: #2874f0; border-radius: 50%; }
.status-tag { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: uppercase; }
.status-pending { background: #fff3cd; color: #856404; }
.status-verified { background: #d4edda; color: #155724; }
.status-shipped { background: #cce5ff; color: #004085; }
.status-delivered { background: #d1ecf1; color: #0c5460; }
