/**
 * HarmonyAuto Gebrauchtwagen - 布局和基础样式CSS
 * 黑灰白色调，现代高级感设计
 */

/* ============================
   Grid布局 - 默认4列
   ============================ */
.ha-gebrauchtwagen-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Elementor 响应式列数覆盖 */
.elementor-grid-columns-1 .ha-gebrauchtwagen-grid {
    grid-template-columns: repeat(1, 1fr);
}

.elementor-grid-columns-2 .ha-gebrauchtwagen-grid {
    grid-template-columns: repeat(2, 1fr);
}

.elementor-grid-columns-3 .ha-gebrauchtwagen-grid {
    grid-template-columns: repeat(3, 1fr);
}

.elementor-grid-columns-4 .ha-gebrauchtwagen-grid {
    grid-template-columns: repeat(4, 1fr);
}

/* ============================
   筛选表单
   ============================ */
.ha-gebrauchtwagen-filter {
    width: 100%;
    margin-bottom: 36px;
}

.ha-filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    padding: 24px 28px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
}

/* 顶部装饰线 - 黑灰渐变 */
.ha-filter-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #1a1a1a, #555555, #999999);
    border-radius: 10px 10px 0 0;
}

.ha-filter-field {
    display: flex;
    flex-direction: column;
    position: relative;
}

.ha-filter-field label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #333333;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ha-filter-field select,
.ha-filter-field input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 0.9rem;
    background-color: #ffffff;
    color: #1a1a1a;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: none;
    font-family: inherit;
    line-height: 1.5;
    box-sizing: border-box;
}

.ha-filter-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
    cursor: pointer;
}

.ha-filter-field input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
    padding-right: 14px;
}

.ha-filter-field input[type="number"]::-webkit-outer-spin-button,
.ha-filter-field input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ha-filter-field select:focus,
.ha-filter-field input:focus {
    outline: none;
    border-color: #333333;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
    background-color: #ffffff;
}

.ha-filter-field select:hover,
.ha-filter-field input:hover {
    border-color: #999999;
}

.ha-filter-field input::placeholder {
    color: #aaaaaa;
    font-style: italic;
}

/* 筛选操作按钮 */
.ha-filter-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.ha-filter-button {
    padding: 11px 22px;
    border: 1px solid;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.25s ease;
    min-width: 110px;
    position: relative;
    overflow: hidden;
    flex: 1;
    max-width: none;
    height: 46px;
    box-sizing: border-box;
    box-shadow: none;
}

/* 搜索按钮 - 黑色 */
.ha-filter-button.ha-filter-submit {
    background-color: #1a1a1a;
    border-color: #1a1a1a;
    color: #ffffff;
}

