/* Add these CSS variables at the very top of the file */
:root {
    /* Light mode colors */
    --background-color: #f0f2f5;
    --card-background: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --border-color: rgba(0, 0, 0, 0.1);
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --highlight-background: #fff1f0;
    --accent-color: #E02F26;
}

/* Dark mode colors using system preference */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #000000;
        --card-background: #1c1c1e;
        --text-primary: #ffffff;
        --text-secondary: rgba(255, 255, 255, 0.8);
        --text-tertiary: rgba(255, 255, 255, 0.6);
        --border-color: rgba(255, 255, 255, 0.05);
        --modal-overlay: rgba(0, 0, 0, 0.6);
        --shadow-color: rgba(0, 0, 0, 0.3);
        --highlight-background: rgba(224, 47, 38, 0.15);
        --accent-color: #ff453a;
    }
}

/* Update the font-family to use system fonts */
/* Add these rules at the beginning of the file */
html, body {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    overscroll-behavior-y: none;
}

/* Add this new class near the top of the file, after the html, body styles */
.no-select {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Add this rule to allow text selection for specific elements if needed */
.allow-select {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-primary);
    padding-top: 0;
}

header {
    background-color: var(--background-color);
    color: var(--text-primary);
    padding: 0 12px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: none;
}

#header-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0.5rem 0 0;
}

h1 {
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    cursor: default;
    min-width: 84px;
}

#search-container {
    flex: 1;
    min-width: 0;
    max-width: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--card-background);
    border-radius: 16px;
    overflow: hidden;
    height: 32px;
    position: relative;
    box-shadow: 0 2px 4px var(--shadow-color);
    margin: 4px 0;
    padding: 0 4px;
}

#search-icon {
    width: 16px;
    height: 16px;
    color: #999;
    position: absolute;
    left: 50%;
    transform: translateX(-80px);
    pointer-events: none;
    opacity: 1;
    transition: all 0.3s ease;
}

#search-input {
    width: 100%;
    padding: 4px 8px;
    border: none;
    font-size: 16px;
    outline: none;
    background-color: transparent;
    -webkit-text-size-adjust: 100%;
    text-align: center;
    color: var(--text-primary);
}

#search-input::placeholder {
    text-align: center;
    color: var(--text-tertiary);
    transform: translateX(8px);
}

/* Hide icon and adjust text alignment when typing */
#search-input:not(:placeholder-shown) {
    text-align: left;
    padding-left: 8px;
}

#search-input:not(:placeholder-shown) + #search-icon {
    opacity: 0;
}

main {
    flex-grow: 1;
    max-width: calc(100% - 100px);
    padding: 0;
    overflow-y: scroll;
    height: 100%;
    -webkit-overflow-scrolling: touch;
}

#product-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    padding-bottom: 120px;
}

.product-card {
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 4px 6px var(--shadow-color);
    display: flex;
    align-items: stretch;
    transition: transform 0.3s ease;
    margin-bottom: 0.5rem;
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-3px);
}

.product-card img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    min-width: 0;
}

.product-card h3 {
    font-size: 1rem;
    line-height: 1.3;
    cursor: text;
    color: var(--text-primary);
}

.price-add-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    gap: 8px;
}

.product-card p {
    color: #E02F26;
    font-weight: bold;
    margin-right: 8px;
}

.add-to-cart {
    background-color: #E02F26;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    white-space: nowrap;
    min-width: 88px;
    flex-shrink: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'Arial', sans-serif;
    letter-spacing: -0.2px;
}

.add-to-cart:hover {
    background-color: #ff4d4f;
}

.add-to-cart i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.add-to-cart .fa-circle {
    font-size: 28px;
}

.add-to-cart .fa-plus {
    font-size: 14px;
    color: white;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transition: background-color 0.3s ease-out;
}

.modal-content {
    background-color: var(--background-color);
    position: absolute;
    bottom: 0;
    width: 100%;
    max-height: 80vh;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    overflow-y: auto;
    padding: 1rem;
    will-change: transform;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

#close-cart {
    background-color: transparent;
    color: #333;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: bold;
}

