:root {
    --primary: #007bff;
    --primary-dark: #0056b3;
    --secondary: #6c757d;
    --bg: #f8f9fa;
    --surface: #ffffff;
    --text: #212529;
    --text-muted: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --spacing-unit: 1rem;
    --border-radius: 8px;
    --box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    --transition-speed: 0.3s;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

header {
    background-color: var(--primary);
    color: white;
    padding: var(--spacing-unit) 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
}

nav .logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

nav ul li {
    margin-left: 1.5rem;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: 400;
    transition: color var(--transition-speed) ease;
    position: relative;
}

nav ul li a.active {
    font-weight: 700;
    text-decoration: underline;
}

nav ul li a:hover {
    color: #e2e6ea;
}

.cart-icon {
    position: relative;
    margin-left: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.cart-icon .badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: var(--danger);
    color: white;
    border-radius: 50%;
    padding: 0.2em 0.5em;
    font-size: 0.75rem;
    min-width: 20px;
    text-align: center;
    line-height: 1.2;
}

.cart-icon svg {
    fill: white;
    width: 24px;
    height: 24px;
}

.page-section {
    display: none;
    padding: calc(2 * var(--spacing-unit)) var(--spacing-unit);
    max-width: 1200px;
    margin: 0 auto;
    margin-bottom: calc(2 * var(--spacing-unit));
}

.page-section.active {
    display: block;
}

.page-section.content-section {
    background-color: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    animation: fadeIn 0.5s ease-in-out;
}

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

.page-section h2 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

/* Home Section */
#home {
    text-align: center;
    padding: 0;
    background-color: transparent;
    box-shadow: none;
}

.hero {
    background: linear-gradient(rgba(0, 123, 255, 0.7), rgba(0, 123, 255, 0.7)), url('https://placehold.co/1200x400/007bff/ffffff?text=Signed+Jerseys+Hub&font=raleway') no-repeat center center/cover;
    color: white;
    padding: 6rem var(--spacing-unit);
    border-radius: var(--border-radius);
    margin-bottom: calc(2 * var(--spacing-unit));
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-unit);
    line-height: 1.2;
}

.hero p {
    font-size: 1.5rem;
    margin-bottom: calc(2 * var(--spacing-unit));
}

.btn {
    background-color: var(--primary);
    color: white;
    padding: 0.8rem 1.8rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    transition: background-color var(--transition-speed) ease, transform 0.2s ease;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary);
}

.btn-secondary {
    background-color: var(--secondary);
}

.btn-danger {
    background-color: var(--danger);
}

.btn-success {
    background-color: var(--success);
}

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

.featured-products {
    padding: calc(2 * var(--spacing-unit)) 0;
}

.featured-products h3 {
    font-size: 2rem;
    margin-bottom: calc(2 * var(--spacing-unit));
    color: var(--text);
    text-align: center;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.product-card {
    background-color: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    text-align: center;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

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

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid #eee;
}

.product-card-content {
    padding: 1.5rem;
}

.product-card h4 {
    font-size: 1.4rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.product-card p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-unit);
    min-height: 60px; /* Ensure consistent height for description */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Limit to 3 lines */
    -webkit-box-orient: vertical;
}

.product-card .price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--spacing-unit);
}

/* Products Section */
#products .product-grid {
    margin-top: calc(2 * var(--spacing-unit));
}

/* About Section */
#about p {
    margin-bottom: var(--spacing-unit);
    font-size: 1.1rem;
    color: var(--text);
}

#about .mission-values, #about .our-story {
    margin-top: calc(2 * var(--spacing-unit));
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

#about h3 {
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: var(--spacing-unit);
}

#about ul {
    list-style: disc;
    margin-left: 20px;
    padding-left: 0;
}

#about ul li {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* Contact Section */
#contact .contact-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-unit);
    max-width: 600px;
    margin: 0 auto;
}

#contact .contact-form label {
    font-weight: 700;
    margin-bottom: 0.2rem;
    display: block;
}

#contact .contact-form input,
#contact .contact-form textarea {
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    transition: border-color var(--transition-speed) ease;
}

#contact .contact-form input:focus,
#contact .contact-form textarea:focus {
    border-color: var(--primary);
    outline: none;
}

#contact .contact-form textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group {
    margin-bottom: var(--spacing-unit);
}

.contact-info {
    margin-top: calc(2 * var(--spacing-unit));
    text-align: center;
}

.contact-info p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.alert {
    padding: var(--spacing-unit);
    border-radius: 5px;
    margin-top: var(--spacing-unit);
    font-size: 1rem;
    text-align: center;
}

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

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

/* Cart Section */
#cart .cart-items {
    margin-top: calc(2 * var(--spacing-unit));
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-unit) 0;
    border-bottom: 1px solid #eee;
}

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

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: var(--spacing-unit);
}

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

.cart-item-details h4 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text);
}

.cart-item-details p {
    margin: 0.2rem 0;
    color: var(--text-muted);
}

.cart-item-controls {
    display: flex;
    align-items: center;
}

.cart-item-controls button {
    background-color: var(--secondary);
    color: white;
    border: none;
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color var(--transition-speed) ease;
}

.cart-item-controls button:hover {
    background-color: #5a6268;
}

.cart-item-controls .quantity {
    margin: 0 0.8rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.cart-summary {
    margin-top: calc(2 * var(--spacing-unit));
    padding-top: 1.5rem;
    border-top: 2px solid #eee;
    text-align: right;
}

.cart-summary p {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: var(--spacing-unit);
}

.cart-empty-message {
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-top: 3rem;
}

.cart-empty-message .btn {
    margin-top: 1.5rem;
}

/* Checkout Modal */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1001; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--surface);
    margin: auto;
    padding: calc(2 * var(--spacing-unit));
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    animation: slideIn 0.3s ease-out;
}

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

.modal-content h3 {
    margin-top: 0;
    color: var(--primary);
    font-size: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-content .close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-content .close-button:hover,
.modal-content .close-button:focus {
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}

.checkout-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-unit);
}

.checkout-form label {
    font-weight: 700;
    margin-bottom: 0.2rem;
    display: block;
}

.checkout-form input,
.checkout-form textarea {
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.checkout-form .btn {
    margin-top: var(--spacing-unit);
    width: 100%;
}

footer {
    background-color: var(--text);
    color: white;
    text-align: center;
    padding: 1.5rem var(--spacing-unit);
    margin-top: calc(2 * var(--spacing-unit));
    font-size: 0.9rem;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

/* Loading Skeletons */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--border-radius);
}

.product-card.skeleton {
    height: 350px; /* Approximate height of a product card */
}

.skeleton-text {
    background-color: #e0e0e0;
    border-radius: 4px;
    height: 1em;
    margin-bottom: 0.5em;
    display: block;
}

.skeleton-text.long {
    width: 95%;
}

.skeleton-text.medium {
    width: 70%;
}

.skeleton-text.short {
    width: 40%;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        padding: 0.5rem var(--spacing-unit);
    }

    nav .logo {
        margin-bottom: 0.8rem;
    }

    nav ul {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.8rem;
    }

    nav ul li {
        margin: 0 0.8rem;
    }

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

    .hero p {
        font-size: 1.2rem;
    }

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

    .page-section {
        padding: 1.5rem var(--spacing-unit);
    }

    #contact .contact-form {
        max-width: 100%;
    }
}
