/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
}

/* Header styles */
header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    display: flex;
    flex-direction: column; /* logo on top, links below */
    justify-content: center;
    align-items: center;
    gap: 0.5rem; /* space between logo and links */
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* (no hamburger; sticky header keeps brand visible) */

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center; /* center links under logo */
    gap: 1.25rem;
    flex-wrap: wrap; /* wrap on small screens */
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 0;
    padding: 0.35rem 0.15rem;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
}

/* No separators needed */
.nav-links a + a::before { content: none; }

.nav-links a:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.12);
}

.admin-login {
    background-color: #e74c3c;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
}

.admin-login:hover {
    background-color: #c0392b;
    color: white !important;
}

/* Hero section */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.6)), url('https://talksport.com/wp-content/uploads/sites/5/2022/09/GettyImages-1243565754.jpg');
    background-size: cover;
    background-position: 30% 30%;
    color: white;
    text-align: center;
    padding: 6rem 1rem;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* Products section */
.products {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

.products h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    color: #2c3e50;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.product-image {
    height: 300px;
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-info {
    padding: 1.5rem;
}

.product-info h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.price {
    font-size: 1.25rem;
    font-weight: bold;
    color: #e74c3c;
    margin: 0.5rem 0;
}

.size, .stock {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin: 0.25rem 0;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
}

/* Loading state */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
    color: #7f8c8d;
}

/* Skeleton loading */
.skeleton-card .product-image {
    background: #e5e7eb;
    position: relative;
}

.skeleton-box,
.skeleton-line {
    position: relative;
    overflow: hidden;
    background: #e5e7eb;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    margin: 10px 0;
}

.skeleton-line-lg { width: 70%; height: 16px; }
.skeleton-line-md { width: 50%; }
.skeleton-line-sm { width: 35%; }

.skeleton-box::after,
.skeleton-line::after {
    content: "";
    position: absolute;
    top: 0; left: -100%;
    height: 100%; width: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.5), rgba(255,255,255,0));
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Billing form inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

input:focus, select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

label { display:block; font-size: .9rem; color:#586174; margin-bottom: .35rem; }

/* Success modal */
.success-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    z-index: 2000;
}

.success-modal.open { display: flex; }

.success-content {
    background: #ffffff;
    width: min(92vw, 460px);
    padding: 2rem 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Checkmark animation */
.checkmark {
    width: 100px; height: 100px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    box-shadow: inset 0 0 0 5px #2ecc71;
    transform: scale(0.9);
    animation: pop .4s ease-out forwards .1s;
    margin-bottom: 0.75rem;
}

.checkmark-circle {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 0 5px #2ecc71;
}

.checkmark-stem {
    position: absolute;
    width: 6px;
    height: 40px;
    background: #2ecc71;
    left: 48px;
    top: 22px;
    transform: rotate(45deg) scaleY(0);
    transform-origin: top;
    animation: draw .35s ease-out forwards .3s;
}

.checkmark-kick {
    position: absolute;
    width: 6px;
    height: 22px;
    background: #2ecc71;
    left: 36px;
    top: 52px;
    transform: rotate(-45deg) scaleY(0);
    transform-origin: top;
    animation: draw .35s ease-out forwards .45s;
}

@keyframes pop {
    0% { transform: scale(0.9); }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes draw {
    to { transform: rotate(var(--r,45deg)) scaleY(1); }
}

/* Responsive design */
@media (max-width: 768px) {
    nav { padding: 1rem; gap: 0.5rem; }
    .nav-links { flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
    .nav-links a { margin: 0; }
    /* Billing page grid stacks on mobile */
    .checkout-summary { grid-template-columns: 1fr !important; }
    .summary-card, .billing-card { margin: 0 .25rem; }
    .hero h1 {
        font-size: 2rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Product page */
.product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-page {
    max-width: 1200px;
    margin: 2rem auto 4rem;
    padding: 0 2rem;
}

.product-view {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.gallery .main-image {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

.gallery .main-image img {
    width: 100%;
    height: auto;
    display: block;
}

.thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.thumb {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.thumb:hover { transform: scale(1.02); }
.thumb.active { border-color: #3498db; }

.details h1 { color: #2c3e50; margin-bottom: 0.5rem; }
.details .price { font-size: 1.5rem; color: #e74c3c; margin: 0.5rem 0 1rem; }
.details .meta { color: #7f8c8d; margin: 0.25rem 0; }
.details .meta.in { color: #27ae60; }
.details .meta.out { color: #e74c3c; }
.details .actions { margin-top: 1rem; }

@media (max-width: 900px) {
  .product-view { grid-template-columns: 1fr; }
}

/* Primary Button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: .75rem 1.25rem;
  font-weight: 700;
  letter-spacing: .2px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .25);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease, background .3s ease;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, .3);
  filter: brightness(1.03);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(37, 99, 235, .25);
}

.btn-primary:disabled {
  cursor: not-allowed;
  opacity: .7;
  filter: grayscale(10%);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .2), 0 8px 20px rgba(37, 99, 235, .25);
}

/* Make Buy Now button stand out on product page */
.product-page .details .actions .btn-primary {
  width: 100%;
  padding: .95rem 1.25rem;
  font-size: 1rem;
  border-radius: 12px;
}

.product-page .details .actions .btn-primary::after {
  content: '→';
  font-weight: 800;
  transform: translateX(0);
  transition: transform .15s ease;
}

.product-page .details .actions .btn-primary:hover::after {
  transform: translateX(2px);
}

/* Offline banner */
#offlineBanner.offline-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  background: #111827;
  color: #f9fafb;
  border: 1px solid #1f2937;
  border-radius: 999px;
  padding: .5rem .9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  font-size: .92rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 3000;
}

#offlineBanner.show { opacity: 0.95; pointer-events: auto; transform: translateX(-50%) translateY(0); }
