/* Responsive and style corrections */

/* Header Top Bar styles */

.header-top-bar {
    background-color: #ff661a; /* Dark background for the top bar */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Navbar styles */

.main-navbar {
    background-color: #ff661a;
    padding: 0.4rem 0;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    border-top: 3px solid #ffffff;
}

.navbar-top-row {
    min-height: 48px;
}

/* Remove top border on the right-side group when displayed inline on desktop */
@media (min-width: 992px) {
    .navbar-collapse .border-top {
        border-top: none !important;
    }
}

/* Bold logo image — slightly larger & crisp */
.navbar-brand.fw-bold .navbar-logo {
    max-height: 46px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.25));
}

.navbar-brand .navbar-logo {
    max-height: 40px;
    transition: all 0.3s ease;
}

.navbar-brand .navbar-logo:hover {
    transform: scale(1.1);
}

.nav-link {
    color: #fff !important;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 0.25rem;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover, .nav-link.active, .nav-item .nav-link.active {
    background-color: #ff661a;
    color: #fff !important;
}

.navbar-toggler {
    border-color: rgba(255,255,255,.1);
}

.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(255, 255, 255, 0.55)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.dropdown-menu {
    background-color: #ff661a;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

.dropdown-item {
    color: #fff;
    transition: all 0.3s ease;
}

.dropdown-item:hover, .dropdown-item:focus {
    background-color: #ff661a;
    color: #fff;
}

/* Search Bar Styles - General */
.search-wrapper {
    position: relative;
    width: 100%;
}

.search-input {
    border-radius: 50rem !important;
    border: 1px solid #ddd !important;
    padding-left: 1.2rem;
    padding-right: 3rem; /* Space for the icon */
    height: 40px;
    background-color: #fff;
    color: #333;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #ff661a !important;
    box-shadow: 0 0 0 0.25rem rgba(255, 102, 26, 0.25) !important;
}

.search-button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #ff661a;
    padding: 0 10px;
    font-size: 1.1rem;
    z-index: 5;
    cursor: pointer;
}

.search-button:hover {
    color: #e65c17;
}

@media (max-width: 992px) {
    body {
        padding-top: 70px !important; /* compact single-row navbar on mobile */
    }

    .navbar-nav {
        margin-top: 1rem;
    }

    .search-wrapper {
        max-width: 280px; /* Compact width on mobile */
        margin-bottom: 5px;
    }

    .search-input {
        height: 38px;
        font-size: 0.95rem;
    }

    .search-button {
        font-size: 1rem;
        right: 3px;
    }
}



/* Home Page Styles */

.hero-section {
    background-color: #ff661a;
    padding-top: 2rem;
    padding-bottom: 2rem;
    color: #fff; /* Ensure text is readable on the colored background */
}

.hero-section-row {
    min-height: 400px; /* Ensure hero section has a decent height */
}

