/* ==============================
   Cart Icon
   ============================== */

.beetle-cart-icon-wrapper {
    position: relative;
    display: inline-block;
}

.beetle-cart-icon {
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    padding: 8px;
    color: #333;
    transition: color 0.3s ease;
}

.beetle-cart-icon:hover {
    color: #4CAF50;
}

.beetle-cart-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}

.beetle-cart-count:empty {
    display: none;
}


/* ==============================
   Modal Overlay & Container
   ============================== */

.beetle-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.beetle-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
}

.beetle-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.beetle-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 32px;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    color: #333;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.beetle-modal-close:hover {
    background: #e74c3c;
    color: white;
    transform: rotate(90deg);
}


/* ==============================
   Modal Body
   ============================== */

.beetle-modal-body {
    padding: 30px;
    position: relative;
}

.beetle-modal-image-container {
    width: 100%;
    height: 350px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    background: #f5f5f5;
    position: relative;
}

.beetle-modal-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.beetle-modal-title {
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 10px 0;
    color: #333;
    text-align: center;
}

/* For single items with inline price */
.beetle-modal-title.beetle-single-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    text-align: left;
}

.beetle-modal-price-inline {
    font-size: 22px;
    font-weight: bold;
    color: #4CAF50;
    white-space: nowrap;
}

.beetle-modal-price {
    font-size: 28px;
    font-weight: bold;
    color: #4CAF50;
    margin: 0 0 15px 0;
}

.beetle-modal-description {
    position: absolute;
    bottom: 80px;
    left: 30px;
    right: 30px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.beetle-promo-overlay-content {
    color: white;
}

.beetle-promo-items-text {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin-bottom: 10px;
    line-height: 1.4;
}

.beetle-promo-pricing {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.beetle-promo-original-price {
    color: #999;
    text-decoration: line-through;
    font-size: 14px;
}

.beetle-promo-final-price {
    color: #4CAF50;
    font-size: 24px;
    font-weight: bold;
}

.beetle-promo-discount-badge-display {
    position: absolute;
    top: -330px;
    left: 15px;
    background: #4CAF50;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.beetle-promo-timer-display {
    position: absolute;
    top: -330px;
    right: 15px;
    background: #e74c3c;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}


/* ==============================
   Quantity Controls
   ============================== */

.beetle-modal-quantity {
    margin-bottom: 25px;
}

.beetle-stage-selector {
    margin-bottom: 20px;
}

.beetle-stage-selector label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.beetle-stage-select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    background: white;
}

.beetle-quantity-control {
    margin-bottom: 20px;
	display: flex;
    flex-direction: column;
    align-items: center;
	justify-content: center;
}

.beetle-quantity-control label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
    text-align: center;
}

.beetle-quantity-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
	justify-content: center;
}

.beetle-qty-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
}

.beetle-qty-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.beetle-qty-btn:active {
    transform: translateY(0);
}

.beetle-qty-input {
    flex: 1;
    padding: 10px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 6px;
    max-width: 100px;
	width: 60px;
}

.beetle-qty-input:focus {
    outline: none;
    border-color: #4CAF50;
}

.beetle-available-qty {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.beetle-quantity-gender {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.beetle-quantity-gender-horizontal {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    gap: 20px;
}

.beetle-gender-section {
    flex: 1;
}

.beetle-gender-section label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
    text-align: center;
}


/* ==============================
   Modal Actions
   ============================== */

.beetle-modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.beetle-modal-actions .beetle-btn {
    flex: 1;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.beetle-modal-actions .beetle-btn-secondary {
    background: #6c757d;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.beetle-modal-actions .beetle-btn-primary {
    background: #28a745;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.beetle-modal-actions .beetle-btn-primary:hover {
    background: #218838;
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.4);
}


/* ==============================
   Cart Sidebar
   ============================== */

.beetle-cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
}

.beetle-cart-sidebar-open {
    pointer-events: auto;
}

.beetle-cart-sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.beetle-cart-sidebar-open .beetle-cart-sidebar-overlay {
    opacity: 1;
}

