:root {
    --primary-color: #4a6fdc;
    --secondary-color: #34495e;
    --accent-color: #e74c3c;
    --light-bg: #f8f9fa;
    --dark-bg: #2c3e50;
    --text-color: #333;
    --light-text: #f8f9fa;
    --border-color: #dee2e6;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: var(--light-bg);
    margin: 0;
    padding: 0;
}

.top-bar {
    background-color: var(--secondary-color);
    color: var(--light-text);
    padding: 8px 0;
    font-size: 0.9rem;
}

.header {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.nav-link {
    color: var(--secondary-color);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

.dropdown-menu {
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 0.5rem;
}

.cart-icon {
    position: relative;
    margin-right: 20px;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.hero-section {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

/* Minimal Category Cards */
.category-card-minimal {
    background: white;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.category-card-minimal:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.category-card-minimal img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 8px;
    transition: transform 0.3s ease;
}

.category-card-minimal:hover img {
    transform: scale(1.05);
}

.category-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
    text-align: center;
    line-height: 1.3;
}

.section-title-minimal {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Legacy category card styles (for compatibility) */
.category-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    height: 200px;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.category-card:hover img {
    transform: scale(1.05);
}

.category-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 1rem;
    transition: background 0.3s ease;
}

.category-card:hover .category-overlay {
    background: rgba(74, 111, 220, 0.9);
}

.category-title {
    margin: 0;
    font-weight: 600;
    font-size: 1.2rem;
}

/* Enhanced Product Card Styles */
.product-card {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    background-color: white;
    position: relative;
    min-height: 420px; /* Increased to accommodate 2-line titles */
    width: calc(100% + 20px);
    margin-left: -10px;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.product-img {
    height: 200px; /* Slightly reduced to balance with title height */
    overflow: hidden;
    position: relative;
}

.product-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
    padding: 10px;
}

.product-card:hover .product-img img {
    transform: scale(1.05);
}

.product-body {
    padding: 1rem 1.2rem; /* Increased from 1rem to 1.625rem on left and right (approximately 10px more) */
}

.product-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    /* Show full title without truncation */
    line-height: 1.5em;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    font-size: 0.95rem;
}

.product-manufacturer {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.product-stock {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.in-stock {
    background-color: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.low-stock {
    background-color: rgba(243, 156, 18, 0.1);
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.out-of-stock {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.stock-qty {
    font-weight: normal;
    opacity: 0.8;
}

.product-pricing {
    font-size: 0.9rem;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.product-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.2rem 1rem;
}

.price-row {
    margin-bottom: 5px;
}

.price-label {
    color: #777;
}

.price-value {
    text-align: right;
}

.suggested-price {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px dashed #eee;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #3a5fc4;
    border-color: #3a5fc4;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

.section-title {
    position: relative;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    font-weight: 700;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background-color: var(--primary-color);
}

.lang-selector .dropdown-menu {
    min-width: 100px;
}

.lang-selector .dropdown-item {
    padding: 0.5rem 1rem;
}

.lang-flag {
    width: 20px;
    margin-right: 8px;
}

.language-flags {
    display: flex;
    align-items: center;
}

.language-flags a {
    display: inline-block;
    margin-left: 10px;
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.2s ease;
    border-radius: 4px;
    overflow: hidden;
}

.language-flags a:hover {
    opacity: 1;
    transform: scale(1.1);
}

.language-flags a.active {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.language-flags img {
    display: block;
    height: 16px;
    width: 24px;
    object-fit: cover;
}

footer {
    background-color: var(--dark-bg);
    color: var(--light-text);
    padding: 3rem 0 1rem;
    margin-top: 3rem;
}

.footer-title {
    font-weight: 600;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background-color: var(--accent-color);
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.1);
    color: white;
    margin-right: 0.5rem;
    transition: background-color 0.3s ease;
}

.social-links a:hover {
    background-color: var(--primary-color);
}

.copyright {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 2rem;
    padding-top: 1.5rem;
    font-size: 0.9rem;
}

/* Live Search Styles */
.search-wrapper {
    position: relative;
    max-width: 650px;
    width: 100%;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    z-index: 1050;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

.search-item {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.search-item:hover {
    background-color: rgba(74, 111, 220, 0.05);
}

.search-item:last-child {
    border-bottom: none;
}

.search-img img {
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #eee;
    background-color: white;
    width: 50px;
    height: 50px;
}

.search-details {
    flex: 1;
}

.search-price {
    color: var(--primary-color);
    font-size: 1rem;
    white-space: nowrap;
}

.search-actions {
    margin-left: 10px;
    width: auto;
    min-width: 140px;
}

.search-footer {
    background-color: #f8f9fa;
    padding: 10px;
    text-align: center;
}

/* Toast notification */
.toast {
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* ==========================================
   MOBILE RESPONSIVE STYLES
   ========================================== */

/* Mobile: Extra Small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Top Bar - Hide email, make phone smaller */
    .top-bar {
        font-size: 0.75rem;
        padding: 5px 0;
    }
    
    .top-bar .container > div:first-child span:first-child {
        display: none; /* Hide email on mobile */
    }
    
    .top-bar .container {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    /* Header & Navigation */
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .navbar-collapse {
        background-color: white;
        padding: 15px;
        margin-top: 10px;
        border-radius: 8px;
        box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    }
    
    /* Search Box */
    .search-wrapper {
        max-width: 100%;
        margin: 15px 0 !important;
    }
    
    .search-wrapper input {
        font-size: 14px;
    }
    
    /* Cart & User Menu */
    .cart-icon {
        margin-right: 10px;
    }
    
    .d-flex.align-items-center {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    /* Hero Section */
    .hero-section {
        padding: 1.5rem 0;
    }
    
    .hero-section h1 {
        font-size: 1.5rem !important;
    }
    
    .hero-section p {
        font-size: 0.9rem !important;
    }
    
    /* Category Cards */
    .category-card {
        height: 140px !important;
        width: 140px !important;
        margin: 0 auto 10px auto;
    }
    
    .category-card img {
        width: 140px !important;
        height: 140px !important;
    }
    
    .category-title {
        font-size: 0.85rem;
        padding: 0 5px;
    }
    
    /* Section Titles */
    .section-title {
        font-size: 1.1rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Product Cards */
    .product-card {
        min-height: 380px !important;
        margin-bottom: 15px;
    }
    
    .product-img {
        height: 160px !important;
    }
    
    .product-body {
        padding: 0.75rem !important;
    }
    
    .product-title {
        font-size: 0.85rem !important;
        line-height: 1.3em !important;
    }
    
    .product-badge {
        font-size: 0.65rem;
        padding: 3px 6px;
    }
    
    .product-stock .badge {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    .product-pricing {
        font-size: 0.8rem !important;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 8px;
        padding: 0.75rem !important;
    }
    
    .quantity-wrapper {
        width: 100%;
        justify-content: center;
    }
    
    .quantity-input {
        width: 80px !important;
    }
    
    .product-actions .btn {
        width: 100%;
    }
    
    /* Filter Panel */
    .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }
    
    .search-filter-wrapper input {
        min-width: 100% !important;
    }
    
    #filterPanel .row {
        gap: 10px;
    }
    
    #filterPanel .col-md-3 {
        width: 100%;
    }
    
    /* Benefits Section */
    .benefits-section .card {
        margin-bottom: 15px;
    }
    
    .benefits-section .card-body {
        padding: 1.5rem !important;
    }
    
    .benefits-section i {
        font-size: 2rem !important;
    }
    
    /* Footer */
    footer {
        padding: 2rem 0 1rem;
        text-align: center;
    }
    
    footer .row > div {
        margin-bottom: 2rem;
    }
    
    .footer-title::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    /* Search Results */
    .search-results {
        max-height: 300px;
    }
    
    .search-item {
        padding: 8px 10px;
    }
    
    .search-img img {
        width: 40px;
        height: 40px;
    }
    
    .search-actions {
        min-width: 100px;
        margin-left: 5px;
    }
    
    .search-price {
        font-size: 0.85rem;
    }
    
    /* Container spacing */
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    section.py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    section.py-4 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
}

/* Mobile: Small devices (landscape phones, 576px to 767.98px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .top-bar {
        font-size: 0.85rem;
    }
    
    .category-card {
        height: 160px !important;
        width: 160px !important;
    }
    
    .category-card img {
        width: 160px !important;
        height: 160px !important;
    }
    
    .product-card {
        min-height: 400px;
    }
    
    .product-img {
        height: 180px !important;
    }
    
    .search-wrapper {
        max-width: 450px;
    }
}

/* Tablet: Medium devices (tablets, 768px to 991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .category-card {
        height: 170px !important;
        width: 170px !important;
    }
    
    .category-card img {
        width: 170px !important;
        height: 170px !important;
    }
    
    .product-card {
        min-height: 410px;
    }
    
    .product-img {
        height: 190px !important;
    }
    
    .search-wrapper {
        max-width: 500px;
    }
    
    .top-bar .container > div:first-child span:first-child {
        display: none; /* Hide email on tablet too */
    }
}

/* Desktop: Large devices (desktops, 992px to 1199.98px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .search-wrapper {
        max-width: 550px;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .search-wrapper {
        max-width: 650px;
    }
}

/* Fix for very small devices (iPhone SE, etc.) */
@media (max-width: 375px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .category-card {
        height: 120px !important;
        width: 120px !important;
    }
    
    .category-card img {
        width: 120px !important;
        height: 120px !important;
    }
    
    .category-title {
        font-size: 0.75rem;
    }
    
    .product-card {
        min-height: 360px !important;
    }
    
    .product-img {
        height: 140px !important;
    }
    
    .product-title {
        font-size: 0.8rem !important;
    }
    
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Landscape orientation fixes for mobile */
@media (max-width: 767.98px) and (orientation: landscape) {
    .hero-section {
        padding: 1rem 0;
    }
    
    .category-card {
        height: 130px !important;
        width: 130px !important;
    }
    
    .category-card img {
        width: 130px !important;
        height: 130px !important;
    }
    
    .navbar-collapse {
        max-height: 70vh;
        overflow-y: auto;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link,
    .dropdown-item {
        padding: 0.75rem 1rem;
    }
    
    .language-flags a {
        padding: 5px;
        min-width: 34px;
        min-height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Remove hover effects on touch devices */
    .product-card:hover,
    .category-card:hover {
        transform: none;
    }
    
    /* But add active state */
    .product-card:active,
    .category-card:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
}