/* ============================================
   SEARCH MODAL STYLES
   ============================================ */

.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: rgba(30, 45, 35, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 3000;
    justify-content: center;
    align-items: flex-start;
    padding: 100px 20px 20px;
    animation: fadeInModal 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.search-modal.active {
    display: flex;
}

.search-modal-content {
    background: var(--color-bg-surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 700px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideDownZoom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDownZoom {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.search-header {
    display: flex;
    align-items: center;
    padding: 25px;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
}

#search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.2rem;
    font-family: 'Open Sans', sans-serif;
    color: var(--color-text-dark);
    background: transparent;
    padding: 10px;
}

#search-input::placeholder {
    color: #999;
    font-style: italic;
}

.close-search {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--color-text-dark);
    opacity: 0.5;
    cursor: pointer;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-search:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
    transform: rotate(90deg);
}

.search-results {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    -webkit-overflow-scrolling: touch;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    border: 1px solid transparent;
}

.search-result-item:hover {
    background: var(--color-bg-pink-light);
    border-color: var(--color-secondary-pink);
    transform: translateX(5px);
}

.search-result-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-right: 15px;
    background: var(--color-bg-pink-light);
}

.search-result-info {
    flex: 1;
}

.search-result-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: var(--color-primary-green);
    margin-bottom: 5px;
}

.search-result-category {
    font-size: 0.85rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.search-result-price {
    font-weight: 600;
    color: var(--color-text-dark);
    font-size: 1rem;
}

.search-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-style: italic;
}

/* ============================================
   CART BADGE STYLES
   ============================================ */

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #E8B7B7, #F2D4D4);
    color: var(--color-primary-green);
    font-size: 0.7rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(232, 183, 183, 0.5);
    animation: pulse 2s infinite;
}

.cart-badge.hidden {
    display: none;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* ============================================
   CART SIDEBAR STYLES
   ============================================ */

.cart-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 45, 35, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    animation: fadeInModal 0.3s ease;
}

.cart-overlay.active {
    display: block;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    /* Use percentage to ensure it's always fully off-screen regardless of device width */
    width: 100%;
    max-width: 450px;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for mobile browsers */
    background: var(--color-bg-surface);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.2);
    z-index: 2500;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

.cart-sidebar.active {
    right: 0;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    border-bottom: 2px solid var(--color-bg-pink-light);
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
}

.cart-header h3 {
    font-size: 1.8rem;
    color: var(--color-primary-green);
    margin: 0;
}

.close-cart {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--color-text-dark);
    opacity: 0.5;
    cursor: pointer;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-cart:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
    transform: rotate(90deg);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #fff;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
    animation: slideInRight 0.4s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(30px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.cart-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.cart-item-image {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-right: 15px;
    background: var(--color-bg-pink-light);
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    color: var(--color-primary-green);
    margin-bottom: 5px;
    line-height: 1.3;
}

.cart-item-price {
    font-weight: 600;
    color: var(--color-text-dark);
    font-size: 0.95rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.quantity-btn {
    background: var(--color-bg-pink-light);
    border: 1px solid var(--color-secondary-pink);
    color: var(--color-primary-green);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.quantity-btn:hover {
    background: var(--color-secondary-pink);
    transform: scale(1.1);
}

.quantity-display {
    font-weight: 600;
    min-width: 30px;
    text-align: center;
    color: var(--color-text-dark);
}

.remove-item-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
    transition: color 0.3s;
    margin-left: auto;
}

.remove-item-btn:hover {
    color: #d32f2f;
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.cart-empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.cart-footer {
    padding: 25px;
    border-top: 2px solid var(--color-bg-pink-light);
    background: linear-gradient(135deg, #fafafa 0%, #ffffff 100%);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-primary-green);
}

#cart-total-amount {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
}

.checkout-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--color-primary-green) 0%, var(--color-primary-light) 100%);
    color: white;
    border: none;
    padding: 18px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    border-radius: var(--radius-pill);
    box-shadow: 0 8px 20px rgba(47, 69, 56, 0.25);
    transition: all 0.3s ease;
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(47, 69, 56, 0.35);
}

.checkout-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--color-primary-green);
    color: white;
    padding: 15px 25px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 5000;
    animation: slideInUp 0.4s ease, slideOutDown 0.4s ease 2.6s forwards;
    font-weight: 600;
}

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(100px);
        opacity: 0;
    }
}

