/* ==========================================
   CSS Variables (Root)
   ========================================== */
:root { 
    --primary: #2e7d32; 
    --secondary: #8bc34a; 
    --dark: #1b5e20; 
    --light: #f1f8e9; 
    --accent: #ff9800; 
    --danger: #d32f2f; 
    --info: #0288d1; 
}

/* ==========================================
   Global Reset
   ========================================== */
* { box-sizing: border-box; }

body { 
    font-family: 'Segoe UI', Arial, sans-serif; 
    background-color: #f4f7f4; 
    margin: 0; 
    padding: 10px; 
}

/* ==========================================
   Page Loader
   ========================================== */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
    display: none;
}


.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #e8f5e9;
    border-top: 5px solid var(--primary);
    border-right: 5px solid var(--secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loader-text {
    margin-top: 20px;
    font-size: 1.1rem;
    color: var(--dark);
    font-weight: 600;
}

.loader-subtext {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #666;
}

/* ==========================================
   Main Container
   ========================================== */
.container {
    max-width: 700px;
    margin: auto;
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.container.visible {
    opacity: 1;
}

/* ==========================================
   Header
   ========================================== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.header h1 { 
    margin: 0; 
    color: var(--dark); 
    font-size: 1.8rem; 
}

.header .crop-selector { 
    min-width: 160px; 
}

.header select { 
    padding: 8px 12px; 
    border-radius: 30px; 
    border: 2px solid var(--primary); 
    background-color: var(--light); 
    font-weight: bold; 
    color: var(--dark); 
    font-size: 1rem; 
    cursor: pointer; 
    width: 100%; 
}

.subtitle { 
    text-align: center; 
    color: #555; 
    margin-top: 5px; 
    font-size: 0.9rem; 
    width: 100%; 
}

/* ==========================================
   Input Section
   ========================================== */
.section { 
    border: 1px solid #ddd; 
    padding: 15px; 
    border-radius: 12px; 
    background: #fafafa; 
    margin-bottom: 15px; 
}

.section label {
    display: block;
    margin: 12px 0 6px 0;
    font-weight: 600;
    color: #333;
}

.section label:first-child {
    margin-top: 0;
}

.label-hint {
    font-weight: normal;
    font-size: 0.85rem;
    color: #888;
}

input, button, select { 
    padding: 12px; 
    border-radius: 10px; 
    border: 2px solid #ddd; 
    font-size: 16px; 
    width: 100%; 
    box-sizing: border-box; 
    background: white; 
}

button { 
    background: var(--primary); 
    color: white; 
    font-weight: bold; 
    border: none; 
    cursor: pointer; 
    margin-top: 10px; 
    transition: 0.2s; 
}

button:hover { 
    background: var(--dark); 
}

button:disabled { 
    opacity: 0.6; 
    cursor: not-allowed; 
}

/* ==========================================
   Radio Group
   ========================================== */
.radio-group { 
    display: flex; 
    gap: 20px; 
    margin: 15px 0; 
    align-items: center; 
}

.radio-group label { 
    display: flex; 
    align-items: center; 
    gap: 5px; 
    font-weight: 500; 
    margin: 0;
}

.radio-group input[type="radio"] { 
    width: auto; 
    margin-right: 5px; 
    accent-color: var(--primary); 
}

/* ==========================================
   Utility
   ========================================== */
.hidden { 
    display: none; 
}

/* ==========================================
   Option Buttons
   ========================================== */
.option-buttons { 
    display: flex; 
    gap: 10px; 
    margin: 10px 0; 
}

.option-btn { 
    background: #e8f5e9; 
    color: #1b5e20; 
    border: 2px solid #c8e6c9; 
    padding: 10px; 
    border-radius: 30px; 
    font-weight: bold; 
    cursor: pointer; 
    transition: 0.2s; 
    text-align: center; 
    flex: 1; 
}

.option-btn.selected { 
    background: var(--primary); 
    color: white; 
    border-color: var(--dark); 
}

/* ==========================================
   Result Area
   ========================================== */
#result { 
    display: none; 
    margin-top: 20px; 
}

#resTitle {
    margin: 0 0 15px 0;
    color: var(--dark);
}

