/* Custom Cards Styling - 상단 두 카드용 */
.card-container {
    display: flex;
    flex-wrap: wrap; /* 화면 크기에 따라 카드가 다음 줄로 넘어가도록 허용 */
    gap: 30px; /* 카드 사이 간격 증가 */
    justify-content: center;
    margin: 50px auto 100px auto; /* 위/아래 여백, 가로 중앙 정렬 */
    padding: 0 20px; /* 작은 화면을 위한 좌우 여백 */
    max-width: 90vw; /* 큰 화면에서 카드가 너무 넓어지지 않도록 최대 너비 설정 */
    box-sizing: border-box; /* 패딩이 요소의 전체 너비와 높이에 포함되도록 설정 */
}

.custom-card {
    border: 1px solid #e0e0e0;
    border-radius: 12px; /* 모서리를 좀 더 둥글게 */
    overflow: hidden;
    flex: 1; /* 카드가 유연하게 크기를 조절하도록 허용 (min-width와 함께 사용) */
    min-width: 320px; /* 변경: 300px -> 320px (가로 최소 너비 증가) */
    max-width: 400px; /* 변경: 450px -> 500px (가로 최대 너비 증가) */
    background: #fdfdfd;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    cursor: pointer;
    /* transition: transform 0.3s ease, box-shadow 0.3s ease; 기존 트랜지션 */
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.8s ease-out, transform 0.8s ease-out; /* Fade-in을 위한 트랜지션 추가 */
    display: flex;
    flex-direction: column;

    /* Fade-in 애니메이션 초기 상태 */
    opacity: 0;
    transform: translateY(20px);
    animation: fade-in-up 0.8s forwards; /* 모든 카드에 기본 애니메이션 적용 */
}

/* 두 번째 카드에 애니메이션 지연 적용 (fade-in 시차) */
.card-container .custom-card:nth-child(2) {
    animation-delay: 0.2s; /* 0.2초 늦게 시작 */
}

/* Fade-in 애니메이션 키프레임 */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}

.card-image {
    width: 100%;
    height: 200px; /* 변경: 220px -> 180px (높이 감소) */
    object-fit: cover;
    border-bottom: 1px solid #f0f0f0;
}

.card-content {
    padding: 10px 20px 10px; /* 고객님 수정 */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title {
    margin-top: 0;
    margin-bottom: 6px; /* 고객님 수정 */
    font-size: 24px;
    color: #2c3e50;
}

.card-text {
    margin-bottom: 12px; /* 고객님 수정 */
    color: #7f8c8d;
    line-height: 1.6;
    flex-grow: 1;
}

.card-button {
    display: inline-flex;
    align-items: center;
    background-color: #000458; /* 기본 버튼 색상 (수입 중고차) */
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    align-self: center; /* 변경: 버튼 가운데 정렬 */
    margin: 0 auto; /* 추가: 버튼 중앙 정렬을 위한 마진 */
}

.card-button:hover {
    background-color: #0056b3; /* 기본 버튼 호버 색상 */
    transform: translateY(-2px);
}

/* 국산차 버튼 (두 번째 custom-card의 버튼) 색상 유지 */
.card-container .custom-card:nth-child(2) .card-button {
    background-color: #392f31; /* 기존 은색 */
}

/* 국산차 버튼 호버 시 색상 유지 */
.card-container .custom-card:nth-child(2) .card-button:hover {
    background-color: #8C8C8C; /* 기존 더 어두운 은색 */
}

/* 급처차량 버튼 (세 번째 custom-card의 버튼) 색상 변경 - 빨간색 적용 */
.card-container .custom-card:nth-child(3) .card-button {
    background-color: #dc3545; /* 빨간색 */
}

/* 급처차량 버튼 호버 시 색상 변경 */
.card-container .custom-card:nth-child(3) .card-button:hover {
    background-color: #c82333; /* 더 어두운 빨간색 */
}

.card-button .arrow {
    margin-left: 10px;
    font-size: 18px;
    line-height: 1;
}

/* Existing vehicle-grid-container and vehicle-card styles - 하단 차량 목록용 */
.vehicle-grid-container {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto 100px;
}

.vehicle-card {
    width: 320px;
    background: #fdfdfd;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.vehicle-card:hover {
    transform: translateY(-4px);
}
.vehicle-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}
.vehicle-info {
    padding: 10px 15px;
}
.vehicle-title {
    font-size: 20px;
    font-weight: bold;
    color: #222;
    margin-bottom: 12px;
}
.vehicle-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    padding-top: 10px;
    padding-bottom: 10px;
}
.badge {
    background: #F8F0E5;
    border: 1px solid #d4dee8;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.vehicle-price {
    font-size: 22px;
    font-weight: 700;
    color: #614a0e;
    text-align: center;
}