.ha-filter-button.ha-filter-submit:hover {
    background-color: #333333;
    border-color: #333333;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ha-filter-button.ha-filter-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* 重置按钮 - 灰白色 */
.ha-filter-button.ha-filter-reset {
    background-color: #ffffff;
    border-color: #cccccc;
    color: #666666;
}

.ha-filter-button.ha-filter-reset:hover {
    background-color: #f5f5f5;
    border-color: #999999;
    color: #333333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ha-filter-button.ha-filter-reset:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

/* ============================
   卡片布局和样式
   ============================ */
.ha-car-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    background: #ffffff;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.ha-car-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

/* 图片区域 */
.ha-car-image,
.ha-car-image-gallery {
    width: 100%;
    overflow: hidden;
    border-bottom: 1px solid #eeeeee;
    position: relative;
}

.ha-car-image-gallery {
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 比例 */
    background: #f0f0f0;
    position: relative;
    overflow: hidden;
    height: 0;
}

.ha-car-image-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.ha-car-image-item.active {
    opacity: 1;
    z-index: 1;
}

.ha-car-image-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.ha-car-card:hover .ha-car-image-item.active img {
    transform: scale(1.04);
}

/* 图片计数器 */
.ha-car-gallery-counter {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    z-index: 10;
    backdrop-filter: blur(4px);
    letter-spacing: 0.05em;
}

.ha-car-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.ha-car-card:hover .ha-car-image img {
    transform: scale(1.04);
}

/* 卡片内容区 */
.ha-car-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 14px 16px;
}

/* 车型标签 */
.ha-car-modell-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10;
    backdrop-filter: blur(4px);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* 标题 */
.ha-car-title {
    margin: 0 0 8px 0;
    font-size: 1.05rem;
    line-height: 1.3;
    font-weight: 700;
    color: #1a1a1a;
}

/* 价格 - 黑色醒目 */
.ha-car-price {
    font-weight: 800;
    font-size: 1.5rem;
    color: #111111;
    white-space: nowrap;
    line-height: 1.2;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

/* 技术参数列表 */
.ha-car-meta {
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
    flex: 1;
}

.ha-car-meta-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.8125rem;
}

.ha-car-meta-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ha-car-meta-label {
    font-weight: 500;
    color: #888888;
    font-size: 0.8125rem;
}

.ha-car-meta-value {
    font-weight: normal;
    color: #333333;
    font-size: 0.8125rem;
    text-align: right;
}

/* 关键信息加粗 */
.ha-car-meta-item.ha-car-meta-key .ha-car-meta-value {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.875rem;
}

.ha-car-meta-item.ha-car-meta-key .ha-car-meta-label {
    font-weight: 600;
    color: #555555;
}

/* 配置亮点 */
.ha-car-ausstattung {
    margin: 6px 0;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.ha-car-ausstattung-items {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    line-height: 1.4;
}

.ha-car-ausstattung-item {
    display: inline-block;
    font-size: 0.75rem;
    color: #666666;
    padding: 2px 0;
    position: relative;
    padding-left: 12px;
}

.ha-car-ausstattung-item::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #999999;
    font-weight: bold;
}

.ha-car-ausstattung-item.ha-car-ausstattung-more {
    color: #aaaaaa;
    font-style: italic;
    padding-left: 0;
}

.ha-car-ausstattung-item.ha-car-ausstattung-more::before {
    display: none;
}

/* 询价按钮 - 黑色 */
.ha-car-button {
    display: inline-block;
    text-align: center;
    text-decoration: none;
    margin-top: auto;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.25s ease;
    border: 1px solid #1a1a1a;
    background-color: #1a1a1a;
    color: #ffffff;
    letter-spacing: 0.03em;
}

.ha-car-button:hover {
    background-color: #333333;
    border-color: #333333;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================
   底部备注容器
   ============================ */
.ha-gebrauchtwagen-footer-note {
    margin-top: 36px;
    padding: 20px 24px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-left: 3px solid #333333;
    border-radius: 8px;
}

.ha-footer-note-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ha-footer-note-item {
    font-size: 0.75rem;
    line-height: 1.6;
    color: #777777;
    text-align: left;
    padding-left: 18px;
    position: relative;
    padding-top: 1px;
}

.ha-footer-note-item::before {
    content: '·';
    color: #999999;
    font-weight: bold;
    position: absolute;
    left: 4px;
    top: 1px;
    font-size: 1rem;
}

.ha-footer-note-item p {
    margin: 0;
    display: inline;
}

/* ============================
   加载状态
   ============================ */
.ha-loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.ha-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid #e0e0e0;
    border-top-color: #333333;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================
   短码包装器
   ============================ */
.ha-gebrauchtwagen-shortcode-wrapper {
    width: 100%;
}

/* ============================
   后台样式（不改动色调）
   ============================ */
.ha-gallery-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.ha-gallery-item {
    position: relative;
    width: 150px;
    height: 150px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.ha-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ha-gallery-item .ha-remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
}

.ha-ausstattung-checkboxes {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
}

/* ============================
   响应式 - 平板 (≤1024px)
   ============================ */
@media (max-width: 1024px) {
    .ha-gebrauchtwagen-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px;
    }

    .ha-filter-form {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 14px;
        padding: 20px 22px;
    }

    /* Elementor 平板覆盖 */
    .elementor-grid-columns-tablet-1 .ha-gebrauchtwagen-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }

    .elementor-grid-columns-tablet-2 .ha-gebrauchtwagen-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .elementor-grid-columns-tablet-3 .ha-gebrauchtwagen-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .elementor-grid-columns-tablet-4 .ha-gebrauchtwagen-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ============================
   响应式 - 手机 (≤767px)
   ============================ */
@media (max-width: 767px) {
    .ha-gebrauchtwagen-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }

    .ha-filter-form {
        grid-template-columns: 1fr;
        padding: 18px;
        gap: 14px;
    }

    .ha-filter-field label {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }

    .ha-filter-field select,
    .ha-filter-field input {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .ha-filter-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        gap: 10px;
        margin-top: 0;
        padding-top: 0;
    }

    .ha-filter-button {
        width: 100%;
        max-width: 100%;
        padding: 11px 18px;
        min-width: auto;
        flex: 1;
        height: auto;
    }

    .ha-car-content {
        padding: 10px 12px;
    }

    .ha-car-title {
        font-size: 0.95rem;
        margin-bottom: 6px;
    }

    .ha-car-price {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }

    .ha-gebrauchtwagen-footer-note {
        margin-top: 24px;
        padding: 16px 18px;
        border-left-width: 3px;
    }

    .ha-footer-note-list {
        gap: 6px;
    }

    .ha-footer-note-item {
        font-size: 0.7rem;
        line-height: 1.5;
        padding-left: 16px;
    }

    /* Elementor 手机覆盖 */
    .elementor-grid-columns-mobile-1 .ha-gebrauchtwagen-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }

    .elementor-grid-columns-mobile-2 .ha-gebrauchtwagen-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .elementor-grid-columns-mobile-3 .ha-gebrauchtwagen-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .elementor-grid-columns-mobile-4 .ha-gebrauchtwagen-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ============================
   响应式 - 小屏手机 (≤480px)
   ============================ */