/* ==========================================
   Search Suggestions
   ========================================== */
.search-suggestions {
    display: none;
    position: absolute;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 10px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    width: calc(100% - 30px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 2px;
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
    color: #333;
    transition: background 0.2s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--light);
    color: var(--dark);
}

/* Make sure the parent is relative for absolute positioning */
#yesContainer {
    position: relative;
}

/* ==========================================
   Success & Alert Boxes
   ========================================== */
.success-box { 
    background: var(--light); 
    padding: 15px; 
    border-radius: 10px; 
    border: 1px solid var(--secondary); 
    margin-bottom: 10px; 
    border-left: 5px solid var(--primary); 
}

.alert-info { 
    background: #e3f2fd; 
    border-left: 5px solid var(--info); 
    padding: 10px; 
    color: var(--info); 
    font-weight: bold; 
    margin-top: 10px; 
    border-radius: 5px; 
}

/* ==========================================
   Product Card (Single Medicine)
   ========================================== */
.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    padding: 15px;
    margin-top: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid #e0e0e0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

/* ==========================================
   Medicine Content Wrapper (Shared)
   ========================================== */
.med-content-wrapper {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
}

.med-left {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.med-photo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    transition: transform 0.2s;
}

.med-photo:hover {
    transform: scale(1.05);
}

.med-count-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background: var(--primary);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.med-right {
    flex: 1;
}

.med-name {
    margin: 0 0 5px 0;
    color: #2e7d32;
    font-size: 1rem;
}

.med-tech {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    margin: 3px 0;
}

.med-company {
    font-size: 0.8rem;
    color: #666;
    margin: 3px 0;
}

.med-price-tag-inline {
    background: #fff3e0;
    color: #e65100;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    margin-top: 5px;
    text-align: center;
    font-size: 0.9rem;
}

/* ==========================================
   Medicine Extra Details
   ========================================== */
.med-extra-details {
    padding-top: 10px;
    font-size: 0.9rem;
    color: #444;
}

.med-extra-details p {
    margin: 5px 0;
}

.med-highlight {
    background: #e8f5e9;
    padding: 3px 8px;
    border-radius: 4px;
    color: #2e7d32;
    font-weight: bold;
    display: inline-block;
}

.med-alert {
    color: #d32f2f !important;
    background: #fff8f8;
    padding: 8px;
    border-left: 4px solid #d32f2f;
    border-radius: 4px;
}

/* ==========================================
   Buy Button
   ========================================== */
.buy-btn {
    background-color: #e65100;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
    margin-top: 12px;
}

.buy-btn:hover {
    background-color: #bf360c;
    transform: scale(1.02);
}

/* ==========================================
   Package Container
   ========================================== */