/* Filter & Pagination Styles - 기존 스타일 */
.filter-toggle-container {
    text-align: center;
    margin-bottom: 20px;
    max-width: 1000px;
    margin: 20px auto 10px auto;
}

.toggle-filter-button {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
    display: inline-block;
}

.toggle-filter-button:hover {
    background-color: #0056b3;
}

.vehicle-filter-form {
    background-color: #f9f9f9;
    padding: 25px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    max-width: 1000px;
    margin: 20px auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}
.vehicle-filter-form.hidden {
    display: none;
}
.vehicle-filter-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
    font-size: 14px;
}
.vehicle-filter-form input[type="text"],
.vehicle-filter-form input[type="number"],
.vehicle-filter-form select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
}
.vehicle-filter-form .filter-group {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.vehicle-filter-form .filter-group input {
    flex-grow: 1;
}
.vehicle-filter-form button[type="submit"] {
    grid-column: 1 / -1;
    background-color: #007bff;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}
.vehicle-filter-form button[type="submit"]:hover {
    background-color: #0056b3;
}

/* Pagination Styles - 기존 스타일 */
.vehicle-pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    padding-bottom: 30px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}
.vehicle-pagination .page-numbers {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 5px;
    flex-wrap: nowrap;
    justify-content: center;
}
.vehicle-pagination .page-numbers li {
    flex-shrink: 0;
}
.vehicle-pagination .page-numbers li a,
.vehicle-pagination .page-numbers li span {
    display: block;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #007bff;
    background-color: #fff;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.vehicle-pagination .page-numbers li a:hover {
    background-color: #e9ecef;
}
.vehicle-pagination .page-numbers li span.current {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    cursor: default;
}
.vehicle-pagination .page-numbers li .dots {
    border: none;
    background: none;
    padding: 8px 5px;
}

/* Loading overlay for UX - 기존 스타일 */
#vehicle-listings-container.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 10;
    font-size: 1.5em;
    color: #007bff;
}
#vehicle-listings-container {
    position: relative;
    min-height: 200px;
}

/* Simple Spinner (optional, could use a Font Awesome spinner instead) - 기존 스타일 */
#vehicle-listings-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    margin-left: -20px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-container { /* Custom Cards Responsive */
        flex-direction: column;
        align-items: center;
        gap: 25px;
    }
    .custom-card { /* Custom Cards Responsive */
        max-width: 90%; /* 작은 화면에서는 기존 320px 보다 크게, 90%로 유연하게 */
        min-width: unset; /* 작은 화면에서 min-width 제약 해제 */
    }
    /* Ensure button centering on smaller screens too */
    .card-button {
        align-self: center;
        margin: 0 auto; /* Ensure centering works responsively */
    }
    .vehicle-grid-container {
        justify-content: center;
    }
    .vehicle-filter-form {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    .vehicle-filter-form .filter-group {
        flex-direction: column;
        align-items: flex-start;
    }
    .vehicle-filter-form button[type="submit"] {
        width: 100%;
    }
    .vehicle-card {
        width: 100%;
        max-width: 320px;
    }
}

/* 추가적인 필터 폼 관련 스타일 (기존 스타일) */
.vehicle-filter-form select {
    opacity: 1 !important;
    visibility: visible !important;
}

.vehicle-filter-form.filter-form-collapsed {
    display: none;
}

/* 한 줄로 무조건 나열되게 (기존 스타일) */
#new-vehicle-pagination-container {
    display: flex !important;
    justify-content: center;
    flex-wrap: nowrap;
    margin-top: 30px;
}

/* 내부 리스트도 플렉스로 (기존 스타일) */
#new-vehicle-pagination-container .page-numbers {
    display: flex;
    list-style: none;
    padding: 0 8px;
    margin: 0;
    gap: 8px;
    flex-wrap: nowrap;
}

/* 링크/현재페이지 스타일 유지 (기존 스타일) */
#new-vehicle-pagination-container .page-numbers li a,
#new-vehicle-pagination-container .page-numbers li span.current {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
}
#new-vehicle-pagination-container .page-numbers li span.current {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}
/* 추가된 heading 스타일 */
.vehicle-grid-heading {
    text-align: center;
    font-size: 28px;
    color: #333;
    margin-top: 60px;
    margin-bottom: 30px;
    font-weight: 700;
}