/* =========================================
   MODERN HERBAL STORE THEME
   ========================================= */
/* Hide the dropdown arrow on Desktop */
@media (min-width: 769px) {
    .dropdown-icon { display: none; }
    .sidebar ul { display: block !important; padding: 0; border: none; }
    .sidebar-header { cursor: default; padding-bottom: 15px; }
}

:root {
    --primary-color: #2e7d32;
    --primary-hover: #1b5e20;
    --bg-color: #f8fafc; /* Soft modern off-white background */
    --card-bg: #ffffff;
    --text-main: #1e293b; /* Softer than pure black */
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius-lg: 16px; /* Modern rounded corners */
    --radius-sm: 8px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- HEADER --- */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo a {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.social-share a:hover { transform: scale(1.2); }

/* --- SEARCH BAR --- */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px; /* Puts a neat little space between the box and the button */
    width: 100%;
    max-width: 450px; /* Prevents it from stretching too far on big screens */
}

.search-bar input {
    flex: 1; /* Makes the typing area stretch to fill the space */
    margin: 0; /* Removes any default spacing */
}

.search-bar button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px; /* Modern pill shape */
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap; /* Prevents the word "Search" from breaking into two lines */
}

.search-bar button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* --- MODERN BUTTONS --- */
.btn, .full-width-btn, .cart-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 50px; /* Pill shape */
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    text-align: center;
}

.btn:hover, .full-width-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px); /* Lifts up slightly */
    box-shadow: var(--shadow-md);
}

.full-width-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 15px;
}

/* --- LAYOUTS --- */
.shop-layout, .page-container {
    display: flex;
    gap: 30px;
    margin-top: 40px;
    margin-bottom: 60px;
}

/* --- SIDEBAR & CARDS --- */
.sidebar, .sidebar-summary, .main-content {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.sidebar { width: 250px; flex-shrink: 0; height: fit-content; }
.sidebar-summary { width: 350px; height: fit-content; position: sticky; top: 100px; }
.content-area, .main-content { flex: 1; }

.sidebar h3, .sidebar-summary h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

.sidebar ul { list-style: none; }
.sidebar ul li { margin-bottom: 10px; }
.sidebar ul li a {
    color: var(--text-muted);
    font-weight: 400;
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}
.sidebar ul li a:hover {
    background: #f1f5f9;
    color: var(--primary-color);
    padding-left: 15px; /* Slides right on hover */
}

/* --- PRODUCT GRID --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.product-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: transparent;
}

.product-image-wrapper img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 15px;
    transition: var(--transition);
}

.product-card:hover .product-image-wrapper img {
    transform: scale(1.05); /* Gentle zoom on hover */
}

.product-card h3 {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--text-main);
}

.product-card .price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* --- FORMS & INPUTS --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

input[type="text"], input[type="email"], input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    transition: var(--transition);
    background: #f8fafc;
}

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1); /* Soft green glow */
}

/* --- TOAST NOTIFICATIONS --- */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: var(--text-main);
    color: white;
    padding: 15px 25px;
    border-radius: var(--radius-sm);
    margin-top: 10px;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* --- ANIMATIONS --- */
@keyframes cartBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.cart-bounce { animation: cartBounce 0.4s ease; }