#checkout-btn, #share-cart-btn {
    width: 100%;
    margin-top: 1rem;
}

.cart-buttons {
    display: flex;
    height: 50px;
    margin-top: 1rem;
}

.cart-buttons button {
    flex: 1;
}

#floating-cart {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    z-index: 1000;
    opacity: 0;
    transform: translateY(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
}

#floating-cart.show {
    opacity: 1;
    transform: translateY(0);
}

#floating-cart i {
    font-size: 20px;
}

#cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #E02F26;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 11px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    min-width: unset;
    line-height: 1;
    font-weight: 400;
}

.main-container {
    display: flex;
    max-width: 1200px;
    margin: 32px auto 0;
    padding: 1rem 0.5rem 1rem 0;
    gap: 0.5rem;
    height: calc(100vh - 32px);
    overflow-x: hidden;
    overflow-y: hidden;
    position: fixed;
    left: 0;
    right: 0;
    background-color: transparent;
}

#category-nav {
    width: 100px;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: sticky;
    top: 32px;
    align-self: flex-start;
    margin-left: -0.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100vh - 32px);
}

.category-btn {
    padding: 12px 0;
    margin: 0;
    border: none;
    background-color: transparent;
    color: var(--text-primary);
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    width: calc(100% + 0.5rem);
}

.category-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background-color: #E02F26;
    transition: height 0.3s ease;
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
}

.category-btn:hover,
.category-btn.active {
    background-color: var(--card-background);
    color: var(--accent-color);
    font-weight: 500;
}

.category-btn:hover::before,
.category-btn.active::before {
    height: 70%;
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: row;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    #category-nav {
        width: 80px;
        flex-direction: column;
        overflow-y: auto;
        margin-bottom: 0;
        padding-bottom: 0;
        position: sticky;
        top: 60px;
        max-height: calc(100vh - 60px);
    }

    .category-btn {
        padding: 10px 0;
        font-size: 1rem;
        text-align: center;
    }

    .category-btn::before {
        left: -1px;
    }

    main {
        flex-grow: 1;
        max-width: calc(100% - 90px);
        padding: 0;
    }

    .product-card {
        margin: 0 0 0.5rem 0;
        border-radius: 8px;
    }

    .product-card img {
        width: 100px;
        height: 100px;
        border-top-left-radius: 8px;
        border-bottom-left-radius: 8px;
    }

    .product-info {
        padding: 0.2rem 0.25rem;
    }

    .product-card h3 {
        font-size: 0.9rem;
    }

    .price-add-container {
        margin-top: 0.3rem;
    }

    .add-to-cart {
        width: 24px;
        height: 24px;
    }

    .add-to-cart .fa-circle {
        font-size: 24px;
    }

    .add-to-cart .fa-plus {
        font-size: 12px;
    }
}

#clear-search {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 32px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    padding: 0;
}

#clear-search:hover {
    color: #666;
}

#clear-search.hidden {
    display: none;
}

#share-cart-btn {
    width: 61.8%;
    border: none;
    background-color: #E02F26;
    cursor: pointer;
    padding: 0 16px;
    margin: 0;
    order: 1;
}

#share-cart-btn:hover {
    background-color: #ff4d4f;
}

.share-icon {
    color: white;
}

/* Update cart buttons container */
.cart-buttons {
    display: flex;
    height: 50px;
    margin-top: 1rem;
}

/* Style for add temp item button (left side) */
#add-temp-item {
    width: 38.2%;
    border: none;
    background-color: white;
    color: #999;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    font-size: 1.1rem;
}

#add-temp-item:hover {
    background-color: #f5f5f5;
}

/* Style for share cart button (right side) */
#share-cart-btn {
    width: 100%;
    border: none;
    background-color: var(--card-background);
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0;
    margin: 0;
    order: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Share content styles */
.share-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
}

.share-icon-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.share-icon {
    color: #666;
    width: 24px;
    height: 24px;
}

.share-total {
    color: var(--accent-color);
    font-size: 1rem;
    margin: 0;
    font-weight: bold;
}

