/**
 * MKisan Homepage Styles
 * Styles specific to the homepage template
 */

/* =================================================================
   HOMEPAGE WRAPPER
   ================================================================= */

.mkisan-home {
    background: var(--mkisan-bg);
    color: var(--mkisan-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.mkisan-home * {
    box-sizing: border-box;
}

.mkisan-home a {
    text-decoration: none;
    color: inherit;
}

.mkisan-home img {
    max-width: 100%;
    height: auto;
}

/* =================================================================
   HERO SECTION
   ================================================================= */

.mh-hero {
    position: relative;
    padding: 60px 20px;
    text-align: center;
    color: white;
    overflow: hidden;
}

.mh-hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--mkisan-primary) 0%, var(--mkisan-primary-dark) 100%);
    z-index: 0;
}

.mh-hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.mh-hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.mh-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.mh-hero h1 {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.3;
    margin: 0 0 16px;
}

.mh-hero h1 span {
    color: #fef08a;
}

.mh-hero>.mh-hero-content>p {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 30px;
}

/* Hero Buttons */
.mh-hero-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.mh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: var(--mkisan-radius);
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.mh-btn-white {
    background: white;
    color: var(--mkisan-primary) !important;
}

.mh-btn-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    color: var(--mkisan-primary) !important;
}

.mh-btn-outline {
    background: transparent;
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.mh-btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.mh-btn-primary {
    background: var(--mkisan-primary);
    color: white;
}

.mh-btn-primary:hover {
    background: var(--mkisan-primary-dark);
}

/* Hero Stats */
.mh-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.mh-stat {
    text-align: center;
}

.mh-stat strong {
    display: block;
    font-size: 28px;
    font-weight: 800;
}

.mh-stat span {
    font-size: 14px;
    opacity: 0.8;
}

/* =================================================================
   QUICK ACTIONS
   ================================================================= */

.mh-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 20px;
    margin-top: -40px;
    position: relative;
    z-index: 10;
}

.mh-action-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--mkisan-bg-white);
    border-radius: var(--mkisan-radius);
    box-shadow: var(--mkisan-shadow);
    transition: all 0.3s;
}

.mh-action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--mkisan-shadow-lg);
}

.mh-action-icon {
    font-size: 32px;
}

.mh-action-card strong {
    display: block;
    font-size: 14px;
    color: var(--mkisan-text);
}

.mh-action-card small {
    font-size: 12px;
    color: var(--mkisan-text-light);
}

/* =================================================================
   SECTIONS
   ================================================================= */

.mh-section {
    padding: 30px 20px;
}

.mh-section-alt {
    background: var(--mkisan-bg-white);
}

.mh-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 16px;
}

.mh-section-head h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--mkisan-text);
}

.mh-date {
    font-size: 13px;
    color: var(--mkisan-text-light);
    margin: 4px 0 0;
}

.mh-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--mkisan-primary);
    white-space: nowrap;
}

.mh-no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--mkisan-text-light);
    background: var(--mkisan-bg-white);
    border-radius: var(--mkisan-radius);
}

/* =================================================================
   MANDI CARDS
   ================================================================= */

.mh-mandi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.mh-mandi-card {
    background: var(--mkisan-bg-white);
    border-radius: var(--mkisan-radius);
    padding: 16px;
    box-shadow: var(--mkisan-shadow);
}

.mh-mandi-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.mh-crop-icon {
    font-size: 32px;
}

.mh-mandi-card h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
}

.mh-mandi-loc {
    font-size: 12px;
    color: var(--mkisan-text-light);
    margin: 2px 0 0;
}

.mh-price-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.mh-price-item {
    text-align: center;
    flex: 1;
}

.mh-price-label {
    display: block;
    font-size: 10px;
    color: var(--mkisan-text-light);
    text-transform: uppercase;
}

.mh-price-val {
    font-size: 14px;
    font-weight: 700;
}

.mh-price-min {
    color: var(--mkisan-danger);
}

.mh-price-max {
    color: var(--mkisan-primary);
}

.mh-price-modal .mh-price-val {
    color: var(--mkisan-primary);
    background: var(--mkisan-primary-bg);
    padding: 4px 8px;
    border-radius: 8px;
}