.package-container-new {
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 12px;
    margin-bottom: 25px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.package-main-header {
    padding: 12px 15px;
    color: white;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
}

.p-type {
    background: rgba(255,255,255,0.25);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.medicine-list-wrapper {
    padding: 15px;
}

.package-medicine-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #eee;
    margin-bottom: 15px;
    padding: 10px;
}

.package-medicine-card:last-child {
    margin-bottom: 0;
}

.package-footer-new {
    background: #eee;
    padding: 15px;
    text-align: center;
}

.total-bill {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: bold;
}

.final-amt {
    color: #d32f2f;
}

.package-buy-btn {
    width: 100%;
    padding: 12px;
    background: #2e7d32;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

.package-buy-btn:hover {
    background: #1b5e20;
}

/* ==========================================
   Pack Combo & Grand Total Styles
   ========================================== */
.pack-combo-list {
    list-style: none;
    padding: 0;
    margin: 8px 0;
    font-size: 0.9rem;
}

.pack-combo-list li {
    display: inline-block;
    background: #e8f5e9;
    padding: 2px 8px;
    border-radius: 12px;
    margin: 2px 4px;
    font-weight: 500;
    color: #2e7d32;
}

.pack-total-price {
    cursor: pointer;
    font-weight: bold;
    color: #e65100;
    background: #fff3e0;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    transition: 0.2s;
    text-decoration: underline dotted;
}

.pack-total-price:hover {
    background: #ffe0b2;
}

.grand-total-card {
    background: #fff;
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 15px;
    margin-top: 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.grand-total-card h3 {
    margin: 0 0 10px;
    color: var(--dark);
}

.grand-total-card .final-amount {
    font-size: 1.5rem;
    color: #d32f2f;
    font-weight: bold;
}

.grand-buy-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
}

.grand-buy-btn:hover {
    background: #1b5e20;
}

/* ==========================================
   Pagination
   ========================================== */
.pagination { 
    display: flex; 
    justify-content: center; 
    align-items: center;
    gap: 8px; 
    margin-top: 25px; 
    flex-wrap: wrap;
    padding: 15px 10px;
    background: #f9f9f9;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.pagination-summary {
    width: 100%;
    text-align: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.page-btn { 
    background: white; 
    color: #333; 
    border: 2px solid #e0e0e0; 
    padding: 10px 16px; 
    border-radius: 10px; 
    cursor: pointer; 
    font-weight: 600; 
    transition: all 0.2s ease;
    min-width: 45px;
    font-size: 0.9rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.page-btn:hover:not(:disabled):not(.active) { 
    background: #e8f5e9; 
    border-color: var(--primary);
    transform: translateY(-1px);
}

.page-btn.active { 
    background: var(--primary); 
    color: white; 
    border-color: var(--dark);
    box-shadow: 0 3px 8px rgba(46, 125, 50, 0.3);
    pointer-events: none;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f5f5f5;
}

.page-btn.nav-btn {
    background: #e8f5e9;
    color: var(--dark);
    font-weight: 700;
}

.page-btn.nav-btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
}

.page-jump {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
}

.page-jump input {
    width: 50px;
    padding: 8px;
    text-align: center;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    font-size: 0.85rem;
    font-weight: 600;
}

.page-jump button {
    padding: 8px 12px;
    margin-top: 0;
    font-size: 0.8rem;
    background: var(--info);
}

/* ==========================================
   Loading & No Results
   ========================================== */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--primary);
    font-weight: bold;
}

.no-results {
    text-align: center;
    padding: 30px;
    color: #888;
    font-size: 1rem;
}

/* ==========================================
   Unified Content Area
   ========================================== */
#unifiedContent {
    margin-top: 10px;
}

/* ==========================================
   Image Zoom Modal
   ========================================== */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.image-modal img {
    max-width: 90%;
    max-height: 80%;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 480px) {
    .container { 
        padding: 15px; 
    }
    
    .header h1 { 
        font-size: 1.4rem; 
    }
    
    .header .crop-selector { 
        min-width: 130px; 
    }
    
    .med-content-wrapper { 
       flex-direction: row;
       align-items: flex-start;
    }
    
    .med-left {
        flex: 0 0 65px;
    }
    
    .med-photo { 
        width: 65px; 
        height: 65px; 
    }
    
    .page-btn { 
        padding: 8px 12px; 
        min-width: 35px; 
        font-size: 0.8rem; 
    }
    
    .page-jump {
        margin-left: 0;
        margin-top: 5px;
    }
    
    .package-main-header {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .search-suggestions {
        width: calc(100% - 30px);
    }
}
/* ==========================================
   Package Card (for search results)
   ========================================== */
.package-card {
    background: white;
    border-radius: 16px;
    padding: 15px;
    margin-top: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid #e0e0e0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.package-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}