.hero-image {
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.jumbotron-heading {
    font-size: 2.5rem; /* Default size */
    color: #333;
}

.section-bg-rounded {
    background-color: #f8f9fa;
    border-radius: 15px;
    padding: 3rem 1.5rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.discount-banner {
    background: linear-gradient(45deg, #ff661a, #ff9933);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.category-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 5px 15px 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-link {
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.category-link:hover {
    color: #ff661a;
}

/* Media Queries for Home Page */

@media (max-width: 768px) {
    .hero-section-row {
        min-height: 0; /* Remove fixed height on small screens */
        flex-direction: column-reverse; /* Stack image below text on mobile */
    }

    .hero-section-row .col-md-7,
    .hero-section-row .col-md-5 {
        width: 100%; /* Full width for columns */
        text-align: center;
    }

    .jumbotron-heading {
        font-size: 2rem; /* Adjust heading size for mobile */
    }

    .carousel-item .row {
        justify-content: center;
    }

    /* Product carousels: column sizing (2/row phones, 3/row small tablets,
       6/row desktop) is handled by col-6/col-sm-4/col-md-2 classes directly
       on the template markup -- no override needed here. */

    .hero-image {
        max-height: 260px;
        object-fit: cover;
    }
}

@media (max-width: 576px) {
    .jumbotron-heading {
        font-size: 1.8rem; /* Further adjust heading size for extra small screens */
    }

    .hero-image {
        max-height: 200px;
    }
}

/* Product Detail Page Styles */

.product-image-gallery .main-image-container {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.product-image-gallery .main-image-container img {
    width: 100%;
    height: auto;
    display: block;
}

.thumbnail-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.thumbnail {
    width: 70px; /* Increased size for better visibility */
    height: 70px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 5px;
    transition: border-color 0.3s, transform 0.3s;
}

.thumbnail.active, .thumbnail:hover {
    border-color: #ff661a; /* Highlight with accent color */
    transform: scale(1.05);
}

.weight-btn {
    white-space: nowrap; /* Prevent text wrapping */
}

.weight-btn.active {
    background-color: #ff661a;
    border-color: #ff661a;
    color: white;
}

/* Responsive adjustments for product detail page */

@media (max-width: 768px) {
    .product-image-gallery {
        margin-bottom: 2rem;
    }

    .thumbnail-container {
        justify-content: center; /* Center thumbnails on small screens */
    }

    .thumbnail {
        width: 60px;
        height: 60px;
    }

    .quantity-input {
        width: 100px;
    }
}

@media (max-width: 576px) {
    .thumbnail {
        width: 50px;
        height: 50px;
    }

    .weight-btn {
        padding: 0.375rem 0.75rem; /* Adjust padding for smaller buttons */
        font-size: 0.875rem;
    }
}

/* Cart Detail Page Styles */

@media (max-width: 767.98px) {
    .table-responsive .table {
        border: 0;
    }

    .table-responsive .table thead {
        display: none; /* Hide table headers on small screens */
    }

    .table-responsive .table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        padding: 0.5rem;
    }

    .table-responsive .table td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0.75rem;
        border: none;
        position: relative;
        padding-left: 50%; /* Space for the pseudo-element label */
        text-align: right;
    }

    .table-responsive .table td::before {
        content: attr(data-label); /* Use data-label for content */
        position: absolute;
        left: 0.75rem;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
    }

    .table-responsive .table td:first-child {
        text-align: left;
        padding-left: 0.75rem;
    }

    .table-responsive .table td:first-child::before {
        content: ""; /* No label for the first column (product image/name) */
    }

    .table-responsive .table tfoot td {
        display: block;
        text-align: right !important;
        padding-left: 0.75rem;
        font-weight: bold;
    }

    .table-responsive .table tfoot td:first-child {
        text-align: right !important;
    }

    .cart-item-image {
        width: 40px !important;
        height: 40px !important;
    }

    .quantity-input {
        width: 60px !important;
        margin-right: 0.5rem;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }

    .btn-lg {
        width: 100%;
        margin-top: 0.5rem;
    }

    .col-md-6.text-end {
        text-align: center !important;
    }
}

/* Checkout Page Styles */

@media (max-width: 767.98px) {
    .list-group-item .lh-condensed {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-group-item .lh-condensed span {
        align-self: flex-end; /* Align price/quantity to the right */
    }

    .list-group-item h6 {
        width: 100%;
    }

    .input-group {
        flex-direction: column;
    }

    .input-group .form-control {
        margin-bottom: 0.5rem;
    }

    .input-group .btn {
        width: 100%;
    }

    .col-md-4 .btn-primary { /* "Proceed to Checkout" button */
        width: 100%;
        margin-top: 1rem;
    }
}

/* User Profile Page Styles */

@media (max-width: 767.98px) {
    .table.table-bordered.table-striped {
        border: 0;
    }

    .table.table-bordered.table-striped tbody,
    .table.table-bordered.table-striped tr,
    .table.table-bordered.table-striped td,
    .table.table-bordered.table-striped th {
        display: block;
        width: 100%;
    }

    .table.table-bordered.table-striped tr {
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        padding: 0.5rem;
    }

    .table.table-bordered.table-striped td,
    .table.table-bordered.table-striped th {
        padding: 0.5rem 0.75rem;
        text-align: right;
        position: relative;
        padding-left: 50%;
        border: none;
    }

    .table.table-bordered.table-striped td::before,
    .table.table-bordered.table-striped th::before {
        content: attr(data-label);
        position: absolute;
        left: 0.75rem;
        width: 45%;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
    }

/* Adjust labels for the profile table */

.table.table-bordered.table-striped th[data-label]::before,
    .table.table-bordered.table-striped td[data-label]::before {
        content: attr(data-label);
    }
    
    .card-body .btn-lg {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .list-group-item {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .list-group-item small {
        margin-top: 0.25rem;
    }

    .list-group-item .btn-sm {
        margin-top: 0.5rem;
        width: 100%;
    }
}

/* Order List Page Styles */

@media (max-width: 767.98px) {
    .table.table-striped.table-hover {
        border: 0;
    }

    .table.table-striped.table-hover thead {
        display: none; /* Hide table headers on small screens */
    }

    .table.table-striped.table-hover tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        padding: 0.5rem;
    }

    .table.table-striped.table-hover td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0.75rem;
        border: none;
        position: relative;
        padding-left: 50%; /* Space for the pseudo-element label */
        text-align: right;
    }

    .table.table-striped.table-hover td::before {
        content: attr(data-label); /* Use data-label for content */
        position: absolute;
        left: 0.75rem;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
    }

    .table.table-striped.table-hover td .btn-sm {
        width: auto;
    }
}

/* Order Detail Page Styles */

@media (max-width: 767.98px) {
    .card-header h6, .card-header small {
        text-align: center;
        display: block;
    }

/* General table responsive styles for both tables in order detail */

.card-body .table-responsive table {
        border: 0;
    }

    .card-body .table-responsive table thead {
        display: none;
    }

    .card-body .table-responsive table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        padding: 0.5rem;
    }

    .card-body .table-responsive table td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0.75rem;
        border: none;
        position: relative;
        padding-left: 50%;
        text-align: right;
        flex-wrap: wrap; /* Allow content to wrap */
    }

    .card-body .table-responsive table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0.75rem;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
    }

/* Specific adjustments for order items product column */

.card-body .table-responsive table td img {
        margin-right: 0 !important; /* Remove right margin on small screens */
        margin-bottom: 0.5rem;
    }
    
    .card-footer .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}
