.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    font-size: smaller;
    font-style: italic;
}

.truncate-1 {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.truncate-3 {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.truncate-5 {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
}

.lh-1 {
    line-height: 1em !important;
}

.modal-dialog.large {
    width: 80% !important;
    max-width: unset;
}

.modal-dialog.mid-large {
    width: 50% !important;
    max-width: unset;
}

@media (max-width:900px) {
    .modal-dialog.large {
        width: 100% !important;
        max-width: unset;
    }
    .modal-dialog.mid-large {
        width: 100% !important;
        max-width: unset;
    }
    .modal-dialog {
        margin: unset !important;
    }
}

#viewer_modal .btn-close {
    position: absolute;
    z-index: 999999;
    /*right: -4.5em;*/
    background: unset;
    color: white;
    border: unset;
    font-size: 27px;
    top: 0;
}

#viewer_modal .modal-dialog {
    width: 80%;
    max-width: unset;
    height: calc(90%);
    max-height: unset;
}

#viewer_modal .modal-content {
    background: black;
    border: unset;
    height: calc(100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

#viewer_modal img,
#viewer_modal video {
    max-height: calc(100%);
    max-width: calc(100%);
}

table.dataTable th,
table.dataTable td {
    padding: 5px !important;
}

.card.d-flex {
    flex-direction: row !important;
}

.card.d-flex>img {
    width: 20% !important;
}

.card.d-flex>.card-body {
    width: 80% !important;
}

span.btn {
    cursor: unset;
}

span.btn:hover {
    background: inherit;
}

#tourCarousel {
    height: 50vh !important;
}

#tourCarousel img {
    object-fit: fill;
}

div.stars {
    width: auto;
    display: inline-block
}

.mt-200 {
    margin-top: 200px
}

input.star {
    display: none
}

label.star {
    float: right;
    /* padding: 10px; */
    font-size: 30px;
    color: #333333;
    transition: all .2s
}

input.star:checked~label.star:before {
    content: '\2605';
    color: #ffc800;
    transition: all .25s
}

input.star-5:checked~label.star:before {
    color: #ffc800;
    /* text-shadow: 0 0 20px #952 */
}

input.star-1:checked~label.star:before {
    color: #F62
}

label.star:hover {
    transform: rotate(-15deg) scale(1.3)
}

label.star:before {
    content: '\2605';
    font-family: FontAwesome
}

.product-img-holder {
    width: 100%;
    height: 20em;
}

.product-img-holder>img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.brand-img-holder {
    width: 100%;
    height: 20em;
}

.brand-img-holder>img {
    width: 100%;
    height: 100%;
    object-fit: scale-down;
    object-position: center center;
    transition: transform .2s ease-in;
}

.brand-item:hover .brand-img-holder>img {
    transform: scale(1.3);
}

.price-tag {
    bottom: 1em;
    right: 1em;
}

.nav-icon {
    width: 1.6rem !important;
}

.list-group:empty:after {
    content: "No data listed yet.";
    color: rgb(85, 85, 85);
    text-align: center;
}

.select2-selection.form-border {
    border-top: 0;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
}

h1.w-100.text-center.site-title.px-5 {
    text-shadow: 5px 5px 5px #000 !important;
    color: #fff;
    font-size: 3.5em !important;
}

img#client-img-avatar {
    width: 1.7rem;
    height: 1.7rem;
    border-width: 1px !important;
    padding: 1px;
}

.form-control.form-control-border:focus {
    box-shadow: unset !important;
}

.product-img-holder {
    height: 22vh !important;
    width: calc(100%);
    overflow: hidden;
}

.product-img {
    object-fit: cover;
    height: calc(100%);
    width: calc(100%);
}

.welcome-content img {
    margin: .5em;
}

/* ==========================================
   PWA & MOBILE RESPONSIBILITY FIXES (ALL SIDES)
   ========================================== */
