/* Tigule Marketplace - Custom Styles */

:root {
    /* Malawi Flag Colors */
    --primary-color: #C8102E;      /* Red */
    --secondary-color: #000000;     /* Black */
    --accent-color: #007A3D;       /* Green */
    --warning-color: #FFD700;       /* Gold */
    
    /* Additional Colors */
    --light-gray: #f8f9fa;
    --medium-gray: #6c757d;
    --dark-gray: #343a40;
    --white: #ffffff;
    
    /* Typography */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.6;
}

/* ========================================
   LOGO LOADING STATE ANIMATIONS
   ======================================== */

/* Page Loader - Full Screen */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Logo Container */
.loader-logo-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 30px;
}

/* Logo Image */
.loader-logo {
    width: 80px;
    height: 80px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: brightness(0) saturate(100%) invert(24%) sepia(94%) saturate(3089%) hue-rotate(341deg) brightness(85%) contrast(96%);
    animation: logoFloat 2s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translate(-50%, -50%) translateY(0px);
    }
    50% {
        transform: translate(-50%, -50%) translateY(-10px);
    }
}

/* Spinning Ring Around Logo */
.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: var(--primary-color);
    border-right-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.loader-ring:nth-child(2) {
    width: 90%;
    height: 90%;
    top: 5%;
    left: 5%;
    border-top-color: var(--accent-color);
    border-right-color: var(--warning-color);
    animation-duration: 2s;
    animation-direction: reverse;
}

/* Mobile - Thinner rings */
@media (max-width: 576px) {
    .loader-ring {
        border-width: 3px;
    }
}

@media (max-width: 400px) {
    .loader-ring {
        border-width: 2px;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Loading Text */
.loader-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Loading Progress Bar */
.loader-progress {
    width: 200px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.loader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 10px;
    animation: progressMove 2s ease-in-out infinite;
}

@keyframes progressMove {
    0% {
        width: 0%;
        margin-left: 0%;
    }
    50% {
        width: 100%;
        margin-left: 0%;
    }
    100% {
        width: 0%;
        margin-left: 100%;
    }
}

/* Content Loader - Inline */
.content-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    min-height: 300px;
}

.content-loader-logo {
    width: 60px;
    height: 60px;
    filter: brightness(0) saturate(100%) invert(24%) sepia(94%) saturate(3089%) hue-rotate(341deg) brightness(85%) contrast(96%);
    animation: logoSpin 2s linear infinite, logoScale 1.5s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes logoSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes logoScale {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.1) rotate(180deg);
    }
}

/* Small Inline Loader */
.inline-loader {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.inline-loader-logo {
    width: 24px;
    height: 24px;
    filter: brightness(0) saturate(100%) invert(24%) sepia(94%) saturate(3089%) hue-rotate(341deg) brightness(85%) contrast(96%);
    animation: logoSpin 1.5s linear infinite;
}

/* Button Loader */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Skeleton Loader with Logo Pulse */
.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 2s infinite;
    border-radius: 8px;
}

@keyframes skeletonShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .loader-logo-container {
        width: 80px;
        height: 80px;
    }
    
    .loader-logo {
        width: 50px;
        height: 50px;
    }
    
    .loader-text {
        font-size: 0.95rem;
    }
    
    .loader-progress {
        width: 180px;
        height: 3px;
    }
    
    .content-loader-logo {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 576px) {
    .loader-logo-container {
        width: 70px;
        height: 70px;
    }
    
    .loader-logo {
        width: 40px;
        height: 40px;
    }
    
    .loader-text {
        font-size: 0.85rem;
        white-space: nowrap;
    }
    
    .loader-progress {
        width: 150px;
        height: 3px;
    }
    
    .loader-progress-bar {
        height: 100%;
    }
    
    .content-loader {
        padding: 40px 20px;
        min-height: 200px;
    }
    
    .content-loader-logo {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 400px) {
    .loader-logo-container {
        width: 60px;
        height: 60px;
    }
    
    .loader-logo {
        width: 35px;
        height: 35px;
    }
    
    .loader-text {
        font-size: 0.8rem;
    }
    
    .loader-progress {
        width: 130px;
    }
    
    .content-loader-logo {
        width: 35px;
        height: 35px;
    }
}

/* Global Styles */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--dark-gray);
    background-color: var(--light-gray);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--dark-gray);
}