.beetle-cart-sidebar-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90%;
    height: 100%;
    background: white;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.beetle-cart-sidebar-open .beetle-cart-sidebar-content {
    transform: translateX(0);
}


/* ==============================
   Sidebar Header
   ============================== */

.beetle-cart-sidebar-header {
    padding: 20px;
    border-bottom: 2px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
}

.beetle-cart-sidebar-header h3 {
    margin: 0;
    font-size: 22px;
    color: #333;
}

.beetle-cart-sidebar-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    transition: color 0.2s ease;
    padding: 0;
    width: 36px;
    height: 36px;
}

.beetle-cart-sidebar-close:hover {
    color: #e74c3c;
}


/* ==============================
   Sidebar Body (Cart Items)
   ============================== */

.beetle-cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.beetle-cart-empty {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 16px;
}

.beetle-cart-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    position: relative;
    transition: background 0.2s ease;
}

.beetle-cart-item:hover {
    background: #f9f9f9;
}

.beetle-cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
}

.beetle-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.beetle-cart-item-details {
    flex: 1;
}

.beetle-cart-item-details h4 {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: #333;
    font-weight: 600;
}

.beetle-cart-item-quantity,
.beetle-cart-item-price {
    margin: 4px 0;
    font-size: 13px;
    color: #666;
}

.beetle-cart-item-price {
    font-weight: bold;
    color: #4CAF50;
}

.beetle-cart-item-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s ease;
}

.beetle-cart-item-remove:hover {
    background: #c0392b;
    transform: rotate(90deg);
}


/* ==============================
   Sidebar Footer
   ============================== */

.beetle-cart-sidebar-footer {
    padding: 20px;
    border-top: 2px solid #eee;
    background: #f9f9f9;
}

.beetle-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

#beetle-cart-total-price {
    color: #4CAF50;
    font-size: 24px;
}

.beetle-btn-block {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: bold;
}


/* ==============================
   Responsive Design
   ============================== */

@media (max-width: 768px) {
    .beetle-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .beetle-modal-body {
        padding: 20px;
    }
    
    .beetle-modal-image-container {
        height: 250px;
    }
    
    .beetle-quantity-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .beetle-qty-btn {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 45px;
    }
    
    .beetle-cart-sidebar-content {
        width: 100%;
        max-width: 100%;
    }
    
    .beetle-quantity-gender-horizontal {
        flex-direction: column;
        gap: 15px;
    }
    
    .beetle-modal-title {
        font-size: 18px;
    }
    
    .beetle-modal-price-inline {
        font-size: 20px;
    }
}


/* ==============================
   Utility Classes
   ============================== */

.beetle-btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.beetle-btn-primary {
    background: #4CAF50;
    color: white;
}

.beetle-btn-primary:hover {
    background: #45a049;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.beetle-btn-secondary {
    background: #999;
    color: white;
}

.beetle-btn-secondary:hover {
    background: #777;
}

.beetle-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==============================
   Dual-Stage Larvae Layout
   ============================== */

.beetle-larvae-stage-section {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.beetle-larvae-stage-section:last-of-type {
    margin-bottom: 0;
}

.beetle-stage-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 15px 0;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.beetle-stage-title::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
}

/* Adjust spacing within stage sections */
.beetle-larvae-stage-section .beetle-quantity-gender-horizontal,
.beetle-larvae-stage-section .beetle-quantity-control {
    margin-bottom: 0;
}

.beetle-larvae-stage-section .beetle-gender-section label,
.beetle-larvae-stage-section .beetle-quantity-control label {
    margin-bottom: 10px;
}

/* Make modal scrollable when both stages are present */
.beetle-modal-content {
    max-height: 95vh;
}

.beetle-modal-body {
    max-height: calc(95vh - 60px);
    overflow-y: auto;
}

/* Responsive adjustments for dual-stage */
@media (max-width: 768px) {
    .beetle-larvae-stage-section {
        padding: 15px;
    }
    
    .beetle-stage-title {
        font-size: 16px;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
}