.share-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #E02F26;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2px 6px;
    line-height: 1;
    font-weight: 400;
}

.cart-item {
    margin-bottom: 0.5rem;
}

.cart-item img {
    width: 80px;
    height: 80px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    min-width: 88px;
    flex-shrink: 0;
}

.quantity-btn {
    background-color: var(--card-background);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quantity-btn:hover {
    background-color: var(--highlight-background);
}

.quantity {
    min-width: 32px;
    text-align: center;
    font-size: 16px;
    color: var(--text-primary);
}

.cart-item .remove-item {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background-color: rgba(224, 47, 38, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.cart-item .remove-item:hover {
    background-color: rgba(224, 47, 38, 1);
}

.modal-content {
    padding: 1rem;
}

#cart-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem;
    max-height: calc(80vh - 120px);
    overflow-y: auto;
    padding: 0.5rem;
    margin-bottom: 50px;
    padding-bottom: 0;
}

#cart-total {
    margin-top: 1rem;
    font-weight: bold;
    text-align: right;
}

.product-card a {
    display: block;
    width: 120px;
    height: 120px;
}

@media (max-width: 768px) {
    .product-card a {
        width: 100px;
        height: 100px;
    }
}

.cart-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f0f0f0;
}

#cart-item-count {
    font-weight: bold;
}

#cart-total {
    font-weight: bold;
}

.share-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
}

#copy-link-btn,
#save-image-btn {
    flex: 1;
    margin: 0 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#copy-link-btn {
    background-color: #52c41a;
    color: white;
}

#copy-link-btn:hover {
    background-color: #73d13d;
}

#save-image-btn {
    background-color: #E02F26;
    color: white;
}

#save-image-btn:hover {
    background-color: #ff4d4f;
}

#temp-item-form input {
    border: none;
    background-color: transparent;
    font-size: 1rem;
    width: 100%;
    padding: 0.5rem 0;
}

#temp-item-form input:focus {
    outline: none;
}

#temp-item-form .product-info {
    width: 100%;
}

#temp-item-form .price-quantity-container {
    justify-content: space-between;
}

#temp-item-form #temp-item-price {
    width: auto;
    flex-grow: 1;
    margin-right: 1rem;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background-color: #e0e0e0;
    border-radius: 2px;
    z-index: 1;
}

.modal-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    cursor: grab;
}

.modal-content.dragging::after {
    cursor: grabbing;
}

#cart-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem;
    max-height: calc(80vh - 120px);
    overflow-y: auto;
    padding: 0.5rem;
    margin-bottom: 50px;
    padding-bottom: 0;
}

.cart-item.product-card {
    margin-bottom: 0;
    height: 100px;
}

.cart-item.product-card img {
    width: 100px;
    height: 100px;
    object-fit: cover;
}

@media (max-width: 768px) {
    #cart-items {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 0.4rem;
        padding: 0.4rem;
    }

    .cart-item.product-card {
        height: 80px;
    }

    .cart-item.product-card img {
        width: 80px;
        height: 80px;
    }
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    position: relative;
    width: 100%;
}

.qr-toggle {
    margin-bottom: 0;
    text-align: center;
    width: 100%;
    padding: 1rem;
    background-color: #fff;
}

.toggle-btn {
    width: 100%;
    background-color: #1890ff;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.qr-code {
    width: 100vw;
    height: auto;
    display: none;
    transition: opacity 0.3s ease;
    margin: 0;
}

.qr-code.active {
    display: block;
}

#close-qr-modal {
    background-color: transparent;
    color: #333;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

#qr-modal .modal-content {
    padding: 0;
}

#qr-modal .modal-header {
    padding: 1rem;
    background-color: #fff;
    margin-bottom: 0;
}

.payment-methods {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
    background-color: #fff;
}

.payment-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #666;
}

.payment-icon i {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
}

.payment-icon span {
    font-size: 0.9rem;
}

.fa-weixin {
    color: #07C160;
}

.fa-alipay {
    color: #1677FF;
}

.qr-container {
    margin-top: 0.5rem;
}

.feedback-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    height: calc(100% - 60px);
    overflow: hidden;
}

