/* RTL Support */
body {
    direction: rtl;
    text-align: right;
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    color: #333;
    line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.lead {
    font-weight: 300;
    font-size: 1.25rem;
}

/* Navigation */
.navbar {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-nav {
    padding-right: 0;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.nav-link.active {
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.dropdown-menu {
    text-align: right;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover, .dropdown-item:focus {
    background-color: #f8f9fa;
    color: #2c3e50;
}

.dropdown-item.active {
    background-color: #e9ecef;
    color: #2c3e50;
    font-weight: 500;
}

/* Cards */
.card {
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-weight: 600;
}

.card-img-top {
    height: 200px;
    object-fit: contain;
    padding: 1rem;
    background-color: #fff;
}

.card-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.card-text {
    color: #6c757d;
}

/* Product Details */
.nutrition-table th,
.nutrition-table td {
    text-align: right;
    padding: 0.75rem 1rem;
}

.nutrition-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.calculated-value {
    font-weight: 600;
    color: #2c3e50;
}

/* Nutrition Facts Styling */
.nutrition-facts {
    border: 2px solid #333;
    padding: 1rem;
    background-color: #fff;
}

.nutrition-facts .header {
    border-bottom: 8px solid #333;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.nutrition-facts .title {
    font-size: 2rem;
    font-weight: 800;
    text-transform: uppercase;
}

.nutrition-facts .serving {
    font-size: 1rem;
    font-weight: 400;
}

.nutrition-facts .calories {
    font-size: 2rem;
    font-weight: 800;
}

.nutrition-facts .nutrient-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #ddd;
    padding: 0.25rem 0;
}

.nutrition-facts .nutrient-row.major {
    border-bottom: 4px solid #333;
    font-weight: 700;
}

.nutrition-facts .indent {
    padding-left: 1.5rem;
}

/* Ingredients */
.ingredient-link {
    text-decoration: none;
    color: #0d6efd;
    border-bottom: 1px dashed #0d6efd;
    transition: all 0.2s ease;
}

.ingredient-link:hover {
    color: #0a58ca;
    border-bottom-style: solid;
}

/* Allergen Tags */
.allergen-tag {
    display: inline-block;
    background-color: #ffc107;
    color: #212529;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Search Form */
.search-form {
    max-width: 500px;
    margin: 0 auto;
}

/* RTL Search Button Fix */
.input-group > .btn:not(:first-child) {
    margin-right: calc(var(--bs-border-width) * -1);
    margin-left: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: var(--bs-border-radius);
    border-bottom-left-radius: var(--bs-border-radius);
}

.input-group > .btn:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: var(--bs-border-radius);
    border-bottom-left-radius: var(--bs-border-radius);
}

.input-group > .form-control:not(:last-child) {
    border-top-right-radius: var(--bs-border-radius);
    border-bottom-right-radius: var(--bs-border-radius);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group > .form-control:last-child {
    border-top-right-radius: var(--bs-border-radius);
    border-bottom-right-radius: var(--bs-border-radius);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Fix for Bootstrap RTL issues */
.input-group:not(.has-validation) > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: var(--bs-border-radius);
    border-bottom-right-radius: var(--bs-border-radius);
}

.input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    margin-right: calc(var(--bs-border-width) * -1);
    margin-left: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: var(--bs-border-radius);
    border-bottom-left-radius: var(--bs-border-radius);
}

.form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(44, 62, 80, 0.25);
    border-color: #2c3e50;
}

/* Breadcrumb */
.breadcrumb {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.breadcrumb-item a {
    color: #0a58ca; /* Darker blue for better contrast (4.5:1 on #f8f9fa) */
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: #084298; /* Even darker on hover */
    text-decoration: underline;
}

.breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Pagination */
.pagination {
    direction: ltr;
}

.page-link {
    color: #2c3e50;
    border: none;
    margin: 0 0.25rem;
    border-radius: 0.25rem;
}

.page-item.active .page-link {
    background-color: #2c3e50;
    border-color: #2c3e50;
}

/* Footer */
.footer {
    background-color: #f8f9fa;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.footer h5 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer a {
    color: #495057; /* Darker gray for better contrast (4.5:1 on #f8f9fa) */
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: #2c3e50;
    text-decoration: underline;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: #e9ecef;
    border-radius: 50%;
    color: #2c3e50;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background-color: #2c3e50;
    color: #fff;
    transform: translateY(-3px);
}

/* Responsive Images */
.img-fluid {
    max-height: 400px;
    object-fit: contain;
}

/* Custom Colors */
.bg-primary {
    background-color: #2c3e50 !important;
}

.btn-primary {
    background-color: #2c3e50;
    border-color: #2c3e50;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #1a252f;
    border-color: #1a252f;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-outline-primary {
    color: #2c3e50;
    border-color: #2c3e50;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background-color: #2c3e50;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Statistics Cards */
.stats-card {
    text-align: center;
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
}

.stats-card .number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.stats-card .label {
    color: #6c757d;
    font-weight: 500;
}

/* Category Cards */
.category-card {
    text-align: center;
    margin-bottom: 1rem;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.category-card .card-body {
    padding: 1.5rem 1rem;
}

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

/* Accordion Styling */
.accordion-item {
    border: none;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    overflow: hidden;
}

.accordion-button {
    font-weight: 500;
    padding: 1rem 1.25rem;
    background-color: #f8f9fa;
    color: #2c3e50;
}

.accordion-button:not(.collapsed) {
    background-color: #e9ecef;
    color: #2c3e50;
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: rgba(0,0,0,0.1);
}

.accordion-body {
    padding: 1.25rem;
    background-color: #fff;
}

/* Range Input Styling */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e9ecef;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2c3e50;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Responsive Typography */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    .lead {
        font-size: 1.1rem;
    }
    
    .card-img-top {
        height: 150px;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .related-products {
        display: none;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .nutrition-facts {
        break-inside: avoid;
    }
}

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

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Jumbotron */
.jumbotron {
    background-color: #f8f9fa;
    border-radius: 0.75rem;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.jumbotron h1 {
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Nutrition Calculator */
.nutrition-calculator {
    background-color: #f8f9fa;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.nutrition-calculator .form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

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

.visually-hidden-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus Styles for Accessibility */
a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 2px solid #2c3e50;
    outline-offset: 2px;
}

/* Skip to content link for accessibility */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #2c3e50;
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.3s;
}

.skip-to-content:focus {
    top: 0;
}

/* Price comparison contrast improvements */
.price-comparison-section .text-warning {
    color: #b8860b !important; /* Darker gold for better contrast (4.5:1 on white) */
}

.price-comparison-section h6.text-warning {
    color: #b8860b !important;
}

.price-comparison-section .h5.text-warning {
    color: #b8860b !important;
}

.price-comparison-section .fw-bold.text-warning {
    color: #b8860b !important;
} 