/* ============================================
   MOBILE RESPONSIVENESS FOR CART & SEARCH
   ============================================ */

@media (max-width: 900px) {
    .search-modal {
        padding: 80px 15px 15px;
    }

    .search-modal-content {
        width: 92%;
    }

    .search-header {
        padding: 20px;
    }

    #search-input {
        font-size: 1.1rem;
    }

    .search-result-item {
        padding: 12px;
    }

    .search-result-image {
        width: 55px;
        height: 55px;
    }

    .cart-sidebar {
        max-width: 400px;
    }

    .cart-item {
        padding: 12px;
    }

    .cart-item-image {
        width: 65px;
        height: 65px;
    }

    .cart-item-title {
        font-size: 0.95rem;
    }

    .cart-footer {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .cart-sidebar {
        max-width: 100%;
        width: 100%;
        right: -100%;
    }

    .search-modal {
        padding: 50px 10px 10px;
    }

    .search-modal-content {
        width: 95%;
    }

    .search-header {
        padding: 18px;
    }

    #search-input {
        font-size: 1rem;
        padding: 8px;
    }

    .close-search {
        width: 36px;
        height: 36px;
        font-size: 1.8rem;
    }

    .search-result-item {
        padding: 10px;
        margin-bottom: 8px;
    }

    .search-result-image {
        width: 50px;
        height: 50px;
        margin-right: 12px;
    }

    .search-result-title {
        font-size: 1rem;
    }

    .search-result-category {
        font-size: 0.75rem;
    }

    .search-result-price {
        font-size: 0.9rem;
    }

    .cart-header {
        padding: 18px 20px;
        min-height: 70px;
    }

    .cart-header h3 {
        font-size: 1.5rem;
        margin: 0;
    }

    .close-cart {
        width: 36px;
        height: 36px;
        font-size: 1.8rem;
    }

    .cart-items {
        padding: 15px;
        max-height: calc(100vh - 250px);
        max-height: calc(100dvh - 250px);
    }

    .cart-item {
        padding: 12px;
        margin-bottom: 12px;
    }

    .cart-item-image {
        width: 60px;
        height: 60px;
        margin-right: 12px;
    }

    .cart-item-title {
        font-size: 0.9rem;
    }

    .cart-item-price {
        font-size: 0.85rem;
    }

    .quantity-btn {
        width: 26px;
        height: 26px;
        font-size: 0.9rem;
    }

    .quantity-display {
        font-size: 0.9rem;
        min-width: 25px;
    }

    .remove-item-btn {
        font-size: 0.8rem;
    }

    .cart-footer {
        padding: 20px;
        min-height: 120px;
    }

    .cart-total {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }

    #cart-total-amount {
        font-size: 1.3rem;
    }

    .checkout-btn {
        padding: 16px;
        font-size: 0.95rem;
    }

    .toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
        text-align: center;
        font-size: 0.9rem;
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .search-modal {
        padding: 30px 10px 10px;
    }

    .search-modal-content {
        width: 98%;
        border-radius: var(--radius-md);
    }

    .search-header {
        padding: 15px;
    }

    #search-input {
        font-size: 0.95rem;
    }

    .close-search {
        width: 32px;
        height: 32px;
        font-size: 1.6rem;
    }

    .search-result-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }

    .search-result-image {
        width: 100%;
        height: 120px;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .search-result-price {
        margin-top: 8px;
        align-self: flex-end;
    }

    .cart-header {
        padding: 15px;
        min-height: 65px;
    }

    .cart-header h3 {
        font-size: 1.3rem;
    }

    .cart-items {
        padding: 12px;
        max-height: calc(100vh - 230px);
        max-height: calc(100dvh - 230px);
    }

    .cart-item {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 12px;
    }

    .cart-item-image {
        width: 80px;
        height: 80px;
        margin-right: 12px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .cart-item-details {
        flex: 1;
        min-width: 0;
    }

    .cart-item-controls {
        justify-content: flex-start;
        width: 100%;
        margin-top: 10px;
        flex-wrap: wrap;
    }

    .remove-item-btn {
        margin-left: auto;
        margin-top: 0;
    }

    .cart-total {
        font-size: 1.1rem;
    }

    #cart-total-amount {
        font-size: 1.2rem;
    }

    .checkout-btn {
        padding: 16px;
        font-size: 0.9rem;
        letter-spacing: 1.5px;
        min-height: 50px;
    }

    .cart-footer {
        padding: 15px;
        min-height: 110px;
    }
}