.feedback-input-container {
    background: var(--card-background);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

#feedback-input {
    width: 100%;
    min-height: 100px;
    border: none;
    resize: none;
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 0.5rem;
    background: var(--card-background);
    color: var(--text-primary);
}

#feedback-input:focus {
    outline: none;
}

.feedback-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#char-count {
    color: #999;
    font-size: 0.9rem;
}

#submit-feedback {
    background-color: #E02F26;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#submit-feedback:hover {
    background-color: #ff4d4f;
}

.feedback-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    flex-grow: 1;
    -webkit-overflow-scrolling: touch;
}

.feedback-item {
    background: var(--card-background);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.feedback-time {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.feedback-message {
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1890ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 1rem auto;
}

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

@media (max-width: 768px) {
    h1 {
        font-size: 1.1rem;
        min-width: 72px;
    }

    #search-container {
        max-width: none;
    }

    .feedback-btn {
        padding: 0.4rem;
    }
}

main {
    flex-grow: 1;
    max-width: calc(100% - 100px);
    padding: 0;
    overflow-y: scroll;
    height: 100%;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    main {
        max-width: calc(100% - 80px);
        padding: 0;
        overflow-y: scroll;
    }
}

#product-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    padding-bottom: 120px;
}

@media (max-width: 768px) {
    #floating-cart {
        /* Remove width: 80px; */
    }
}

/* Add styles for the cart section */
.cart-section {
    width: 38.2%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    position: relative;
    cursor: pointer;
    background-color: var(--card-background);
    color: var(--text-tertiary);
    padding: 0;
    pointer-events: auto;
}

.cart-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
}

.cart-icon-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0;
}

#floating-cart-total {
    color: var(--accent-color);
    font-size: 1rem;
    margin: 0;
    font-weight: bold;
}

/* Add styles for the checkout section */
.checkout-section {
    width: 61.8%;
    display: flex;
    background-color: #E02F26;
    pointer-events: auto;
}

/* Style the checkout button */
#checkout-btn {
    width: 100%;
    border: none;
    background: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
}

/* Update hover states */
.checkout-section:hover {
    background-color: #ff4d4f;
}

.cart-section:hover {
    background-color: var(--card-background);
}

/* Style for the cart icon */
.cart-icon {
    width: 24px;
    height: 24px;
    color: var(--text-tertiary);
    position: relative;
}

.cart-icon-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cart-icon {
    width: 24px;
    height: 24px;
    color: var(--text-tertiary);
}

#cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #E02F26;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    min-width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.share-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
    padding-right: 0;
}

.share-icon-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.share-icon {
    color: #666;
    width: 24px;
    height: 24px;
}

.share-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #E02F26;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    min-width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.share-total {
    color: #E02F26;
    font-size: 1rem;
    margin: 0;
    font-weight: bold;
}

/* Update cart buttons container */
.cart-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    display: flex;
    margin: 0;
}

/* Share button container */
.share-btn-container {
    width: 38.2%;
    background-color: var(--card-background);
    color: var(--text-tertiary);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

#share-cart-btn {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
}

/* Add temporary item button */
#add-temp-item {
    width: 61.8%;
    border: none;
    background-color: #E02F26;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    font-size: 1.1rem;
}

/* Share content styles */
.share-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
    gap: 0;
}

/* Hover states */
.share-btn-container:hover {
    background-color: var(--card-background);
}

#add-temp-item:hover {
    background-color: #ff4d4f;
}

/* Update modal content to account for fixed buttons */
.modal-content {
    padding: 1rem 1rem 0 1rem;
}