@media (max-width: 767px) {
    html, body { overflow-x: hidden !important; max-width: 100vw; }
    .card-body, .table-responsive, .dataTables_wrapper { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    .info-box { margin-bottom: 1rem; min-height: 70px; }
    .info-box-icon { width: 60px; font-size: 1.5rem; }
    .info-box-content { padding: 5px 10px; }
    .form-group { margin-bottom: 0.8rem; }
    .btn, .form-control { min-height: 40px; }
    .col-lg-12.py-5 h1.w-100 { font-size: 2rem !important; padding-left: 10px !important; padding-right: 10px !important; }
    .main-sidebar { width: 250px !important; }
    .user-panel img { width: 2.1rem; height: 2.1rem; }
    .prod-img-holder { height: 250px !important; }
}

/* ==========================================
   GLOBAL IFAMART GREEN DESIGN SYSTEM
   Applies to buyer, farmer & admin sides
   ========================================== */

/* === TYPOGRAPHY === */
body { font-family: 'Inter', sans-serif !important; }
h1,h2,h3,h4,h5,h6,.brand-text,
.card-title,.modal-title { font-family: 'Outfit', sans-serif !important; }

/* === CARDS === */
.card {
    border: 1px solid #e8f0e4 !important;
    border-radius: 10px !important;
    box-shadow: none !important;
}
.card-header {
    border-bottom: 1px solid #e8f0e4 !important;
    background: #fff !important;
}
.card-outline.card-primary { border-top: 3px solid #1b4332 !important; }
.card-outline.card-success { border-top: 3px solid #40916c !important; }
.card-outline.card-dark { border-top: 3px solid #1b4332 !important; }

/* === BUTTONS === */
.btn-primary, .bg-gradient-primary { background: #1b4332 !important; border-color: #1b4332 !important; }
.btn-success, .bg-gradient-success { background: #40916c !important; border-color: #40916c !important; }
.btn-navy, .bg-navy { background: #1b4332 !important; border-color: #1b4332 !important; color:#fff !important; }
.btn { border-radius: 7px !important; font-weight: 600 !important; }
.btn-flat { border-radius: 7px !important; }

/* === INFO BOXES (Dashboard) === */
.info-box { border-radius: 10px !important; border: 1px solid #e8f0e4 !important; box-shadow: none !important; }
.info-box-icon.bg-gradient-primary { background: #1b4332 !important; }
.info-box-icon.bg-gradient-success { background: #40916c !important; }
.info-box-icon.bg-gradient-info { background: #2d6a4f !important; }
.info-box-icon.bg-gradient-warning { background: #b5881d !important; }

/* === TABLES === */
table.dataTable thead th,
.table thead th {
    background: #1b4332 !important;
    color: #fff !important;
    font-family: 'Outfit', sans-serif !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    letter-spacing: 0.5px !important;
    border: none !important;
}
.table-bordered { border-color: #e8f0e4 !important; }
.table-bordered td, .table-bordered th { border-color: #e8f0e4 !important; }
.table-striped tbody tr:nth-of-type(odd) { background: #f8faf7 !important; }
.table tbody tr:hover { background: #f0f7f3 !important; }

/* === SIDEBAR (Vendor & Admin) === */
.main-sidebar, .main-sidebar .sidebar { background: #1b4332 !important; }
.main-sidebar .brand-link { background: #163829 !important; border-bottom: 1px solid rgba(255,255,255,0.1) !important; }
.main-sidebar .brand-text { color: #fff !important; font-weight: 700 !important; }
.main-sidebar .nav-sidebar .nav-link { color: rgba(255,255,255,0.78) !important; border-radius: 7px !important; margin: 2px 8px !important; font-size: 0.88rem !important; }
.main-sidebar .nav-sidebar .nav-link.active,
.main-sidebar .nav-sidebar .nav-link:hover { background: rgba(255,255,255,0.12) !important; color: #fff !important; }
.main-sidebar .nav-sidebar .nav-link .nav-icon { color: rgba(255,255,255,0.6) !important; }
.main-sidebar .nav-sidebar .nav-link.active .nav-icon { color: #b7e4c7 !important; }
.main-sidebar .nav-header { color: rgba(255,255,255,0.4) !important; font-size: 0.7rem !important; letter-spacing: 2px !important; padding: 10px 16px 4px !important; }
.main-sidebar .user-panel { border-bottom: 1px solid rgba(255,255,255,0.1) !important; }
.main-sidebar .user-panel .info a { color: rgba(255,255,255,0.85) !important; }

/* === TOP NAVBAR (vendor/admin) === */
.main-header.navbar { border-bottom: 1px solid #e8f0e4 !important; background: #fff !important; }
.main-header .navbar-nav .nav-link { color: #374151 !important; }

/* === FORMS === */
.form-control { border-radius: 7px !important; border-color: #e8f0e4 !important; font-family: 'Inter', sans-serif !important; }
.form-control:focus { border-color: #40916c !important; box-shadow: 0 0 0 2px rgba(64,145,108,0.15) !important; }
.select2-container--bootstrap4 .select2-selection { border-color: #e8f0e4 !important; border-radius: 7px !important; }

/* === MODALS === */
.modal-header { border-bottom: 1px solid #e8f0e4 !important; }
.modal-footer { border-top: 1px solid #e8f0e4 !important; }
.modal-content { border-radius: 12px !important; border: 1px solid #e8f0e4 !important; box-shadow: 0 10px 40px rgba(0,0,0,0.12) !important; }

/* === BADGES === */
.badge-success { background: #40916c !important; }
.badge-primary { background: #1b4332 !important; }
.badge-secondary { background: #6b7280 !important; }
.badge-warning { background: #b5881d !important; }
.badge-danger { background: #dc2626 !important; }
.badge-info { background: #2d6a4f !important; }

/* === DATATABLE PAGINATION === */
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #1b4332 !important;
    border-color: #1b4332 !important;
    color: #fff !important;
    border-radius: 6px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f0f7f3 !important;
    border-color: #e8f0e4 !important;
    color: #1b4332 !important;
    border-radius: 6px !important;
}

/* === BUYER-SPECIFIC === */
.buyer-section { max-width: 1200px; margin: 0 auto; padding: 30px 16px; }

/* Status badges */
.order-status-0 { background:#f3f4f6; color:#374151; padding:4px 10px; border-radius:20px; font-size:0.78rem; font-weight:600; }
.order-status-1 { background:#dbeafe; color:#1e40af; padding:4px 10px; border-radius:20px; font-size:0.78rem; font-weight:600; }
.order-status-2 { background:#ffedd5; color:#9a3412; padding:4px 10px; border-radius:20px; font-size:0.78rem; font-weight:600; }
.order-status-3 { background:#ede9fe; color:#5b21b6; padding:4px 10px; border-radius:20px; font-size:0.78rem; font-weight:600; }
.order-status-4 { background:#d1fae5; color:#065f46; padding:4px 10px; border-radius:20px; font-size:0.78rem; font-weight:600; }
.order-status-5 { background:#fee2e2; color:#991b1b; padding:4px 10px; border-radius:20px; font-size:0.78rem; font-weight:600; }

/* pcard (product card) */
.pcard { text-decoration:none; color:inherit; display:flex; flex-direction:column; }
.pcard:hover { text-decoration:none; color:inherit; }

/* content wrapper buyer */
.layout-top-nav .content-wrapper { background: #f7faf6 !important; }

/* Remove old AdminLTE header/topnav for buyer */
.layout-top-nav .main-header { display: none; }

@media (max-width: 768px) {
    .buyer-section { padding: 20px 12px; }
    .pcard-img { height: 160px; }
    .checkout-wrap { padding: 20px 12px; }
}

/* ==========================================
   FORCE HIDE ALL OLD PRELOADERS
   ========================================== */
#preloader, .preloader {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    z-index: -9999 !important;
}
/* ==============================================================
   FULLY RESPONSIVE DESIGN (MOBILE, TABLET, DESKTOP)
   ============================================================== */

/* Base Global Rules to prevent overflow and ensure fluid scale */
html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden !important;
    margin: 0;
    padding: 0;
}

/* Make all images and media content scale fluidly */
img, video, svg, canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* Prevent overflow on all form inputs */
input, select, textarea, .form-control {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Prevent text overflow issues across the site */
p, span, div, h1, h2, h3, h4, h5, h6, a {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Scrollable Tables wrapper */
.table-responsive, .dataTables_wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
}

/* ==============================================================
   EXTRA SMALL DEVICES (Phones: < 576px)
   ============================================================== */
@media (max-width: 575.98px) {
    /* Touch-friendly buttons and forms */
    .btn, .form-control {
        min-height: 42px !important;
    }
    
    /* Fluid typography for headers */
    h1, .site-title { font-size: 1.8rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.3rem !important; }
    h4 { font-size: 1.15rem !important; }
    
    .container, .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Stack checkout panels for easier reading on narrow screens */
    .checkout-wrap .col-md-7, .checkout-wrap .col-md-5 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* ==============================================================
   SMALL TO MEDIUM DEVICES (Tablets: 576px - 991.98px)
   ============================================================== */
@media (min-width: 576px) and (max-width: 991.98px) {
    .btn {
        min-height: 40px !important;
    }
    
    h1, .site-title { font-size: 2.2rem !important; }
    h2 { font-size: 1.8rem !important; }
}

/* ==============================================================
   LARGE DESKTOP DEVICES (>= 992px)
   ============================================================== */
@media (min-width: 992px) {
    .container {
        max-width: 1200px !important;
        margin: 0 auto !important;
    }
}

/* ==============================================================
   ADMINLTE MOBILE/TABLET SIDEBAR ADJUSTMENTS (< 992px)
   ============================================================== */
@media (max-width: 991.98px) {
    /* Reset margins for content, header, and footer to make them full width */
    .content-wrapper,
    .main-header,
    .main-footer {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Ensure the sidebar translates off-screen when closed on mobile */
    body:not(.sidebar-open) .main-sidebar {
        margin-left: -250px !important;
    }
    
    /* Ensure the sidebar translates on-screen when opened on mobile */
    body.sidebar-open .main-sidebar {
        margin-left: 0 !important;
    }

    /* Prevent topbar dropdown menus from overflowing on mobile */
    .navbar-nav .dropdown-menu {
        position: absolute !important;
        right: 0 !important;
        left: auto !important;
    }
}
/* Product card natural style */
.nat-card {
    background: #fff;
    border-radius: 12px;
    border: 1.5px solid #e8f0e4;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
}
.nat-card-img-wrap {
    position: relative;
    width: 100%;
    height: 175px;
    overflow: hidden;
    background: #f0f7f0;
}
.nat-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.nat-card-body { padding: 12px 14px 14px; flex: 1; display: flex; flex-direction: column; }
.nat-card-name {
    font-family: 'Outfit', sans-serif;
    font-size: 0.97rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nat-card-vendor {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 5px;
}
.nat-card-vendor i { color: #52b788; font-size: 0.7rem; margin-right: 3px; }
.nat-card-stars { display: flex; align-items: center; gap: 3px; margin-bottom: 8px; }
.nat-card-stars .star { font-size: 0.7rem; }
.nat-card-stars .star.filled { color: #f59e0b; }
.nat-card-stars .star.empty { color: #e5e7eb; }
.nat-card-stars small { font-size: 0.72rem; color: #9ca3af; }
.nat-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}
.nat-card-price {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: #1b4332;
}
.nat-card-btn {
    background: #f0fdf4;
    color: #1b4332;
    border: 1.5px solid #bbf7d0;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 7px;
    white-space: nowrap;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-state .empty-icon {
    width: 80px;
    height: 80px;
    background: #f0fdf4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}
.empty-state .empty-icon i { font-size: 2rem; color: #52b788; }
.empty-state h3 { font-family: 'Outfit', sans-serif; font-size: 1.2rem; font-weight: 700; color: #1b4332; margin-bottom: 8px; }
.empty-state p { color: #6b7280; font-size: 0.9rem; }
.empty-state a { color: #40916c; font-weight: 600; text-decoration: none; }

/* Stock badges */
.stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
}
.stock-badge.in-stock {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}
.stock-badge.low-stock {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}
.stock-badge.out-of-stock {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.nat-card-img-wrap .out-of-stock-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.nat-card-img-wrap .out-of-stock-overlay span {
    background: #dc2626;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 6px 18px;
    border-radius: 6px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

@media (max-width: 576px) {
    .nat-card-img-wrap { height: 150px; }
    .products-topbar h1 { font-size: 1.2rem; }
}
</style>
