/* 自定义样式 */
body {
    position: relative;
    overflow-x: hidden;
}

/* Line聊天页面：当存在 .line-chat-page 时，禁用整个页面的纵向滚动，只让内部聊天区域滚动 */
body:has(.line-chat-page) {
    overflow-y: hidden;
}

/* Line用户管理：表格区域自适应视口高度，避免缩放时出现底部空白/滚动条异常 */
.line-users-admin-table {
    max-height: calc(100vh - 260px);
    min-height: 320px;
    overflow: auto;
}

/* 让长 userId / webId 不撑坏布局（配合 table-responsive 横向滚动） */
#lineUserTable {
    table-layout: fixed;
    min-width: 900px;
}

#lineUserTable th,
#lineUserTable td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sidebar Styles */
#wrapper {
    overflow-x: hidden;
}

#sidebar-wrapper {
    min-height: 100vh;
    margin-left: -15rem;
    transition: margin 0.25s ease-out;
}

#sidebar-wrapper .sidebar-heading {
    padding: 0.875rem 1.25rem;
    font-size: 1.2rem;
}

#sidebar-wrapper .list-group {
    width: 15rem;
}

#page-content-wrapper {
    min-width: 100vw;
}

.sidebar-expanded #sidebar-wrapper {
    margin-left: 0;
}

.sidebar-expanded #page-content-wrapper {
    margin-left: 15rem;
    transition: margin 0.25s ease-out;
}

/* Sidebar navigation active item */
.list-group-item.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* Card Styles */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid rgba(0, 0, 0, 0.125);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

/* Button Styles */
.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* Alert Styles */
.alert {
    border: none;
    border-radius: 0.375rem;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-error, .alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

.alert-info {
    background-color: #cff4fc;
    color: #055160;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
}

/* Table Styles */
.table th {
    border-top: none;
    font-weight: 600;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.075);
}

/* Badge Styles */
.badge {
    font-weight: 500;
}

/* Form Styles */
.form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Responsive Styles */
@media (min-width: 768px) {
    #sidebar-wrapper {
        margin-left: 0;
    }

    #page-content-wrapper {
        min-width: 0;
        width: 100%;
    }

    .sidebar-expanded #sidebar-wrapper {
        margin-left: -15rem;
    }

    .sidebar-expanded #page-content-wrapper {
        margin-left: 0;
    }
}

/* Dashboard Stats Cards */
.card.bg-primary {
    background-color: #0d6efd !important;
}

.card.bg-success {
    background-color: #198754 !important;
}

.card.bg-info {
    background-color: #0dcaf0 !important;
}

.card.bg-warning {
    background-color: #ffc107 !important;
}

.card.bg-danger {
    background-color: #dc3545 !important;
}

/* Opacity helper classes */
.opacity-50 {
    opacity: 0.5;
}

.opacity-75 {
    opacity: 0.75;
}

/* Product Card Styles */
.product-card {
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    overflow: hidden;
}

.product-card:hover {
    transform: scale(1.05);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.product-image {
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease-in-out;
}

.product-card:hover .product-image {
    transform: scale(1.1);
}

/* Product Image Edit Styles */
.image-gallery-container {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 10px 0;
    margin-bottom: 15px;
    scrollbar-width: thin;
    scrollbar-color: #0d6efd #f8f9fa;
}

.image-gallery-container::-webkit-scrollbar {
    height: 8px;
}

.image-gallery-container::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
}

.image-gallery-container::-webkit-scrollbar-thumb {
    background-color: #0d6efd;
    border-radius: 4px;
}

.image-gallery {
    display: inline-block;
}

.image-preview-container {
    position: relative;
    display: inline-block;
    margin-right: 15px;
}

.image-preview-container img {
    display: block;
    max-width: 100%;
}

.btn-delete-image {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.btn-delete-image:hover {
    opacity: 1;
}

.btn-delete-image i {
    font-size: 0.8rem;
}

/* Product List Delete Button */
.product-card .delete-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background-color: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.2s ease;
    z-index: 10;
    cursor: pointer;
}

.product-card .delete-button:hover {
    background-color: rgba(220, 53, 69, 1);
}

.product-card:hover .delete-button {
    opacity: 1;
}

.product-card .delete-button i {
    font-size: 0.8rem;
}

/* Position relative for dropdown positioning */
.mb-3 {
    position: relative;
}

/* Product Title Ellipsis */
.card-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Product Suggestions Dropdown */
.product-suggestions-dropdown {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
    display: none;
}

.product-suggestion-item {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.product-suggestion-item:hover {
    background-color: #f8f9fa;
}

.product-suggestion-item:last-child {
    border-bottom: none;
}

.product-suggestion-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    margin-right: 10px;
    border-radius: 0.25rem;
}

.product-suggestion-asin {
    font-weight: 500;
}