/* =================================================================
   EGG CARDS
   ================================================================= */

.mh-egg-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.mh-egg-card {
    background: var(--mkisan-bg);
    border-radius: var(--mkisan-radius);
    padding: 16px;
}

.mh-egg-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.mh-egg-icon {
    font-size: 28px;
}

.mh-egg-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.mh-egg-prices {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.mh-egg-price {
    text-align: center;
    flex: 1;
}

.mh-egg-price span {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--mkisan-primary);
}

.mh-egg-price small {
    font-size: 10px;
    color: var(--mkisan-text-light);
}

/* =================================================================
   DEALS SECTION (Horizontal Scroll)
   ================================================================= */

.mh-deals-section {
    background: linear-gradient(135deg, var(--mkisan-primary-bg) 0%, #dcfce7 100%);
    padding-bottom: 40px;
}

.mh-deals-scroll {
    margin: 0 -20px;
    padding: 0 20px;
    overflow: hidden;
}

.mh-deals-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 10px 0 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.mh-deals-track::-webkit-scrollbar {
    display: none;
}

/* Deal Card */
.mh-deal-card {
    flex: 0 0 280px;
    scroll-snap-align: start;
    background: var(--mkisan-bg-white);
    border-radius: var(--mkisan-radius);
    overflow: hidden;
    box-shadow: var(--mkisan-shadow-sm);
    border: 1px solid var(--mkisan-border);
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
}

.mh-deal-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--mkisan-shadow-lg);
    border-color: var(--mkisan-primary);
}

.mh-deal-img {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--mkisan-bg);
    overflow: hidden;
}

.mh-deal-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.mh-deal-card:hover .mh-deal-img img {
    transform: scale(1.05);
}

.mh-deal-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 48px;
    background: linear-gradient(135deg, var(--mkisan-primary-bg) 0%, #dcfce7 100%);
}

/* Deal Badges */
.mh-deal-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.mh-deal-badge.sell {
    background: var(--mkisan-sell-color);
    color: white;
}

.mh-deal-badge.buy {
    background: var(--mkisan-buy-color);
    color: white;
}

.mh-deal-featured {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    background: #f97316;
    color: white;
}

/* Deal Content */
.mh-deal-content {
    padding: 12px 14px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mh-deal-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mh-deal-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--mkisan-text);
    flex: 1;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mh-badge-organic {
    font-size: 14px;
    cursor: help;
}

.mh-deal-variety {
    font-size: 12px;
    color: var(--mkisan-text-light);
    margin: 0;
}

.mh-deal-quality {
    font-size: 12px;
    color: var(--mkisan-warning);
    margin: 0;
    font-weight: 600;
}

.mh-deal-loc {
    font-size: 13px;
    color: var(--mkisan-text-light);
    margin: 0;
}

/* Deal Footer */
.mh-deal-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0 0;
    margin-top: auto;
}

.mh-deal-price-group {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.mh-deal-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--mkisan-primary);
    line-height: 1;
}

.mh-deal-unit {
    font-size: 12px;
    color: var(--mkisan-text-light);
}

.mh-deal-qty-group {
    display: none;
}

.mh-deal-qty {
    font-size: 12px;
    color: var(--mkisan-text);
    background: var(--mkisan-bg);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* Deal Seller */
.mh-deal-seller {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--mkisan-text-light);
}

.mh-seller-icon {
    font-size: 12px;
}

.mh-seller-name {
    font-weight: 500;
    color: var(--mkisan-text);
}

.mh-role-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--mkisan-bg);
    margin-left: auto;
}

.mh-deal-time {
    font-size: 11px;
    color: var(--mkisan-text-muted);
    margin: 0;
    text-align: right;
}

/* Deal CTA */
.mh-deal-cta-wrap {
    padding: 10px 14px;
    border-top: 1px solid var(--mkisan-bg);
}

.mh-deal-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--mkisan-primary);
    color: white;
    border: none;
    border-radius: var(--mkisan-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mh-deal-card:hover .mh-deal-cta-btn {
    background: var(--mkisan-primary-dark);
}

.mh-deal-cta-btn i {
    font-size: 14px;
}

/* =================================================================
   BLOG SECTION
   ================================================================= */

.mh-blog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.mh-blog-card {
    display: flex;
    gap: 16px;
    background: var(--mkisan-bg-white);
    border-radius: var(--mkisan-radius);
    overflow: hidden;
    box-shadow: var(--mkisan-shadow);
    cursor: pointer;
    transition: all 0.3s;
}

.mh-blog-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--mkisan-shadow-lg);
}