/* Add this near the end of the file */
.parabolic-ball {
    position: fixed;
    width: 20px;
    height: 20px;
    background-color: #f5222d;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform-origin: center center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Add styles for quantity controls */
.quantity-controls-main {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    min-width: 88px;
    flex-shrink: 0;
}

.quantity-btn-main {
    background-color: var(--card-background);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quantity-btn-main:hover {
    background-color: var(--highlight-background);
}

.quantity-main {
    min-width: 32px;
    text-align: center;
    font-size: 16px;
    color: var(--text-primary);
}

/* Remove any old circular styles if they exist */
.quantity-btn.minus,
.quantity-btn.plus {
    border-radius: 4px;
}

/* Update price font styles */
.product-card p,
#floating-cart-total,
.share-total,
.cart-item .price-add-container p {
    color: #E02F26;
    font-weight: bold;
    margin-right: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'Arial', sans-serif;
    /* Optional: slightly adjust letter spacing for better readability */
    letter-spacing: -0.2px;
}

/* Make sure the currency symbol (¥) is slightly smaller */
.product-card p::first-letter,
#floating-cart-total::first-letter,
.share-total::first-letter,
.cart-item .price-add-container p::first-letter {
    font-size: 0.9em;
}

/* Update font styles for product names and quantity controls */
.product-card h3,
.cart-item h3,
.quantity-controls .quantity,
.quantity-controls-main .quantity-main,
.quantity-btn,
.quantity-btn-main {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'Arial', sans-serif;
    letter-spacing: -0.2px;
}

/* Update quantity display styles */
.quantity,
.quantity-main {
    min-width: 32px;
    text-align: center;
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;  /* Add medium weight for numbers */
}

/* Update quantity button styles */
.quantity-btn,
.quantity-btn-main {
    font-weight: 500;  /* Add medium weight for +/- symbols */
}

/* Update product name styles */
.product-card h3,
.cart-item h3 {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'Arial', sans-serif;
    letter-spacing: -0.2px;
    font-size: 14px;  /* Match add-to-cart button font size */
    line-height: 1.4;  /* Adjust line height for better readability */
    font-weight: normal;
    -webkit-font-feature-settings: "tnum";
    font-feature-settings: "tnum";
    margin-bottom: 4px;  /* Add some space between name and price */
}

/* Ensure numbers in product names use the same style */
.product-card h3 span,
.cart-item h3 span,
.product-card h3 strong,
.cart-item h3 strong {
    font-weight: inherit;  /* Inherit font weight from parent */
    font-size: inherit;    /* Inherit font size from parent */
}

/* Update share button container */
.share-btn-container {
    width: 38.2%;
    background-color: var(--card-background);
    color: var(--text-tertiary);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

/* Update share cart button styles */
#share-cart-btn {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
}

/* Update share icon color */
.share-icon {
    color: #999;  /* Change from white to gray */
}

/* Update share count styles */
.share-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #E02F26;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    min-width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Remove any hover effects */
#share-cart-btn:hover,
.share-btn-container:hover {
    background-color: var(--card-background);
}

/* Add these styles for the toast notification */
.toast {
    position: fixed;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease-out;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Update clear search icon styles */
.clear-search-icon path {
    stroke: var(--card-background);  /* Change from white to match input background */
    stroke-width: 2;
    stroke-linecap: round;
}

.clear-search-icon circle {
    fill: var(--text-tertiary);  /* Use tertiary text color for the circle */
}

/* Add these styles for the iOS-style clear icon */
.clear-search-icon {
    width: 16px;
    height: 16px;
    color: #999;
    transition: color 0.3s ease;
}

#clear-search {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 32px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#clear-search:hover .clear-search-icon {
    color: #666;
}

/* Update feedback modal styles */
.feedback-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    height: calc(100% - 60px);
    overflow: hidden;
}

.feedback-input-container {
    background: var(--card-background);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

#feedback-input {
    width: 100%;
    min-height: 100px;
    border: none;
    resize: none;
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 0.5rem;
    background: var(--card-background);
    color: var(--text-primary);
}

#feedback-input:focus {
    outline: none;
}

.feedback-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    flex-grow: 1;
    -webkit-overflow-scrolling: touch;
}

/* Update feedback modal content styles */
#feedback-modal .modal-content {
    display: flex;
    flex-direction: column;
    height: 80vh;
    max-height: 80vh;
    padding: 0;
}

#feedback-modal .modal-header {
    padding: 1rem;
    margin: 0;
    flex-shrink: 0;
    background-color: var(--background-color);
    position: relative;
    z-index: 1;
}