@media (max-width: 480px) {
    .ha-filter-form {
        padding: 14px;
        border-radius: 8px;
    }

    .ha-filter-form::before {
        height: 2px;
    }
}

/* ============================
   分页控件
   ============================ */
.ha-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 32px;
    padding: 0;
    flex-wrap: wrap;
}

.ha-pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background-color: #ffffff;
    color: #555555;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.ha-pagination-btn:hover:not(.active):not(.ha-pagination-dots) {
    background-color: #f5f5f5;
    border-color: #999999;
    color: #1a1a1a;
}

.ha-pagination-btn.active {
    background-color: #1a1a1a;
    border-color: #1a1a1a;
    color: #ffffff;
    cursor: default;
    font-weight: 600;
}

.ha-pagination-btn.ha-pagination-dots {
    border: none;
    background: transparent;
    cursor: default;
    min-width: 24px;
    padding: 0 4px;
    color: #999999;
}

.ha-pagination-btn.ha-pagination-prev,
.ha-pagination-btn.ha-pagination-next {
    font-size: 1.25rem;
    font-weight: 300;
    padding: 0 10px;
}

/* ============================
   Lightbox 大图浏览
   ============================ */
.ha-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.ha-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ha-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    cursor: pointer;
}

.ha-lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1100px;
    height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.ha-lightbox-img-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.ha-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity 0.2s ease;
}

.ha-lightbox-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 1.75rem;
    font-weight: 300;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.ha-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.ha-lightbox-prev,
.ha-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #ffffff;
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.ha-lightbox-prev {
    left: -60px;
}

.ha-lightbox-next {
    right: -60px;
}

.ha-lightbox-prev:hover,
.ha-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.ha-lightbox-counter {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

body.ha-lightbox-open {
    overflow: hidden;
}

/* Lightbox 响应式 */
@media (max-width: 1024px) {
    .ha-lightbox-prev {
        left: 10px;
    }

    .ha-lightbox-next {
        right: 10px;
    }

    .ha-lightbox-content {
        width: 95%;
        height: 80vh;
    }
}

@media (max-width: 767px) {

    .ha-lightbox-prev,
    .ha-lightbox-next {
        width: 38px;
        height: 38px;
        font-size: 1.5rem;
    }

    .ha-lightbox-prev {
        left: 6px;
    }

    .ha-lightbox-next {
        right: 6px;
    }

    .ha-lightbox-close {
        top: -6px;
        right: -6px;
        width: 36px;
        height: 36px;
        font-size: 1.4rem;
    }

    .ha-lightbox-content {
        width: 98%;
        height: 75vh;
    }

    .ha-lightbox-img-wrapper {
        padding: 10px;
    }

    .ha-pagination {
        margin-top: 24px;
        gap: 4px;
    }

    .ha-pagination-btn {
        min-width: 36px;
        height: 36px;
        font-size: 0.8125rem;
        padding: 0 8px;
    }
}

/* ============================
   询价弹窗 Modal
   ============================ */
.ha-inquiry-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
}

.ha-inquiry-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
}

.ha-inquiry-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 1;
    max-height: 90vh;
    overflow-y: auto;
}

.ha-inquiry-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ha-inquiry-modal-close:hover {
    background: #e0e0e0;
    color: #000;
}

body.ha-modal-open {
    overflow: hidden;
}