/* Import Google Fonts - Bayon for Khmer, Inter for general text/numbers */
@import url('https://fonts.googleapis.com/css2?family=Bayon&family=Inter:wght@400;500;600;700&display=swap');

/* --- 1. Global Variables --- */
:root {
    --primary-blue: #3498db;     /* Main CTA color */
    --light-blue: #5bc0de;       /* Accent color */
    --text-dark: #333;           /* Primary text color */
    --text-red: #e74c3c;         /* Price/Accent Red */
    --border-light: #ecf0f1;     /* Light gray border */
    --shadow-light: rgba(0, 0, 0, 0.1);
    --success-green: #2ecc71;    /* Checkout button color */
    --alert-yellow: #f1c40f;     /* Promo/alert color */
}

/* --- 2. Global Reset & Typography --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Bayon', 'Inter', sans-serif; 
}

body {
    background-color: #f4f7f9;
    color: var(--text-dark);
    font-family: 'Bayon', 'Inter', sans-serif;
}

.container {
    padding: 0 15px; 
    margin: 0 auto;
}

/* --- 3. HEADER/NAVBAR STYLING --- */
.navbar {
    background-color: var(--primary-blue);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    box-shadow: 0 2px 4px var(--shadow-light);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.shop-logo-trigger { 
    display: flex;
    align-items: center; 
    /* Reduced flex-grow slightly to make room for buttons on mobile */
    flex-grow: 0.8; 
    cursor: pointer;
}

.shop-logo-trigger img:first-child {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: white;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
}

.shop-logo-trigger img:last-child {
    width: auto;
    max-width: 250px;
    height: 60px;
    object-fit: contain;
    flex-grow: 1; 
}

/* ** FIX APPLIED HERE: **
    Changed 'display: none;' to 'display: flex;' to show the buttons
    on all screen sizes (mobile and PC).
*/
.nav-buttons {
    display: flex; /* <-- Buttons are now visible! */
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0; /* Ensures buttons don't shrink */
}

.nav-btn {
    padding: 8px 15px;
    margin-left: 8px;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s, transform 0.1s;
}

.sell-btn { 
    background-color: white;
    color: var(--primary-blue);
}

/* --- 4. GENERAL APP STYLING --- */
.banner {
    margin: 15px 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); 
}

.banner-image {
    width: 100%;
    height: auto;
    display: block;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: white;
    padding: 10px 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px var(--shadow-light);
}

.search-bar input {
    flex-grow: 1;
    border: none;
    padding: 5px 10px;
    font-size: 1em;
    outline: none;
}

.search-bar i {
    color: #95a5a6;
    margin-right: 10px;
}

/* --- Product Card Styling --- */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 18px; 
}

.product-card {
    display: flex;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px var(--shadow-light);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.18);
}

.product-image-container {
    flex-shrink: 0;
    width: 140px; 
    height: 140px;
    overflow: hidden;
    border-radius: 12px 0 0 12px; 
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.product-details {
    padding: 12px 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1; 
}

.product-title {
    font-size: 1.15em;
    font-weight: bold;
    margin-bottom: 4px;
    line-height: 1.2;
}

.product-price {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--text-red);
    margin-bottom: 4px;
}

.product-description {
    font-family: 'Inter', sans-serif; 
    font-size: 0.85em;
    color: #777;
    line-height: 1.4;
    max-height: 40px; 
    overflow: hidden;
    flex-grow: 1;
}

.buy-now-btn {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.9em;
    align-self: flex-start; 
    margin-top: 8px; 
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
    font-family: 'Inter', sans-serif;
}

.buy-now-btn:hover {
    background-color: #2980b9;
}


/* --- 5. MODAL STYLING (Product Modal & Shop Modal) --- */

.modal {
    display: none; 
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    padding-top: 50px;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 10% auto; 
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px; 
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    position: relative;
    text-align: center;
    animation: fadeIn 0.3s;
    font-family: 'Inter', 'Battambang', sans-serif; 
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 32px;
    font-weight: bold;
    position: absolute;
    top: 5px;
    right: 15px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover, .close-btn:focus {
    color: var(--text-dark);
    text-decoration: none;
    cursor: pointer;
}

.modal-title {
    font-size: 1.4em;
    color: var(--primary-blue);
    margin-bottom: 15px;
    padding-right: 30px; 
    text-align: left;
}

.modal-ad-image-container {
    margin-bottom: 15px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}

.modal-ad-image {
    width: 100%;
    height: auto;
    display: block;
}

.modal-pricing-details {
    text-align: left;
    padding-bottom: 10px;
}

.description-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.9em;
    line-height: 1.4;
    color: #555;
    padding: 5px 0 15px 10px; 
    border-left: 3px solid var(--light-blue);
    margin-bottom: 15px;
    white-space: pre-line;
}

/* Price Grid Styling for the Modal */
.price-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    border: 1px dashed var(--border-light);
    border-radius: 8px;
}

.price-item {
    padding: 8px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
    font-weight: 500;
    border: 1px solid var(--border-light);
    font-family: 'Inter', sans-serif;
}

.price-item p:first-child {
    color: #666;
}

/* Base Price Line Styling (The large one at the top) */
.base-price-line {
    font-size: 1.1rem;
    color: #333;
    margin: 15px 0 10px;
    padding: 8px 10px; 
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px;
    border: 2px solid transparent; 
}
.price-value-large {
    color: var(--text-red);
    font-weight: 700;
}


.price-value {
    font-weight: bold;
    color: var(--text-red);
}


.buy-now-modal-btn {
    background-color: var(--success-green);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    width: 100%;
    margin-top: 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: 0 4px 6px rgba(46, 204, 113, 0.4);
    font-family: 'Inter', sans-serif;
}

.buy-now-modal-btn:hover {
    background-color: #27ae60;
}

.error-message {
    padding: 15px;
    background-color: #fce4e4;
    border: 1px solid var(--text-red);
    color: var(--text-red);
    border-radius: 8px;
    margin: 15px 0;
    font-size: 1em;
    text-align: center;
    line-height: 1.4;
}

/* Price Option Selection Styling */
.price-option {
    cursor: pointer;
    border: 2px solid transparent;
    transition: border 0.2s ease-in-out, background-color 0.2s ease-in-out;
    border-radius: 8px;
}

.price-option:hover {
    border-color: #a0a0a0;
}

.price-option.selected {
    border: 2px solid #10b981;
    background-color: #f0fdf4;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.price-grid .price-item.selected { 
    background-color: #f0fdf4;
}

/* --- 6. DESKTOP VIEW (Mobile Container Centering) --- */

@media (min-width: 600px) {
    
    body {
        background-color: #ddd; 
    }

    .container {
        max-width: 400px; 
        margin: 0 auto; 
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.25); 
        min-height: 100vh; 
        background-color: #f4f7f9; 
        padding: 0 15px; 
    }

    .navbar {
        max-width: 400px; 
        margin: 0 auto;
        justify-content: space-between;
    }
    
    
    
    .modal-content {
        margin-top: 80px; 
    }
}
@media (min-width: 430px) {
    
    body {
        background-color: #ddd; 
    }

    .container {
        max-width: 400px; 
        margin: 0 auto; 
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.25); 
        min-height: 100vh; 
        background-color: #f4f7f9; 
        padding: 0 15px; 
    }

    .navbar {
        max-width: 400px; 
        margin: 0 auto;
        justify-content: space-between;
    }
    
    
    
    .modal-content {
        margin-top: 80px; 
    }
}