/* Hero Title */
.hero-title {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 700;
    font-size: 2.5rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
}

.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #a00d25;
    border-color: #a00d25;
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, 
        rgba(200, 16, 46, 0.1) 0%, 
        rgba(0, 122, 61, 0.1) 50%, 
        rgba(255, 215, 0, 0.1) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(200, 16, 46, 0.2);
}

.hero-icon-container {
    position: relative;
    display: inline-block;
}

.hero-icon {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, 
        rgba(200, 16, 46, 0.2) 0%, 
        rgba(0, 122, 61, 0.2) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
    border: 2px solid rgba(200, 16, 46, 0.3);
    box-shadow: 
        0 8px 32px rgba(200, 16, 46, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.hero-icon:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        0 15px 40px rgba(200, 16, 46, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.hero-icon i {
    font-size: 4rem;
    color: var(--primary-color);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive Hero Icon */
@media (max-width: 992px) {
    .hero-icon {
        width: 160px;
        height: 160px;
    }
    
    .hero-icon i {
        font-size: 3.2rem;
    }
}

@media (max-width: 768px) {
    .hero-icon {
        width: 120px;
        height: 120px;
    }
    
    .hero-icon i {
        font-size: 2.5rem;
    }
}

@media (max-width: 1199px) and (min-width: 769px) {
    .hero-section .row {
        text-align: center;
    }
    
    .hero-section .col-lg-6:first-child {
        margin-bottom: 1.5rem;
    }
    
    .hero-section .d-flex {
        justify-content: center;
        gap: 1rem !important;
    }
    
    .hero-section .btn {
        min-width: 140px;
    }
}

@media (max-width: 768px) {
    .hero-section .row {
        text-align: center;
    }
    
    .hero-section .col-lg-6:first-child {
        margin-bottom: 2rem;
    }
    
    .hero-section .d-flex {
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem !important;
    }
    
    .hero-section .btn {
        min-width: 140px;
    }
}

@media (max-width: 576px) {
    .hero-icon {
        width: 100px;
        height: 100px;
        margin-bottom: 1rem;
    }
    
    .hero-icon i {
        font-size: 2rem;
    }
    
    .hero-section .col-lg-6:first-child {
        margin-bottom: 1.5rem;
    }
    
    .hero-section .d-flex {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem !important;
    }
    
    .hero-section .btn {
        width: 100%;
        max-width: 280px;
        min-width: auto;
    }
}

@media (max-width: 400px) {
    .hero-icon {
        width: 80px;
        height: 80px;
        margin-bottom: 0.75rem;
    }
    
    .hero-icon i {
        font-size: 1.6rem;
    }
    
    .hero-section .btn {
        max-width: 260px;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .hero-title {
        font-size: 1.75rem !important;
    }
}

/* Responsive Hero Subtitle - Match "Find exactly what you're looking for" size */
@media (max-width: 768px) {
    .hero-section .lead {
        font-size: 0.875rem;
        line-height: 1.5;
        font-weight: 400;
    }
}

@media (max-width: 576px) {
    .hero-section .lead {
        font-size: 0.875rem;
        line-height: 1.4;
        margin-bottom: 1.5rem !important;
        font-weight: 400;
    }
}

@media (max-width: 400px) {
    .hero-section .lead {
        font-size: 0.875rem;
        line-height: 1.4;
        margin-bottom: 1.25rem !important;
        font-weight: 400;
    }
}

/* Call to Action Section */
.cta-section {
    background: linear-gradient(135deg, 
        rgba(200, 16, 46, 0.08) 0%, 
        rgba(0, 122, 61, 0.08) 50%, 
        rgba(255, 215, 0, 0.08) 100%);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(200, 16, 46, 0.15);
    border-bottom: 1px solid rgba(200, 16, 46, 0.15);
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(200, 16, 46, 0.1);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

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

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

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

/* Modern Dropdown Styling */
.navbar-nav .dropdown-menu {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.95);
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    min-width: 220px;
    animation: dropdownFadeIn 0.3s ease-out;
    transform-origin: top;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.navbar-nav .dropdown-item {
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    color: var(--dark-gray);
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 0.125rem 0.5rem;
    position: relative;
    overflow: hidden;
}

.navbar-nav .dropdown-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(200, 16, 46, 0.1), rgba(0, 122, 61, 0.1));
    transition: left 0.3s ease;
    z-index: -1;
}

.navbar-nav .dropdown-item:hover::before {
    left: 0;
}

.navbar-nav .dropdown-item:hover {
    color: var(--primary-color);
    background: transparent;
    transform: translateX(5px);
}

.navbar-nav .dropdown-item i {
    width: 20px;
    text-align: center;
    margin-right: 0.75rem;
    transition: transform 0.3s ease;
}

.navbar-nav .dropdown-item:hover i {
    transform: scale(1.1);
    color: var(--primary-color);
}

.navbar-nav .dropdown-divider {
    margin: 0.5rem 1rem;
    border-color: rgba(200, 16, 46, 0.2);
    border-width: 1px;
}

/* Dropdown Toggle Styling */
.navbar-nav .dropdown-toggle::after {
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
    border-top-color: var(--medium-gray);
}

.navbar-nav .dropdown.show .dropdown-toggle::after {
    transform: rotate(180deg);
    border-top-color: var(--primary-color);
}

.navbar-nav .dropdown-toggle:hover::after {
    border-top-color: var(--primary-color);
}

/* Account dropdown specific styling */
.navbar-nav .dropdown-item[href*="logout"] {
    color: #dc3545;
    font-weight: 600;
}

.navbar-nav .dropdown-item[href*="logout"]:hover {
    color: #c82333;
    background: rgba(220, 53, 69, 0.1);
}

.navbar-nav .dropdown-item[href*="logout"] i {
    color: #dc3545;
}

/* Sell dropdown specific styling */
.navbar-nav .dropdown-item[href*="create_listing"] {
    color: var(--accent-color);
}

.navbar-nav .dropdown-item[href*="create_listing"]:hover {
    color: #005a2c;
}

.navbar-nav .dropdown-item[href*="create_listing"] i {
    color: var(--accent-color);
}

.navbar-nav .dropdown-item[href*="create_shop"] {
    color: var(--primary-color);
}

.navbar-nav .dropdown-item[href*="create_shop"]:hover {
    color: #a00d25;
}

.navbar-nav .dropdown-item[href*="create_shop"] i {
    color: var(--primary-color);
}

/* Mobile navbar adjustments */
@media (max-width: 1199.98px) {
    .navbar-nav .dropdown-menu {
        margin-top: 0;
        border-radius: 0;
        box-shadow: none;
        background: rgba(248, 249, 250, 0.95);
        border-top: 1px solid rgba(200, 16, 46, 0.1);
    }
    
    .navbar-nav .dropdown-item {
        margin: 0.125rem 0;
        border-radius: 0;
    }
    
    .navbar-nav .dropdown-item:hover {
        transform: none;
    }
    
    /* Mobile navbar spacing */
    .navbar .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .navbar-toggler {
        margin-left: auto;
        margin-right: 0.5rem;
        border: none;
        padding: 0.25rem 0.5rem;
    }
    
    .navbar-brand {
        margin-right: 0.5rem;
        font-size: 1.25rem;
    }
    
    .navbar-collapse {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(200, 16, 46, 0.1);
    }
    
    .navbar-collapse .d-flex {
        margin-bottom: 1rem;
        max-width: 100% !important;
        width: 100%;
    }
    
    .navbar-collapse .input-group {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .navbar .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-toggler {
        padding: 0.2rem 0.4rem;
        margin-right: 0.25rem;
    }
    
    .navbar-collapse .form-control {
        font-size: 0.9rem;
        padding: 0.6rem 0.8rem;
    }
    
    .navbar-collapse .btn {
        padding: 0.6rem 0.8rem;
    }
}

/* Mobile Search Form Styling */
@media (max-width: 768px) {
    /* Search form mobile layout */
    .search-form .row {
        margin: 0;
    }
    
    .search-form .col-md-6,
    .search-form .col-md-3 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .search-form .col-md-6 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Keep dropdown column normal size */
    .search-form .col-md-3:has(.form-select) {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    /* Keep button column normal size */
    .search-form .col-md-3:has(.btn) {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    /* Form controls mobile styling */
    .search-form .form-control,
    .search-form .form-select {
        font-size: 0.9rem;
        padding: 0.6rem 0.75rem;
        border-radius: 0.5rem;
    }
    
    .search-form .form-select {
        /* Ensure select dropdown stays within viewport */
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .search-form .btn {
        font-size: 0.9rem;
        padding: 0.6rem 0.75rem;
    }
    
    /* Input group mobile adjustments */
    .search-form .input-group-text {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    /* Stack form elements vertically on very small screens */
    .search-form .col-md-3 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Keep normal sizes for mobile */
    .search-form .col-md-3:has(.form-select) {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .search-form .col-md-3:has(.btn) {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .search-form .form-control,
    .search-form .form-select {
        font-size: 0.85rem;
        padding: 0.55rem 0.7rem;
    }
    
    .search-form .btn {
        font-size: 0.85rem;
        padding: 0.55rem 0.7rem;
    }
    
    .search-form .input-group-text {
        padding: 0.55rem 0.7rem;
        font-size: 0.85rem;
    }
}

/* Fix for select dropdown overflow on mobile */
@media (max-width: 768px) {
    .search-form {
        /* Ensure form container doesn't overflow */
        max-width: 100%;
        overflow-x: hidden;
        position: relative;
    }
    
    .search-form .form-select {
        /* Force dropdown to stay within viewport */
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        
        /* Prevent text overflow */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        
        /* Better mobile touch targets */
        min-height: 44px;
        padding: 0.6rem 2rem 0.6rem 0.75rem;
        
        /* Ensure proper positioning */
        position: relative;
        z-index: 1;
        
        /* Force native mobile behavior */
        -webkit-appearance: menulist;
        -moz-appearance: menulist;
        appearance: menulist;
    }
    
    /* Style search form dropdown options like navbar dropdown */
    .search-form .form-select option {
        /* Modern navbar-like styling */
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--dark-gray);
        background: rgba(255, 255, 255, 0.95);
        border: none;
        border-radius: 8px;
        margin: 0.125rem 0.5rem;
        transition: all 0.3s ease;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 4rem);
        line-height: 1.4;
        cursor: pointer;
        position: relative;
        
        /* Modern shadow and effects */
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(10px);
    }
    
    /* Hover effect for dropdown options */
    .search-form .form-select option:hover {
        background: linear-gradient(135deg, rgba(200, 16, 46, 0.1), rgba(0, 122, 61, 0.1));
        color: var(--primary-color);
        transform: translateX(5px);
        box-shadow: 0 4px 16px rgba(200, 16, 46, 0.2);
        font-weight: 600;
    }
    
    /* Selected option styling */
    .search-form .form-select option:checked,
    .search-form .form-select option:selected {
        background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
        color: white;
        font-weight: 600;
        transform: translateX(4px);
        box-shadow: 0 6px 20px rgba(200, 16, 46, 0.3);
    }
    
    /* Additional mobile-specific select styling */
    .search-form .form-select {
        /* Ensure the dropdown popup is constrained */
        max-width: calc(100vw - 2rem) !important;
        font-size: 0.9rem;
    }
    
    /* Target the native dropdown popup */
    .search-form .form-select:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.2rem rgba(200, 16, 46, 0.25);
    }
    
    /* Additional container constraints */
    .search-form .col-md-3 {
        max-width: 100% !important;
        overflow: hidden;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
}

/* Extra constraints for very small screens */
@media (max-width: 576px) {
    .search-form {
        padding: 0 0.5rem;
        margin: 0;
    }
    
    .search-form .form-select {
        width: 100% !important;
        max-width: calc(100vw - 1rem) !important;
        font-size: 0.85rem;
        padding: 0.55rem 1.5rem 0.55rem 0.7rem;
    }
    
    .search-form .col-md-3 {
        padding-left: 0.125rem;
        padding-right: 0.125rem;
    }
}

/* Force viewport constraints on all mobile devices */
@media (max-width: 768px) {
    .search-form .form-select {
        /* Use viewport units to ensure it never exceeds screen width */
        max-width: calc(100vw - 2rem) !important;
        width: calc(100% - 0.5rem) !important;
    }
    
    /* Mobile dropdown options styling - navbar-like */
    .search-form .form-select option {
        /* Mobile navbar-like styling */
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        font-weight: 500;
        color: var(--dark-gray);
        background: rgba(255, 255, 255, 0.95);
        border: none;
        border-radius: 6px;
        margin: 0.1rem 0.25rem;
        transition: all 0.25s ease;
        line-height: 1.3;
        max-width: calc(100vw - 6rem);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        cursor: pointer;
        position: relative;
        
        /* Modern shadow and effects */
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(10px);
    }
    
    /* Mobile hover effects */
    .search-form .form-select option:hover {
        background: linear-gradient(135deg, rgba(200, 16, 46, 0.08), rgba(0, 122, 61, 0.08));
        color: var(--primary-color);
        transform: translateX(4px);
        box-shadow: 0 2px 8px rgba(200, 16, 46, 0.15);
        font-weight: 600;
    }
    
    /* Mobile selected state */
    .search-form .form-select option:checked,
    .search-form .form-select option:selected {
        background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
        color: white;
        transform: translateX(2px);
        box-shadow: 0 3px 12px rgba(200, 16, 46, 0.25);
        font-weight: 600;
    }
    
    /* Ensure dropdown popup stays within screen bounds */
    .search-form .form-select {
        /* Force mobile dropdown to respect viewport */
        -webkit-appearance: menulist;
        -moz-appearance: menulist;
        appearance: menulist;
    }
}

/* Extra small screens - keep normal sizes but focus on dropdown options */
@media (max-width: 480px) {
    .search-form .col-md-3:has(.form-select) {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    
    .search-form .col-md-3:has(.btn) {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
}

/* Cards */
.card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-img-top {
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

.card-title {
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 0.5rem;
}

.card-text {
    color: var(--medium-gray);
    font-size: 0.9rem;
}

/* Price Display */
.price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.price-old {
    font-size: 1rem;
    color: var(--medium-gray);
    text-decoration: line-through;
}

/* Badges */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
}

.badge-featured {
    background-color: var(--warning-color);
    color: var(--secondary-color);
}

.badge-urgent {
    background-color: var(--primary-color);
    color: var(--white);
}

.badge-verified {
    background-color: var(--accent-color);
    color: var(--white);
}

/* Forms */
.form-control {
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(200, 16, 46, 0.25);
}

.form-select {
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    z-index: 1;
    position: relative;
    cursor: pointer;
}

.form-select:focus {
    z-index: 9999;
    position: relative;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(200, 16, 46, 0.25);
}

/* Ensure native dropdown appearance */
select.form-select {
    appearance: menulist;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    background-image: none;
    background-color: white;
}

/* Ensure dropdown options are visible */
select.form-select option {
    background-color: white;
    color: #333;
    padding: 4px 8px;
}

.form-label {
    font-weight: 500;
    color: var(--dark-gray);
    margin-bottom: 0.5rem;
}

/* Alerts */
.alert {
    border-radius: 0.75rem;
    border: none;
    font-weight: 500;
}

.alert-success {
    background-color: #d1edff;
    color: var(--accent-color);
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-danger {
    background-color: #f8d7da;
    color: var(--primary-color);
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

/* Listing Cards */
.listing-card {
    position: relative;
    overflow: hidden;
}

.listing-badges {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 3;
}

.listing-badges .badge {
    margin-right: 0.25rem;
    font-size: 0.7rem;
    padding: 0.4rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.listing-badges .badge-urgent {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    animation: pulse-urgent 2s infinite;
}

@keyframes pulse-urgent {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.listing-price {
    position: absolute;
    bottom: 4rem;
    right: 1rem;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
    z-index: 2;
}

.listing-timestamp {
    position: absolute;
    top: 4rem;
    right: 1rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.listing-like {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 4;
}

.listing-like .like-btn {
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.listing-like .like-btn:hover {
    transform: scale(1.1);
}

/* Ensure proper colors for liked state */
.listing-like .like-btn.btn-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
}

.listing-like .like-btn.btn-danger:hover {
    background-color: #c82333 !important;
    border-color: #bd2130 !important;
    color: white !important;
}

/* Ensure proper colors for unliked state */
.listing-like .like-btn.btn-outline-danger {
    background-color: rgba(255, 255, 255, 0.95) !important;
    border-color: #dc3545 !important;
    color: #dc3545 !important;
}

.listing-like .like-btn.btn-outline-danger:hover {
    background-color: rgba(220, 53, 69, 0.1) !important;
    border-color: #dc3545 !important;
    color: #dc3545 !important;
}

/* Listing Description - 2 lines max */
.listing-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    min-height: 2.8em; /* 2 lines * 1.4 line-height */
}

/* Inline Price in Card Body */
.listing-price-inline {
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Shop Detail Page Styling */
.shop-banner-large {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.shop-logo-large {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

/* Shop Banner Placeholder - Better Colors */
.shop-banner-large.bg-primary {
    background: linear-gradient(135deg, #007bff, #0056b3) !important;
}

/* Shop Logo Placeholder - Better Colors */
.shop-logo-large.bg-light {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
}

.shop-logo-large.bg-light i {
    color: #6c757d !important;
}

/* Category Cards */
.category-card {
    text-align: center;
    padding: 2rem 1rem;
    transition: all 0.3s ease;
}

.category-card:hover {
    background-color: var(--primary-color);
    color: var(--white);
    transform: translateY(-5px);
}

.category-card:hover .card-title {
    color: var(--white) !important;
}

.category-card:hover .card-text {
    color: rgba(255, 255, 255, 0.8) !important;
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.category-card:hover .category-icon {
    color: var(--white);
}

/* Shop Cards */
.shop-card {
    position: relative;
}

.shop-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--white);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.shop-banner {
    height: 120px;
    object-fit: cover;
}

/* Pagination */
.pagination .page-link {
    color: var(--primary-color);
    border-color: #dee2e6;
    border-radius: 0.5rem;
    margin: 0 0.125rem;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white !important;
}

.pagination .page-link:hover {
    color: var(--primary-color);
    background-color: var(--light-gray);
}

/* Footer */
footer {
    background-color: var(--secondary-color) !important;
}

footer h5, footer h6 {
    color: var(--white) !important;
}

footer p, footer li {
    color: rgba(255, 255, 255, 0.8) !important;
}

footer a,
footer .text-muted {
    color: var(--white) !important;
    transition: color 0.3s ease;
}

footer a:hover,
footer .text-muted:hover {
    color: var(--primary-color) !important;
}

.social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white) !important;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background-color: var(--primary-color);
    color: var(--white) !important;
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .card-img-top {
        height: 150px;
    }
    
    .category-icon {
        font-size: 2rem;
    }
    
    .category-card {
        padding: 1.5rem 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-img-top {
        height: 120px;
    }
    
    .category-icon {
        font-size: 1.5rem;
    }
    
    .category-card {
        padding: 1rem 0.5rem;
    }
}

/* Loading States */
/* Only apply to elements with .loading class, NOT html.loading */
*:not(html).loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Page-level loading state for html element */
html.loading body {
    cursor: wait;
    /* DO NOT use pointer-events: none - blocks all clicks! */
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Custom Utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.border-radius-lg {
    border-radius: 1rem !important;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Shop Card Styles */
.shop-card {
    transition: all 0.3s ease;
    border: none;
    overflow: hidden;
}

.shop-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
}

.shop-image-container {
    height: 200px;
}

.shop-banner, .shop-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.shop-card:hover .shop-banner,
.shop-card:hover .shop-logo {
    transform: scale(1.05);
}

.shop-placeholder {
    height: 200px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.shop-logo-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

/* Facebook-style Shop Card Design */
.shop-image-container {
    height: 200px;
    position: relative;
}

.shop-banner, .shop-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.shop-card:hover .shop-banner,
.shop-card:hover .shop-logo {
    transform: scale(1.05);
}

.shop-placeholder {
    height: 200px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Circular Logo Overlay */
.shop-logo-overlay {
    position: absolute;
    bottom: -20px;
    left: 20px;
    z-index: 10;
}

.shop-logo-circular {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid white;
    object-fit: cover;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    background: white;
}

.shop-logo-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid white;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    color: #6c757d;
    font-size: 24px;
}

/* Adjust card body to accommodate logo */
.shop-card .card-body {
    padding-top: 45px; /* Make space for the circular logo */
}

/* Font Awesome Icon Fixes */
.fa-user-plus:before {
    content: "\f234";
}

.fa-spinner:before {
    content: "\f110";
}

.fa-heart:before {
    content: "\f004";
}

.fa-store:before {
    content: "\f54e";
}

/* Ensure Font Awesome icons are visible */
.fas, .far, .fab {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
    font-weight: 900;
}

.far {
    font-weight: 400;
}