/* Add these styles for the menu */
.menu-container {
    position: relative;
    margin-left: 8px;
}

.menu-btn {
    background: none;
    border: none;
    color: #666;
    padding: 8px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.menu-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Update SVG styles - remove rotation, increase size */
.menu-btn svg {
    width: 28px;  /* Increased from 24px */
    height: 28px;
}

/* Update media query for mobile */
@media (max-width: 768px) {
    .menu-btn {
        padding: 6px;
        width: 32px;
        height: 32px;
    }
    
    .menu-btn svg {
        width: 24px;  /* Increased from 20px */
        height: 24px;
    }
}

.menu-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: none;
    z-index: 1001;
    padding: 4px 0;
}

.menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    color: var(--text-primary);
}

.menu-item:hover {
    background-color: var(--highlight-background);
}

.menu-item:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.menu-item i, .menu-item svg {
    color: var(--text-secondary);
}

.menu-item span {
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Update header styles to accommodate the menu */
#header-content {
    padding-right: 4px;
}

/* Add media queries for mobile */
@media (max-width: 768px) {
    .menu-btn {
        padding: 6px;
        width: 32px;
        height: 32px;
    }

    .menu-dropdown {
        right: 4px;
    }
}

/* Update menu item styles to accommodate SVG */
.menu-item svg {
    color: #666;
    width: 20px;
    height: 20px;
}

/* Add these styles for the member modal */
.member-container {
    padding: 1rem;
}

.member-input-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#member-phone {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

#search-member {
    background-color: #E02F26;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#search-member:hover {
    background-color: #ff4d4f;
}

.member-result {
    min-height: 60px;
}

.member-info {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    padding: 1rem;
    border-radius: 4px;
}

.member-balance {
    color: #52c41a;
    font-size: 1.2rem;
    font-weight: bold;
}

.error-message {
    color: #ff4d4f;
    padding: 0.5rem;
    background: #fff2f0;
    border: 1px solid #ffccc7;
    border-radius: 4px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #E02F26;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 1rem auto;
}

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

/* Update member info styles */
.member-info {
    padding: 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
}

.member-info.success {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
}

.member-info.warning {
    background: #fffbe6;
    border: 1px solid #ffe58f;
}

.member-balance {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.payment-info {
    font-size: 0.9rem;
    color: #666;
}

.payment-info > div {
    margin: 0.25rem 0;
}

.sufficient-funds {
    color: #52c41a;
    font-weight: bold;
    margin-top: 0.5rem !important;
}

.insufficient-funds {
    color: #faad14;
    font-weight: bold;
    margin-top: 0.5rem !important;
}

.auth-container {
    padding: 1rem;
}

#auth-form,
#profile-auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#auth-form input,
#profile-auth-form input,
.auth-buttons button {
    border-radius: 8px;  /* Match the input box radius */
}

#auth-form input,
#profile-auth-form input {
    padding: 0.75rem;
    border: none;
    font-size: 1rem;
    background-color: var(--card-background);
    color: var(--text-primary);
    width: 100%;
}

#profile-auth-form input::placeholder {
    color: var(--text-tertiary);
}

#profile-auth-form input:focus {
    outline: none;
}

.auth-buttons {
    display: flex;
    gap: 1rem;
}

.auth-buttons button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

/* Style both signin buttons */
#signin-btn,
#profile-signin-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
}

#signin-btn:hover,
#profile-signin-btn:hover {
    background-color: #ff4d4f;
}

/* Style both signup buttons */
#signup-btn,
#profile-signup-btn {
    background-color: var(--card-background);
    border: none;
    color: var(--accent-color);
}

#signup-btn:hover,
#profile-signup-btn:hover {
    background-color: var(--card-background);
}

/* Add disabled state styles */
.auth-buttons button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Add these styles for the profile modal */
.profile-container {
    padding: 1rem;
}

