/* Custom CSS for eCommerce Site */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 0.5rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition: all 0.3s ease;
}

/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    /* Background color will be set dynamically by header.php */
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

/* Navigation */
.navbar-brand {
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    transition: var(--transition);
    padding: 0.5rem 1rem;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

#cartBadge {
    font-size: 0.7rem;
    min-width: 1.2rem;
    height: 1.2rem;
    line-height: 1.2rem;
    text-align: center;
}

/* Hero Section */
.hero-section {
    min-height: 70vh;
    display: flex;
    align-items: center;
}

.hero-image {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.hero-buttons .btn {
    margin: 0.25rem;
    min-width: 160px;
}

/* Features Section */
.feature-card {
    /* Styling will be handled dynamically by header.php */
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.feature-icon {
    transition: var(--transition);
}

.feature-card:hover .feature-icon {
    transform: scale(1.1);
}

/* Product Cards */
.product-card {
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.product-image {
    position: relative;
    overflow: hidden;
    height: 250px;
    background: var(--light-color);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.product-card:hover .product-overlay {
    opacity: 1;
}

/* Card Body Flexbox Layout */
.product-card .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.25rem;
}

.product-card .card-title {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    min-height: 2.6rem; /* Reserve space for 2 lines of text */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Homepage featured products - single line titles with ellipsis */
.featured-products-section .product-card .card-title,
.featured-products-section .product-card h6.card-title {
    min-height: 1.3rem !important; /* Single line height */
    max-height: 1.3rem !important; /* Enforce single line */
    display: block !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
    -webkit-box: unset !important;
}

.product-card .card-text {
    margin-bottom: 0.75rem;
    flex-grow: 0;
    flex-shrink: 0;
    font-size: 0.875rem;
    line-height: 1.4;
    min-height: 1.225rem; /* Reserve space for at least one line */
}

.product-card .product-variations {
    margin-bottom: 1rem;
    flex-grow: 0;
    flex-shrink: 0;
    font-size: 0.875rem;
    padding: 0.5rem;
    background: var(--light-color);
    border-radius: var(--border-radius);
    min-height: 2.5rem; /* Fixed minimum height for consistency */
    height: 2.5rem; /* Fixed height regardless of content */
    display: flex;
    align-items: flex-start;
    overflow: hidden;
}

.product-card .product-pricing {
    margin-bottom: 1rem;
    flex-grow: 0;
    flex-shrink: 0;
    border-top: 1px solid #eee;
    padding-top: 1rem;
    min-height: 3rem; /* Fixed height for pricing consistency */
    display: flex;
    align-items: flex-start;
}

.product-card .product-stock {
    margin-bottom: 1.5rem;
    flex-grow: 0;
    flex-shrink: 0;
    min-height: 2rem; /* Fixed height for stock badge consistency */
    display: flex;
    align-items: flex-start;
}

.product-card .product-actions {
    margin-top: auto; /* Push to bottom */
    flex-shrink: 0;
    min-height: 6rem; /* Fixed minimum height for action area */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.product-card .product-actions .btn {
    margin-bottom: 0.5rem;
}

.product-card .product-actions .btn:last-child {
    margin-bottom: 0;
}

/* Ensure consistent card heights in grid layout */
.products-grid .row {
    display: flex;
    flex-wrap: wrap;
}

.products-grid .col-lg-4,
.products-grid .col-md-6 {
    display: flex;
    align-items: stretch;
}

/* Featured products carousel consistency */
.carousel-item .row {
    display: flex;
    flex-wrap: wrap;
}

.carousel-item .col-lg-4,
.carousel-item .col-md-6 {
    display: flex;
    align-items: stretch;
}

/* This rule is now handled in the .product-card .product-variations section above */

/* Category Cards */
.category-card {
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #dee2e6;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.category-image {
    height: 200px;
    overflow: hidden;
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.category-card:hover .category-image img {
    transform: scale(1.1);
}

/* Carousel Styles */
.carousel-control-prev,
.carousel-control-next {
    width: 5%;
    color: var(--primary-color);
    opacity: 0.8;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-color: var(--primary-color);
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
}

/* Cart Styles */
.cart-item {
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.95);
}

.cart-item-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-controls input {
    width: 80px;
    text-align: center;
}

.cart-summary {
    background: var(--light-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    position: sticky;
    top: 2rem;
}

/* Forms */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-weight: 500;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-color-dark, #0056b3);
    border-color: var(--primary-color-dark, #0056b3);
    transform: translateY(-1px);
}

.btn-outline-primary:hover {
    transform: translateY(-1px);
}

/* Alerts */
.alert {
    border-radius: var(--border-radius);
    border: none;
    font-weight: 500;
}

.alert-success {
    background-color: #d1edda;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

/* Loading Spinner */
.spinner-border {
    width: 1rem;
    height: 1rem;
}

/* Badges */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Footer */
footer {
    margin-top: auto;
}

.footer-link {
    transition: var(--transition);
    opacity: 0.8;
}

.footer-link:hover {
    color: var(--primary-color) !important;
    opacity: 1;
    transform: translateX(5px);
}

.social-links a {
    transition: var(--transition);
    padding: 0.5rem;
    border-radius: 50%;
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}

.payment-methods i {
    font-size: 1.5rem;
    transition: var(--transition);
}

.payment-methods i:hover {
    color: var(--primary-color) !important;
    transform: scale(1.1);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .hero-section {
        text-align: center;
        min-height: 50vh;
    }
    
    .hero-buttons {
        margin-top: 2rem;
    }
    
    .hero-buttons .btn {
        display: block;
        margin: 0.5rem auto;
        width: 200px;
    }
    
    .product-card {
        margin-bottom: 2rem;
    }
    
    .cart-item {
        text-align: center;
    }
    
    .cart-item-image {
        margin: 0 auto 1rem auto;
        display: block;
    }
    
    .quantity-controls {
        justify-content: center;
        margin: 1rem 0;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .display-5 {
        font-size: 1.5rem;
    }
    
    .hero-buttons .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .feature-card {
        margin-bottom: 2rem;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color-dark, #0056b3);
}

/* Category Navigation Styles */

/* Top Category Navigation */
.category-top-navigation {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
}

.category-nav-title,
.subcategory-nav-title {
    color: var(--dark-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem !important;
}

/* Category Pills */
.category-nav-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #dee2e6;
    border-radius: 2rem;
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.category-pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 0.25rem 0.75rem rgba(13, 110, 253, 0.15);
}

.category-pill.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0.25rem 0.75rem rgba(13, 110, 253, 0.3);
}

.category-pill.active:hover {
    background: var(--primary-color-dark, #0056b3);
    border-color: var(--primary-color-dark, #0056b3);
    color: white;
}

.category-pill .product-count {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Subcategory Pills */
.subcategory-navigation {
    border-top: 1px solid #f0f0f0;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.subcategory-nav-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.subcategory-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 1.5rem;
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 400;
    font-size: 0.9rem;
    transition: var(--transition);
    white-space: nowrap;
}

.subcategory-pill:hover {
    background: var(--light-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
    text-decoration: none;
    transform: translateY(-1px);
}

.subcategory-pill.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.subcategory-pill.active:hover {
    background: var(--primary-color-dark, #0056b3);
    border-color: var(--primary-color-dark, #0056b3);
    color: white;
}

.subcategory-pill .product-count {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Products Toolbar */
.products-toolbar {
    border: 1px solid #dee2e6;
    box-shadow: var(--box-shadow);
}

.products-toolbar .input-group {
    max-width: 400px;
}

.products-toolbar .btn-sm {
    white-space: nowrap;
}

/* Category Breadcrumb Enhancement */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item {
    font-size: 0.9rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--secondary-color);
    font-weight: bold;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb-item a:hover {
    color: var(--primary-color-dark, #0056b3);
    text-decoration: underline;
}

/* Responsive Category Navigation */
@media (max-width: 768px) {
    .category-top-navigation {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .category-nav-pills {
        gap: 0.5rem;
    }
    
    .category-pill {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .subcategory-pill {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .products-toolbar {
        padding: 1rem;
    }
    
    .products-toolbar .row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .products-toolbar .col-md-6 {
        text-align: left !important;
    }
    
    .products-toolbar .input-group {
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .category-nav-pills {
        justify-content: flex-start;
        gap: 0.4rem;
    }
    
    .category-pill {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        border-radius: 1.5rem;
    }
    
    .category-pill .product-count {
        display: none; /* Hide product counts on very small screens */
    }
    
    .subcategory-nav-pills {
        gap: 0.3rem;
    }
    
    .subcategory-pill {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
        border-radius: 1rem;
    }
    
    .subcategory-pill .product-count {
        display: none; /* Hide product counts on very small screens */
    }
    
    .category-nav-title,
    .subcategory-nav-title {
        font-size: 0.9rem;
        margin-bottom: 0.75rem !important;
    }
    
    .products-toolbar .d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Animation for smooth transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-top-navigation {
    animation: fadeIn 0.3s ease-out;
}

.products-toolbar {
    animation: fadeIn 0.3s ease-out 0.1s both;
}

/* Utility Classes */
.text-decoration-none:hover {
    text-decoration: none !important;
}

.cursor-pointer {
    cursor: pointer;
}

.min-height-100vh {
    min-height: 100vh;
}

.min-height-70vh {
    min-height: 70vh;
}

.sticky-top-custom {
    position: sticky;
    top: 2rem;
    z-index: 1020;
}

