/* ============================================
   MarketLink Ghana - Custom Stylesheet
   ============================================ */

:root {
    --ml-green: #1B5E20;
    --ml-green-light: #2E7D32;
    --ml-green-mid: #388E3C;
    --ml-green-soft: #E8F5E9;
    --ml-orange: #E65100;
    --ml-orange-light: #F57C00;
    --ml-amber: #FF8F00;
    --ml-gold: #FFC107;
    --ml-gold-light: #FFF8E1;
    --ml-bg: #F5F7FA;
    --ml-text: #212121;
    --ml-text-muted: #6c757d;
    --ml-border: #E0E0E0;
    --ml-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --ml-shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --ml-radius: 12px;
    --ml-radius-sm: 8px;
}

/* ---- Base ---- */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--ml-bg);
    color: var(--ml-text);
}

a { text-decoration: none; }
a:hover { text-decoration: none; }

/* ---- Navbar ---- */
.navbar { border-bottom: 1px solid var(--ml-border); }
.category-nav { overflow-x: auto; scrollbar-width: none; }
.category-nav::-webkit-scrollbar { display: none; }

/* ---- Hero Section ---- */
.hero-section {
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 40%, #388E3C 70%, #FF8F00 100%);
    padding: 70px 0 80px;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: rgba(255, 193, 7, 0.12);
    border-radius: 50%;
}
.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.hero-search-box {
    background: white;
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.hero-search-box .form-control {
    border: none;
    font-size: 1.05rem;
    padding: 12px 16px;
}
.hero-search-box .form-control:focus { box-shadow: none; }
.hero-search-box .btn-search {
    border-radius: 12px !important;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--ml-amber);
    border: none;
    color: #fff;
    transition: all 0.2s;
}
.hero-search-box .btn-search:hover {
    background: var(--ml-orange);
    transform: scale(1.02);
}

/* ---- Stat Badges ---- */
.hero-stats .stat-item {
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 12px 20px;
    backdrop-filter: blur(10px);
}

/* ---- Cards ---- */
.card {
    border: 1px solid var(--ml-border);
    border-radius: var(--ml-radius);
    box-shadow: var(--ml-shadow);
    transition: all 0.25s ease;
}
.card:hover {
    box-shadow: var(--ml-shadow-lg);
    transform: translateY(-2px);
}

.product-card .card-img-top {
    height: 200px;
    object-fit: cover;
    border-radius: var(--ml-radius) var(--ml-radius) 0 0;
}
.product-card .card-body { padding: 14px; }
.product-card .price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ml-green-light);
}
.product-card .original-price {
    font-size: 0.85rem;
    color: var(--ml-text-muted);
    text-decoration: line-through;
}

.store-card .store-logo {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--ml-border);
}
.store-card .store-banner {
    height: 120px;
    object-fit: cover;
    border-radius: var(--ml-radius) var(--ml-radius) 0 0;
}

/* ---- Category Cards ---- */
.category-card {
    border-radius: var(--ml-radius);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    text-align: center;
    padding: 24px 16px;
    background: white;
    transition: all 0.25s;
}
.category-card:hover {
    background: var(--ml-green-soft);
    transform: translateY(-3px);
    box-shadow: var(--ml-shadow-lg);
}
.category-card .cat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.6rem;
}
.category-card .cat-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ml-text);
}

/* ---- Section Headers ---- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ml-text);
    margin: 0;
}
.section-title span { color: var(--ml-green-light); }

/* ---- Badges ---- */
.badge-promoted {
    background: linear-gradient(135deg, var(--ml-amber), var(--ml-orange));
    color: white;
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 20px;
}
.badge-new {
    background: var(--ml-green-light);
    color: white;
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 20px;
}
.badge-sale {
    background: #C62828;
    color: white;
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 20px;
}

/* ---- Comparison Table ---- */
.comparison-table th { background: var(--ml-green-light); color: white; }
.comparison-table .best-price { color: var(--ml-green-light); font-weight: 700; }
.comparison-table .nearby { color: var(--ml-amber); }

