/* ========================================================
   CROP TIMELINE PAGE CSS 
   ======================================================== */
.crop-timeline-hero {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    width: 100%;
    padding: 80px 20px;
    margin-top: 0px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 50px;
    box-sizing: border-box;
}

.crop-hero-title {
    color: #ffffff;
    font-size: 38px;
    font-weight: 700;
    margin-bottom: 15px;
    font-family: 'Noto Sans Khmer', sans-serif;
}

.crop-hero-subtitle {
    color: #ffffff;
    font-size: 18px;
    opacity: 0.9;
    font-family: 'Noto Sans Khmer', sans-serif;
}

.crop-timeline-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 80px 20px;
    font-family: 'Noto Sans Khmer', sans-serif;
}

/* ================= 1. PC: VERTICAL TIMELINE LAYOUT ================= */
/* Hide mobile tabs on Desktop */
.mobile-stages-tabs {
    display: none; 
}

.timeline-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.desktop-timeline-row {
    display: flex; /* Always show all rows on PC */
    gap: 40px;
}

/* The Left Side Timeline Graphic */
.timeline-indicator {
    width: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
.timeline-step-name {
    font-size: 20px;
    font-weight: 700;
    color: #222;
    margin-bottom: 15px;
    text-align: center;
}
.timeline-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 5px solid #d4a373; /* Brown border like in pc.jpg */
    overflow: hidden;
    background: #fff;
    z-index: 2;
}
.timeline-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.timeline-line {
    flex-grow: 1; /* Stretches down to the next row */
    width: 3px;
    background-color: var(--brand-green, #0fa153);
    margin-top: 10px;
}

/* The Right Side Light Green Box */
.timeline-content-box {
    flex: 1;
    background-color: #eaf5ee; /* Light green bg like the photo */
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 40px; /* Space before next row */
}
.stage-box-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--brand-green, #0fa153);
    margin-bottom: 10px;
}
.usage-instructions {
    font-size: 14px;
    color: #444;
    margin-bottom: 25px;
    font-weight: 600;
}

/* Products Row Inside Box */
.stage-items-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}
.item-card {
    text-align: center;
    width: 100px;
}
.item-card img {
    width: 80px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 10px;
}
.item-card span {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #222;
}

/* Diseases/Pests Row Inside Box */
.stage-diseases-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
.disease-card {
    position: relative;
    width: 120px;
    border-radius: 8px;
    overflow: hidden;
}
.disease-card img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}
.disease-card span {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 12px;
    text-align: center;
    padding: 4px 0;
}

/* ========================================================
   ADVANCED TAB CONTENT LAYOUT (Columns & Math Symbols)
   ======================================================== */
.app-columns-wrapper {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}
.app-col {
    flex: 1;
    border-right: 2px solid #a4cfa0; /* The vertical green divider line */
    padding-right: 15px;
    display: flex;
    flex-direction: column;
}
.app-col:last-child {
    border-right: none;
    padding-right: 0;
}
.app-time {
    font-size: 14px; 
    font-weight: 700;
    color: #111;
    text-align: center;
    margin-bottom: 15px;
    line-height: 1.5;
    min-height: 40px;
}

/* Products Inside Columns */
.app-products {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0px; /* Slightly reduced gap to help items fit better */
    margin-top: auto;
    
    /* THE FIX: Allows long lists of bottles to wrap to a new line instead of cutting off */
    flex-wrap: wrap; 
}
.item-card-mini {
    text-align: center;
    width: 85px; 
}
.item-card-mini img {
    width: 100%;
    height: 110px; 
    object-fit: contain;
    margin-bottom: 8px;
}
.item-card-mini span {
    display: block;
    font-size: 13px; 
    font-weight: 700;
    color: #222;
    line-height: 1.4;
}

/* Red Plus and OR text */
.red-icon {
    color: #e02020;
    font-size: 24px; 
    font-weight: 900;
    margin-bottom: 30px; 
}
.or-icon {
    font-size: 18px; 
    font-family: 'Noto Sans Khmer', sans-serif;
}

/* 6 Connected Weeds Gallery */
.weeds-grid-gallery {
    display: flex;
    width: 100%;
    gap: 2px; 
}
.weed-pic {
    flex: 1;
    position: relative;
}
.weed-pic img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
}
.weed-pic span {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #75a745; 
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    padding: 5px 2px;
    line-height: 1.2;
}