.profile-info {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.profile-info p {
    margin: 0.5rem 0;
    color: #333;
}

.profile-info strong {
    color: #666;
    display: inline-block;
    width: 80px;
}

/* Add styles for the logout button */
.logout-btn {
    width: 100%;
    background-color: #E02F26;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 1rem;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background-color: #ff4d4f;
}

/* Update profile container styles */
.profile-container {
    padding: 1rem;
}

.profile-info {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.profile-info p {
    margin: 0.5rem 0;
    color: #333;
}

.profile-info strong {
    color: #666;
    display: inline-block;
    width: 80px;
}

/* Add styles for the button spinner */
.button-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

/* Update the auth buttons to handle spinner */
.auth-buttons button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px; /* Prevent button size change when spinner appears */
}

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

/* Add these styles for the profile card */
.profile-container {
    padding: 1rem;
}

.profile-container .product-card {
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.profile-container .product-card img {
    object-fit: contain;
    background-color: #fff;
    padding: 12px;
    width: 120px;
    height: 120px;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.profile-container .product-name {
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    word-break: break-all;
}

.profile-container #logout-btn {
    background-color: #E02F26;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 14px;
    height: 32px;
    white-space: nowrap;
    min-width: 88px;
}

.profile-container #logout-btn:hover {
    background-color: #ff4d4f;
}

/* Update modal content for profile */
.profile-container .modal-content {
    padding: 1rem;
    background-color: var(--background-color);
}

/* Add hover effect for the profile card */
.profile-container .product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .profile-container .product-card img {
        width: 100px;
        height: 100px;
        padding: 10px;
    }
}

/* Add these styles for the scanner modal */
.scanner-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 120px);
    overflow: hidden;
    background-color: #000;
}

#scanner-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.scanner-line {
    width: 80%;
    height: 2px;
    background-color: #E02F26;
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% {
        transform: translateY(-100px);
    }
    50% {
        transform: translateY(100px);
    }
    100% {
        transform: translateY(-100px);
    }
}

.scanner-buttons {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.scanner-buttons button {
    width: 50px;
    height: 50px;
    border-radius: 25px;
    border: none;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.scanner-buttons button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.scanner-buttons button.active {
    background-color: #E02F26;
}

/* Add this unified bottom button layout */
.bottom-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    display: flex;
    margin: 0;
}

.bottom-button-left {
    width: 38.2%;
    background-color: var(--card-background);
    color: var(--text-tertiary);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0;
    pointer-events: auto;
}

.bottom-button-right {
    width: 61.8%;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.bottom-button-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
}

/* Update existing elements to use the same styles */
#floating-cart,
.cart-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    display: flex;
    margin: 0;
}

.cart-section,
.share-btn-container {
    width: 38.2%;
    background-color: var(--card-background);
    color: var(--text-tertiary);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0;
}

.checkout-section,
#add-temp-item {
    width: 61.8%;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.cart-content,
.share-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
}

/* Add this to handle status bar color transition */
@media (prefers-color-scheme: light) {
    :root {
        --status-bar-color: #f0f2f5;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --status-bar-color: #000000;
    }
}

/* Add this to ensure the status bar color matches the theme */
@media screen and (display-mode: standalone) {
    header {
        background-color: var(--status-bar-color);
    }
}

/* Add styles for profile header and menu */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.profile-menu {
    position: relative;
}

.profile-menu-btn {
    background: none;
    border: none;
    padding: 4px;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-menu-btn:hover {
    background-color: var(--highlight-background);
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.profile-menu.active .profile-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.profile-dropdown-item:hover {
    background-color: var(--highlight-background);
}

/* Style for refresh button */
.refresh-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 14px;
    height: 32px;
    min-width: 88px;
    justify-content: center;
}

.refresh-btn:hover {
    background-color: #ff4d4f;
}

.refresh-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Remove the SVG-specific styles since we're not using them anymore */
.refresh-btn svg {
    display: none;
}

/* Add styles for the recharge button */
.recharge-btn {
    width: 100%;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    margin-top: 12px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.recharge-btn:hover {
    background-color: #ff4d4f;
}

/* Update temp item form styles */
#temp-item-form {
    margin: 0;
}

#temp-item-form input {
    border: none;
    background-color: transparent;
    font-size: 1rem;
    width: 100%;
    padding: 0.5rem 0;
    color: var(--text-primary);
}