/* ---- Reservation Card ---- */
.reservation-card {
    border-left: 4px solid var(--ml-green-light);
    border-radius: var(--ml-radius);
    background: white;
    padding: 20px;
}
.reservation-code {
    font-family: 'Courier New', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ml-green-light);
    letter-spacing: 2px;
    background: var(--ml-green-soft);
    padding: 10px 20px;
    border-radius: 8px;
    display: inline-block;
}

/* ---- How It Works Steps ---- */
.step-item {
    position: relative;
    text-align: center;
    padding: 0 20px;
}
.step-number {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--ml-green-light);
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 4px 16px rgba(46,125,50,0.35);
}
.step-connector {
    position: absolute;
    top: 26px;
    right: -50%;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, var(--ml-green-light), var(--ml-amber));
}

/* ---- Stats Counter ---- */
.stats-section {
    background: linear-gradient(135deg, var(--ml-green-light), var(--ml-green));
}
.stat-counter .number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--ml-gold);
    line-height: 1;
}
.stat-counter .label {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    margin-top: 4px;
}

/* ---- Filter Sidebar ---- */
.filter-sidebar {
    background: white;
    border-radius: var(--ml-radius);
    padding: 20px;
    box-shadow: var(--ml-shadow);
    position: sticky;
    top: 80px;
}
.filter-sidebar .filter-title {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ml-text-muted);
    border-bottom: 1px solid var(--ml-border);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

/* ---- Price Range ---- */
.price-range { color: var(--ml-green-light); font-weight: 700; }

/* ---- Map ---- */
#store-map {
    height: 500px;
    border-radius: var(--ml-radius);
    z-index: 1;
}
.leaflet-popup-content-wrapper {
    border-radius: var(--ml-radius-sm) !important;
}

/* ---- Dashboard ---- */
.dashboard-card {
    border-radius: var(--ml-radius);
    overflow: hidden;
    border: none;
}
.dashboard-card .card-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.sidebar-nav .nav-link {
    border-radius: 10px;
    color: #495057;
    padding: 10px 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: var(--ml-green-soft);
    color: var(--ml-green-light);
    font-weight: 600;
}
.sidebar-nav .nav-link.active {
    background: var(--ml-green-light);
    color: white;
}

/* ---- QR Code Container ---- */
.qr-container {
    border: 2px dashed var(--ml-green-light);
    border-radius: 12px;
    padding: 20px;
    background: white;
    display: inline-block;
}