.mh-blog-img {
    flex: 0 0 100px;
    height: 100px;
    background-size: cover;
    background-position: center;
    background-color: var(--mkisan-bg);
    position: relative;
}

.mh-blog-img span {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: var(--mkisan-primary);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
}

.mh-blog-content {
    padding: 12px 12px 12px 0;
    flex: 1;
}

.mh-blog-content h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mh-blog-content p {
    font-size: 12px;
    color: var(--mkisan-text-light);
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mh-blog-date {
    font-size: 11px;
    color: var(--mkisan-text-light);
}

/* =================================================================
   API SECTION
   ================================================================= */

.mh-api-section {
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--mkisan-primary) 0%, var(--mkisan-primary-dark) 100%);
    color: white;
}

.mh-api-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.mh-api-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}

.mh-api-text h2 {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 12px;
}

.mh-api-text p {
    font-size: 16px;
    opacity: 0.9;
    margin: 0 0 24px;
}

.mh-api-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.mh-api-features li {
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
}

/* =================================================================
   CTA SECTION
   ================================================================= */

.mh-cta {
    text-align: center;
    padding: 50px 20px;
    background: var(--mkisan-bg-white);
}

.mh-cta h2 {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 12px;
}

.mh-cta p {
    font-size: 16px;
    color: var(--mkisan-text-light);
    margin: 0 0 24px;
}

.mh-cta-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.mh-cta .mh-btn-white {
    background: var(--mkisan-primary);
    color: white !important;
}

.mh-cta .mh-btn-outline {
    color: var(--mkisan-primary) !important;
    border-color: var(--mkisan-primary);
}

/* =================================================================
   RESPONSIVE STYLES
   ================================================================= */

/* Mobile (< 640px) */
@media (max-width: 639px) {
    .mh-deals-track {
        padding: 8px 0 16px;
    }

    .mh-deal-card {
        flex: 0 0 220px;
        border-radius: 10px;
    }

    .mh-deal-img {
        aspect-ratio: 3/2;
    }

    .mh-deal-content {
        padding: 10px 12px 6px;
        gap: 4px;
    }

    .mh-deal-content h3 {
        font-size: 14px;
        line-height: 1.3;
        -webkit-line-clamp: 2;
    }

    .mh-deal-loc {
        font-size: 12px;
    }

    .mh-deal-price {
        font-size: 16px;
    }

    .mh-deal-unit {
        font-size: 11px;
    }

    .mh-deal-seller {
        font-size: 12px;
    }

    .mh-deal-cta-wrap {
        padding: 8px 12px;
    }

    .mh-deal-cta-btn {
        padding: 10px;
        font-size: 13px;
        border-radius: 6px;
    }

    .mh-deal-badge {
        padding: 3px 8px;
        font-size: 10px;
    }
}

/* Tablet (>= 640px) */
@media (min-width: 640px) {
    .mh-hero {
        padding: 80px 40px;
    }

    .mh-hero h1 {
        font-size: 42px;
    }

    .mh-actions {
        grid-template-columns: repeat(4, 1fr);
        max-width: 900px;
        margin: -40px auto 0;
    }

    .mh-section {
        padding: 40px;
        max-width: 1200px;
        margin: 0 auto;
    }

    .mh-mandi-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .mh-egg-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Deals - Desktop Grid */
    .mh-deals-scroll {
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    .mh-deals-track {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        overflow: visible;
        padding: 10px 0;
    }

    .mh-deal-card {
        flex: none;
    }

    .mh-blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mh-blog-img {
        flex: 0 0 140px;
        height: 120px;
    }
}

/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
    .mh-hero h1 {
        font-size: 52px;
    }

    .mh-mandi-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .mh-blog-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .mh-blog-card {
        flex-direction: column;
    }

    .mh-blog-img {
        flex: none;
        width: 100%;
        height: 140px;
    }

    .mh-blog-content {
        padding: 16px;
    }
}