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

:root {
    /* Brand Colors */
    --brand-red: #D80027;      /* Deeper, more professional Canadian Red */
    --brand-dark: #111827;     /* Almost black for text */
    --brand-gray: #F3F4F6;     /* Light background gray */
    --brand-white: #FFFFFF;
    --brand-light: #f8f9fa;
    --brand-success: #28a745;
    --brand-warning: #ffc107;
    --brand-info: #17a2b8;
    
    /* UI Variables */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
}

body {
    background-color: var(--brand-gray);
    font-family: 'Inter', sans-serif;
    color: var(--brand-dark);
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

/* --- Accessibility --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for keyboard navigation */
*:focus {
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
}

/* --- Navigation --- */
.navbar-red {
    background: var(--brand-white);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.navbar-brand {
    color: var(--brand-red) !important;
    font-weight: 800;
    letter-spacing: -0.5px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    color: #4B5563 !important;
    font-weight: 500;
    margin-left: 1rem;
    transition: all 0.2s ease;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--brand-red) !important;
    background-color: rgba(216, 0, 39, 0.05);
    transform: translateY(-1px);
}

/* Mobile responsive nav */
.navbar-nav .nav-link {
    margin-left: 0;
    margin-right: 0.5rem;
}

.navbar-toggler {
    border-color: #ddd;
    border-radius: var(--radius-md);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2875, 85, 99, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* --- Hero Section --- */
header.bg-light {
    background: linear-gradient(135deg, #FFF5F5 0%, #FFFFFF 100%) !important;
    padding: 5rem 0;
    border-bottom: 1px solid #E5E7EB;
    margin-bottom: 2rem;
}

h1.display-4 {
    color: var(--brand-dark);
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.lead {
    color: #6B7280;
    font-weight: 400;
    font-size: 1.2rem;
    margin-bottom: 0;
}

/* Search and filter section */
.search-filter-section {
    background: var(--brand-white);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin: var(--spacing-lg) 0;
}

.input-group {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.form-control:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 0.2rem rgba(216, 0, 39, 0.25);
}

/* Filter controls */
.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-top: var(--spacing-md);
}

.filter-controls select,
.filter-controls button {
    min-width: auto;
    border-radius: var(--radius-md);
}

/* Improved container spacing */
.container.py-5 {
    padding-top: 1rem !important;
    padding-bottom: 3rem !important;
}

/* --- Product Cards --- */
.product-card {
    border: none;
    border-radius: var(--radius-lg);
    background: var(--brand-white);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-img-top {
    border-bottom: 1px solid #F3F4F6;
    background: #fff;
    padding: var(--spacing-md);
    height: 220px;
    object-fit: contain;
    transition: transform 0.3s ease;
    background-color: var(--brand-light);
}

.card-img-top:hover {
    transform: scale(1.05);
}

.card-body {
    padding: var(--spacing-md);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    flex-grow: 1;
    min-height: 3rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-text {
    margin-bottom: var(--spacing-sm);
    color: #6B7280;
    font-size: 0.9rem;
}

.card-price {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--brand-red);
    margin-bottom: var(--spacing-md);
    flex-grow: 1;
}

/* MAKE NAVBAR STICKY */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    width: 100%;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Improved buttons */
.btn-primary {
    background-color: var(--brand-red);
    border-color: var(--brand-red);
    transition: all 0.2s ease;
    border-radius: var(--radius-md);
    font-weight: 600;
    padding: 0.5rem 1rem;
}

.btn-primary:hover {
    background-color: #c00022;
    border-color: #c00022;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(216, 0, 39, 0.2);
}

.btn-outline-secondary {
    border-radius: var(--radius-md);
}

/* Cart badge improvements */
.badge.bg-danger.rounded-pill {
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    line-height: 1;
    position: relative;
    top: -2px;
}

/* Modal enhancements */
.modal-content {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: none;
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
}

/* Rating stars */
.rating-stars {
    display: flex;
    gap: 0.25rem;
    margin: 0.5rem 0;
}

.rating-stars i {
    font-size: 1.5rem;
    cursor: pointer;
    color: #ccc;
    transition: color 0.2s ease;
}

.rating-stars i.active,
.rating-stars i:hover {
    color: var(--brand-warning);
}

/* Loading spinner */
.spinner-border {
    width: 2rem;
    height: 2rem;
    color: var(--brand-red);
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6B7280;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header.bg-light {
        padding: 2rem 0;
    }
    
    h1.display-4 {
        font-size: 1.75rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .nav-link {
        margin-left: 0.5rem;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-controls select,
    .filter-controls button {
        width: 100%;
    }
    
    .product-card {
        margin-bottom: var(--spacing-md);
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .nav-link {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .card-img-top {
        height: 180px;
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Success and error messages */
.alert {
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin: var(--spacing-sm) 0;
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    border: 1px solid var(--brand-success);
    color: var(--brand-success);
}

.alert-error {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid #dc3545;
    color: #dc3545;
}

/* Wishlist button */
.wishlist-btn {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-white);
    border: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.wishlist-btn:hover {
    background: var(--brand-red);
    color: var(--brand-white);
    border-color: var(--brand-red);
}

.wishlist-btn.active {
    background: var(--brand-red);
    color: var(--brand-white);
}

/* Product category badges */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.category-atm {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.category-pos {
    background-color: rgba(25, 135, 84, 0.1);
    color: #198754;
}

.category-thermal {
    background-color: rgba(0, 123, 255, 0.1);
    color: #007bff;
}

/* Footer */
footer {
    background-color: var(--brand-dark);
    color: var(--brand-white);
    padding: var(--spacing-xl) 0;
    margin-top: var(--spacing-xl);
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #adb5bd;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--brand-white);
}