/* --- PROFILE / ORDER CARDS --- */
.order-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.order-header {
    background: #f1f5f9;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}



/* ==========================================
   PRODUCT CARD ALIGNMENT & TITLE SCROLL FIX
   ========================================== */

/* 1. Force all cards to be the same height and push the button to the bottom */
.product-card {
    display: flex;
    flex-direction: column;
    height: 100%; /* Fills the grid row equally */
    box-sizing: border-box;
}

/* 2. Lock the title to exactly 2 lines (Scrollable but hidden scrollbar) */
.product-card h3 {
    font-size: 16px;
    line-height: 1.4em;       /* Height of one line of text */
    height: 2.8em;            /* 1.4 x 2 = Exactly 2 lines tall */
    margin: 10px 0;
    
    /* Allow scrolling if text is longer than 2 lines */
    overflow-y: auto;         
    
    /* Hide scrollbar for Firefox */
    scrollbar-width: none;    
    /* Hide scrollbar for IE/Edge */
    -ms-overflow-style: none; 
}

/* Hide scrollbar for Chrome, Safari, and Opera */
.product-card h3::-webkit-scrollbar {
    display: none;
}

/* 3. Push the button to the very bottom of the card automatically */
.product-card .price {
    margin-bottom: 15px;
}

.product-card .btn {
    margin-top: auto; /* This pushes the button down to align with the others */
    width: 100%;
}

/* --- MOBILE RESPONSIVE (Scaled down ~15%) --- */
@media (max-width: 768px) {
    .shop-layout, .page-container { flex-direction: column; gap: 20px; }
    
    /* 1. Search Bar Perfection */
    .search-bar {
        display: flex !important;
        width: 100% !important;
        gap: 8px !important; /* Tightens the gap slightly */
    }
    .search-bar input {
        flex: 1 !important; /* Forces the text box to take up exactly the leftover space */
        padding: 10px 15px !important;
        font-size: 14px !important;
        border-radius: 50px !important; /* Matches the pill-shape of the button */
    }
    .search-bar button {
        padding: 10px 20px !important;
        font-size: 14px !important;
        flex-shrink: 0 !important; /* Prevents the button from being squished */
        margin: 0 !important;
    }

    /* 2. Login & Cart Alignment with a Divider */
    .user-actions {
        display: flex !important;
        width: 100% !important;
        align-items: center !important;
        border-top: 1px solid var(--border-color);
        padding-top: 15px !important;
        margin-top: 5px !important;
        box-sizing: border-box !important;
    }
    .user-actions .nav-link {
        font-size: 14px !important;
        margin: 0 !important;
        line-height: 1 !important;
    }
    .user-actions .cart-btn {
        margin: 0 !important;
        padding: 8px 18px !important;
    }
    
    /* 1. Shrink container paddings */
    .sidebar, .sidebar-summary, .main-content { 
        width: 100%; 
        position: static; 
        padding: 18px; /* Shrunk from 25px */
    }
    
    .header-top { flex-direction: column; gap: 12px; text-align: center; padding: 10px 0; }
    
    /* 2. Shrink Logo & Headings */
    .logo a { font-size: 20px; }
    .main-content h2 { font-size: 20px !important; }
    .sidebar-summary h3 { font-size: 16px !important; }
    
    /* 3. Shrink general text and Summary details */
    p, .summary-line { font-size: 13.5px !important; }
    .summary-total { font-size: 16px !important; padding-top: 12px !important; margin-top: 12px !important; }
    
    /* 4. Shrink Buttons */
    .btn, .cart-btn { padding: 8px 18px; font-size: 13px; }
    .full-width-btn { padding: 12px; font-size: 14px; margin-top: 10px; }
    .user-actions { gap: 12px; }
    
    /* Storefront grid (2 items per row) */
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-card { padding: 12px; }
    .product-image-wrapper img { height: 110px; margin-bottom: 8px; }
    .product-card h3 { font-size: 12.5px !important; margin-bottom: 5px; }
    .product-card .price { font-size: 14.5px; margin-bottom: 8px; }
    .product-card .btn { padding: 8px 12px; font-size: 12px; width: 100%; }

    /* Mobile Cart Fix */
    .cart-item { flex-direction: column !important; align-items: flex-start !important; gap: 10px !important; }
    .cart-item .item-details { width: 100% !important; align-items: flex-start !important; }
    .cart-item .item-details img { width: 60px !important; height: 60px !important; margin-top: 5px; }
    .cart-item .price { align-self: flex-end !important; margin-top: 0 !important; width: 100% !important; text-align: right !important; padding-top: 8px !important; border-top: 1px dashed var(--border-color); font-size: 15px !important; }
    
    /* 1. Perfect Header Alignment */
    .header-top {
        width: 100% !important;
        padding: 15px 30px !important;
    }
    .search-bar {
        width: 100% !important;
        max-width: 100% !important; /* Forces it to stretch to the exact edges */
    }
    .user-actions {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important; /* Pushes Login to the left edge, Cart to the right edge */
        align-items: center !important;
    }

    /* 2. Category Dropdown Styles */
    .sidebar {
        padding: 0 !important; /* Removes padding so the header touches the edges */
        overflow: hidden;
    }
    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 18px;
        cursor: pointer;
        background: var(--card-bg);
    }
    .sidebar-header h3 {
        margin: 0 !important;
        font-size: 16px !important;
    }
    .sidebar ul {
        display: none; /* Hides the list by default on mobile */
        padding: 0 18px 18px 18px;
        border-top: 1px solid var(--border-color);
    }
    .sidebar.dropdown-open ul {
        display: block; /* Shows the list when tapped */
    }
    .dropdown-icon {
        transition: transform 0.3s ease;
        font-size: 14px;
        color: var(--primary-color);
    }
    .sidebar.dropdown-open .dropdown-icon {
        transform: rotate(180deg); /* Flips the arrow upside down when open */
    }
}