/* ================= 2. MOBILE TABS & SWIPE FIXES ================= */
@media (max-width: 900px) {
    /* Mobile Hero Banner Adjustments */
    .crop-timeline-hero {
        padding: 40px 15px;
        margin-top: 0px; 
        height: auto; 
    }
    .crop-hero-title { font-size: 26px; }
    .crop-hero-subtitle { font-size: 14px; line-height: 1.5; word-wrap: break-word; }
    
    /* ==========================================
       1. DEFAULT: 8-Tab Scrolling Layout 
       ========================================== */
    .mobile-stages-tabs {
        display: flex;
        justify-content: flex-start;
        width: 100%;
        position: relative;
        margin-bottom: 0;
        padding: 0;
        border-bottom: none; 
        overflow-x: auto; 
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        gap: 15px; 
        -ms-overflow-style: none;  
        scrollbar-width: none;  
    }
    
    .mobile-stages-tabs::-webkit-scrollbar {
        display: none;
    }

    /* The Green Line (Scrolling) */
    .mobile-stages-tabs::before {
        content: '';
        position: absolute;
        top: 30px; 
        left: 0;   
        width: 900px; /* Long line for scrolling tabs */
        height: 2px;
        background-color: var(--brand-green, #0fa153);
        z-index: 0;
    }
    
    /* Default Tab Buttons (Scrolling) */
    .stage-tab-btn {
        flex: 0 0 auto; 
        min-width: 75px; 
        background: none;
        border: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px; 
        opacity: 1; 
        transition: 0.3s;
        cursor: pointer;
        font-family: 'Noto Sans Khmer', sans-serif;
        position: relative;
        z-index: 2;
        padding-bottom: 20px; 
        margin-bottom: 0;
    }

    /* ==========================================
   2. AUTO-DETECT: 4-Tab Fixed Layout 
   (Automatically spaces tabs if exactly 4 exist)
   ========================================== */
    .mobile-stages-tabs:has(.stage-tab-btn:last-child:nth-child(4)) {
    justify-content: space-between;
    overflow-x: hidden; 
    gap: 0;
    width: 100%;
    }

    .mobile-stages-tabs:has(.stage-tab-btn:last-child:nth-child(4))::before {
    width: 100%; 
    }

    .mobile-stages-tabs:has(.stage-tab-btn:last-child:nth-child(4)) .stage-tab-btn {
    flex: 1 1 25%; 
    width: 25%;
    min-width: 0; 
    }
    
    /* ==========================================
       3. Shared Tab Animations & Graphics
       ========================================== */
    .stage-tab-btn.active {
        opacity: 1; 
    }
    
    .stage-tab-btn.active::after {
        content: '';
        position: absolute;
        bottom: 0px; 
        left: 50%;
        transform: translateX(-50%);
        border-width: 0 15px 15px 15px; 
        border-style: solid;
        border-color: transparent transparent #eaf5ee transparent; 
        z-index: 10;
    }
    
    .tab-img-circle {
        width: 46px;
        height: 46px;
        margin-top: 7px; 
        margin-bottom: 7px; 
        border-radius: 50%;
        border: 2px solid var(--brand-green, #0fa153); 
        background-color: #fff; 
        padding: 3px; 
        overflow: hidden;
        transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
        display: block;
        list-style: none;
    }
    
    .stage-tab-btn.active .tab-img-circle {
        width: 60px;
        height: 60px;
        margin-top: 0; 
        margin-bottom: 0;
        padding: 4px; 
    }
    
    .tab-img-circle img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
        display: block;
    }
    
    .stage-tab-btn span {
        font-size: 11px;
        font-weight: 700;
        color: #111;
        text-align: center;
        line-height: 1.4;
        width: 100%;
    }

    /* ==========================================
       4. Hide PC Layout & Show Mobile Content
       ========================================== */
    .timeline-wrapper .timeline-indicator { display: none; }
    .timeline-wrapper .desktop-timeline-row { display: none; }
    .timeline-wrapper .stage-box-title { display: none; }
    
    .timeline-wrapper .desktop-timeline-row.active-mobile-stage {
        display: block;
    }
    
    .timeline-content-box {
        padding: 20px;
        margin-top: 0;
        position: relative;
        z-index: 1;
    }

    .app-columns-wrapper { flex-direction: column; gap: 20px; }
    .app-col { border-right: none; border-bottom: 2px dashed #a4cfa0; padding-right: 0; padding-bottom: 20px; }
    .app-col:last-child { border-right: none; padding-right: 0; border-bottom: none; }
    .weeds-grid-gallery { flex-wrap: wrap; }
    .weed-pic { flex: 0 0 calc(33.333% - 2px); }
}