#temp-item-form input:focus {
    outline: none;
}

#temp-item-form .product-info {
    width: 100%;
}

#temp-item-form .price-quantity-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

#temp-item-form #temp-item-price {
    width: auto;
    flex-grow: 1;
    margin-right: 1rem;
}

#temp-item-form #add-temp-item-btn {
    min-width: 88px;
}

/* Remove the old temp item form styles if they exist */
#temp-item-form.standalone {
    display: none;
}

/* Orders in profile styles */
.orders-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    height: calc(100% - 120px);
    overflow: hidden;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
    flex-grow: 1;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 120px;
}

.order-item {
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    display: flex;
    align-items: stretch;
    transition: transform 0.3s ease;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    padding: 6px 8px;
}

.order-item:hover {
    transform: translateY(-3px);
}

.order-item:active {
    transform: scale(0.98);
}

.order-item .product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    min-width: 0;
    gap: 4px;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

.order-name {
    font-size: 0.9rem;
    line-height: 1.2;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    margin-right: 8px;
    font-weight: normal;
}

.order-amount {
    color: #E02F26;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.9rem;
}

.order-images {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.order-images::-webkit-scrollbar {
    display: none;
}

.order-images img {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    background-color: white;
}

/* Add hover effect for images */
.order-images img:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

/* Prevent click event on images from triggering order click */
.order-images img {
    pointer-events: none;
}

/* Add z-index to modals */
.modal {
    /* ... existing styles ... */
    z-index: 1000;  /* Base z-index for modals */
}

/* Make cart modal appear above other modals */
#cart-modal {
    z-index: 1100;  /* Higher z-index than base modals */
}

/* Make cart modal content appear above the backdrop */
#cart-modal .modal-content {
    z-index: 1101;  /* Higher than cart modal backdrop */
}

/* Ensure profile modal stays below cart modal */
#profile-modal {
    z-index: 1000;  /* Same as base modal z-index */
}

#profile-modal .modal-content {
    z-index: 1001;  /* Higher than profile modal backdrop */
}

/* Update the price font styles for floating cart total */
#floating-cart-total,
.share-total {
    color: var(--accent-color);
    font-weight: bold;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'Arial', sans-serif;
    letter-spacing: -0.2px;
    display: inline-flex;
    align-items: baseline;
}

/* Add these new rules to handle the price formatting */
#floating-cart-total::before,
.share-total::before {
    content: '￥';
    font-size: 0.85em;
    margin-right: 1px;
}

#floating-cart-total .whole-number,
.share-total .whole-number {
    font-size: 1.382em; /* Changed from 1.618 to 1.382 */
}

#floating-cart-total .decimal,
.share-total .decimal {
    font-size: 1em;
}

/* Add these styles */
.balance-container {
    display: inline-flex;  /* Change from flex to inline-flex */
    align-items: center;
    gap: 0;  /* Remove gap completely */
}

.info-btn {
    background: none;
    border: none;
    padding: 0 0 0 1px;  /* Only keep a tiny left padding */
    cursor: pointer;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.3s ease;
    margin-left: -4px;  /* Increase negative margin to bring it even closer */
    transform: translateY(1px);  /* Slightly adjust vertical alignment */
    position: relative; /* Add this for tooltip positioning */
}

.info-btn:hover {
    color: var(--text-secondary);
}

/* Update the SVG size to be slightly smaller */
.info-btn svg {
    width: 14px;  /* Reduce from 16px */
    height: 14px;  /* Reduce from 16px */
}

/* Update the info button and add tooltip styles */
.info-btn {
    background: none;
    border: none;
    padding: 0 0 0 1px;
    cursor: pointer;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.3s ease;
    margin-left: -4px;
    transform: translateY(1px);
    position: relative;
}

.tooltip {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--card-background);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    border: 1px solid var(--border-color);
    width: max-content;
    max-width: 200px;
}

/* Adjust arrow position */
.tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background-color: var(--card-background);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

/* Show tooltip on hover */
.info-btn:hover .tooltip {
    opacity: 1;
    visibility: visible;
}