/* ---- Subscription Plans ---- */
.plan-card {
    border-radius: var(--ml-radius);
    overflow: hidden;
    transition: all 0.3s;
}
.plan-card.featured {
    border: 2px solid var(--ml-amber) !important;
    transform: scale(1.04);
}
.plan-card .plan-header {
    padding: 28px;
    text-align: center;
}
.plan-card .plan-price .amount {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}
.plan-card .plan-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--ml-border);
}
.plan-card .plan-feature:last-child { border-bottom: none; }
.plan-card .plan-feature .check { color: var(--ml-green-light); }
.plan-card .plan-feature .cross { color: #ccc; }

/* ---- Buttons ---- */
.btn-primary-ml {
    background: var(--ml-green-light);
    border: none;
    color: white;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-primary-ml:hover { background: var(--ml-green); color: white; }

.btn-amber {
    background: var(--ml-amber);
    border: none;
    color: white;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-amber:hover { background: var(--ml-orange); color: white; }

.btn-reserve {
    background: linear-gradient(135deg, var(--ml-green-light), var(--ml-green));
    border: none;
    color: white;
    border-radius: 10px;
    font-weight: 600;
    padding: 10px 24px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(46,125,50,0.3);
}
.btn-reserve:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(46,125,50,0.4);
    color: white;
}

/* ---- Hotdeals Ticker ---- */
.deals-ticker {
    background: linear-gradient(90deg, var(--ml-orange), var(--ml-amber));
    color: white;
    padding: 8px 0;
    overflow: hidden;
}
.deals-ticker-inner {
    display: flex;
    animation: ticker 30s linear infinite;
    white-space: nowrap;
}
@keyframes ticker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* ---- Loader ---- */
.ml-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--ml-green-soft);
    border-top-color: var(--ml-green-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Skeleton Loading ---- */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ---- Search Autocomplete ---- */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: var(--ml-shadow-lg);
    z-index: 1050;
    max-height: 320px;
    overflow-y: auto;
}
.search-suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--ml-border);
    transition: background 0.15s;
}
.search-suggestion-item:hover { background: var(--ml-green-soft); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hero-section { padding: 40px 0 50px; }
    .section-title { font-size: 1.2rem; }
    .plan-card.featured { transform: none; }
    .stat-counter .number { font-size: 1.8rem; }
    #store-map { height: 350px; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ml-green-mid); }

/* ---- Utilities ---- */
.text-green { color: var(--ml-green-light) !important; }
.text-amber { color: var(--ml-amber) !important; }
.bg-green { background: var(--ml-green-light) !important; }
.bg-green-soft { background: var(--ml-green-soft) !important; }
.bg-amber { background: var(--ml-amber) !important; }
.bg-gold-light { background: var(--ml-gold-light) !important; }

.border-green { border-color: var(--ml-green-light) !important; }
.rounded-ml { border-radius: var(--ml-radius) !important; }

.hover-shadow:hover { box-shadow: var(--ml-shadow-lg) !important; }
.hover-lift:hover { transform: translateY(-4px); }

/* ---- Topbar ---- */
.topbar { font-size: 0.8rem; }

/* ---- Retailer Portal ---- */
.retailer-sidebar {
    min-height: calc(100vh - 120px);
    background: white;
    border-right: 1px solid var(--ml-border);
}
.validate-box {
    background: linear-gradient(135deg, #E8F5E9, #F1F8E9);
    border: 2px dashed var(--ml-green-light);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
}

/* ---- Admin Panel ---- */
.admin-header {
    background: linear-gradient(135deg, var(--ml-green), #1a237e);
    color: white;
    padding: 16px 24px;
}

/* ---- Promo Banner ---- */
.promo-banner {
    background: linear-gradient(135deg, #FF6F00, #FF8F00);
    border-radius: var(--ml-radius);
    padding: 20px 24px;
    color: white;
    position: relative;
    overflow: hidden;
}
.promo-banner::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

/* ---- Price comparison ---- */
.price-compare-row.best { background: var(--ml-green-soft); }
.price-compare-row.best .price-val { color: var(--ml-green-light); }

/* ---- Tag pills ---- */
.tag-pill {
    display: inline-block;
    background: #E3F2FD;
    color: #1565C0;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    margin: 2px;
}

/* ---- Footer ---- */
.footer a:hover { color: #66BB6A !important; }

/* ============================================
   RESPONSIVE IMPROVEMENTS
   ============================================ */

/* ---- Fluid font sizes ---- */
h1 { font-size: clamp(1.6rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.75rem); }

/* ---- Navbar ---- */
@media (max-width: 991.98px) {
    .topbar { display: none !important; }
    .navbar-brand .fw-bold { font-size: 1.1rem !important; }
    .category-nav { display: none !important; }
    #navMenu { border-top: 1px solid #eee; padding-top: 0.5rem; }
    #navMenu .nav-link { padding: 0.6rem 0.5rem; border-bottom: 1px solid #f5f5f5; }
    .hero-search-box { margin: 0 0.5rem; }
}

/* ---- Hero section ---- */
.hero-section { padding: 40px 0 50px; }
@media (max-width: 767.98px) {
    .hero-section { padding: 28px 0 36px; }
    .hero-section h1 { font-size: 1.6rem; }
    .hero-search-box { padding: 6px; }
}

/* ---- Product cards ---- */
.product-card { border-radius: var(--ml-radius) !important; }
.product-card .card-img-top { height: 180px; object-fit: cover; }
@media (max-width: 575.98px) {
    .product-card .card-img-top { height: 150px; }
}

/* ---- Store cards ---- */
.store-card-banner { height: 110px; }
@media (max-width: 575.98px) {
    .store-card-banner { height: 90px; }
}

/* ---- Sidebar filters ---- */
@media (max-width: 991.98px) {
    #storeFilters, #dealFilters {
        border: 1px solid #dee2e6;
        border-radius: 12px;
        padding: 1rem;
        background: #fff;
        margin-bottom: 1rem;
    }
}

/* ---- Pricing cards ---- */
@media (max-width: 767.98px) {
    .pricing-card { margin-bottom: 0.5rem; }
}

/* ---- Tables ---- */
@media (max-width: 767.98px) {
    .table-responsive-sm { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table td, table th { white-space: nowrap; font-size: 0.82rem; }
}

/* ---- Dashboard layouts ---- */
@media (max-width: 767.98px) {
    .dashboard-stat-card .display-4 { font-size: 2rem; }
    .col-md-3.col-6 { padding: 6px; }
}

/* ---- Container padding ---- */
@media (max-width: 575.98px) {
    .container-fluid.px-md-5 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
    .px-4 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
}

/* ---- Pagination ---- */
.pagination .page-link { padding: 0.4rem 0.65rem; font-size: 0.875rem; }
@media (max-width: 575.98px) {
    .pagination { gap: 2px !important; }
    .pagination .page-link { padding: 0.3rem 0.55rem; font-size: 0.8rem; }
}

/* ---- Buttons ---- */
@media (max-width: 575.98px) {
    .btn-lg { padding: 0.55rem 1.2rem; font-size: 1rem; }
    .d-flex.gap-3.flex-wrap { gap: 0.5rem !important; }
}

/* ---- Maps ---- */
#map, .leaflet-container {
    width: 100%;
    min-height: 300px;
}
@media (max-width: 767.98px) {
    #map, .leaflet-container { min-height: 260px; }
}

/* ---- Footer ---- */
@media (max-width: 767.98px) {
    .footer .col-lg-3, .footer .col-lg-2 { margin-bottom: 0.25rem; }
    .footer h6 { font-size: 0.95rem; cursor: pointer; }
    .footer .row.g-4 > [class*='col-'] { padding-bottom: 0.5rem; }
}

/* ---- Accordion (FAQ) ---- */
.accordion-button { font-size: 0.95rem; }
@media (max-width: 575.98px) {
    .accordion-button { font-size: 0.88rem; padding: 0.75rem 1rem; }
    .accordion-body { font-size: 0.85rem; }
}

/* ---- General spacing helpers ---- */
@media (max-width: 575.98px) {
    .py-5 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
    .mt-5 { margin-top: 2rem !important; }
    .mb-5 { margin-bottom: 2rem !important; }
}

/* ---- Cart & reservation pages ---- */
@media (max-width: 767.98px) {
    .reservation-detail-card { padding: 1rem !important; }
    #qrcode img, #qrcode canvas { max-width: 180px !important; }
}

/* ---- Auth pages ---- */
@media (max-width: 575.98px) {
    .auth-card { margin: 0.5rem; padding: 1.5rem !important; }
}

/* ---- Sticky CTA on mobile ---- */
@media (max-width: 767.98px) {
    .sticky-mobile-cta {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1040;
        padding: 0.75rem 1rem;
        background: #fff;
        box-shadow: 0 -2px 16px rgba(0,0,0,0.12);
    }
}

/* ---- Image placeholders ---- */
.img-placeholder {
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a5d6a7;
}

/* ---- Smooth scrolling ---- */
html { scroll-behavior: smooth; }

/* ---- Focus accessibility ---- */
:focus-visible { outline: 2px solid var(--ml-green-light); outline-offset: 2px; }

/* ---- Print ---- */
@media print {
    .navbar, .footer, .topbar, .category-nav, .btn { display: none !important; }
    .container-fluid { padding: 0 !important; }
}
