/* === Google Font & CSS Variables === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

:root {
    --primary-color: #3b82f6; /* A brighter blue */
    --primary-hover: #2563eb;
    
    --bg-dark: #111827; /* Near-black background */
    --panel-bg: #1f2937; /* Lighter gray for panels */
    --border-color: #374151; /* Subtle border color */

    --text-primary: #f9fafb; /* Off-white for main text */
    --text-secondary: #9ca3af; /* Lighter gray for labels */
    
    --font-family: 'Inter', sans-serif;
    --border-radius: 0.5rem; /* 8px */
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease-in-out;
}

/* === General & Layout === */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    margin: 0;
    padding: 2rem;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: auto;
}

.logo-container {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-image {
    max-width: 250px;
    height: auto;
}

/* === Filters Section === */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background-color: var(--panel-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

select {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    font-size: 1rem;
    font-family: var(--font-family);
    background-color: #374151; /* Darker input background */
    color: var(--text-primary);
    width: 100%;
    transition: var(--transition);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

@media (min-width: 1024px) {
    .filters {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* === Results Grid === */
#results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--panel-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

/* === Card Images === */
.card-images-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    background-color: var(--bg-dark);
}

.card-image-container {
    position: relative;
    width: 100%;
    /* กำหนด Aspect Ratio ถ้าต้องการ (เช่น 4:3 จะเป็น padding-top: 75%;) */
    /* ถ้าไม่กำหนด Aspect Ratio ที่แน่นอน รูปภาพจะปรับตามสัดส่วนของตัวเอง */
    min-height: 150px; /* กำหนดความสูงขั้นต่ำเพื่อไม่ให้กล่องยุบ */
    display: flex; /* ใช้ flexbox เพื่อจัดตำแหน่งรูปภาพตรงกลาง */
    justify-content: center;
    align-items: center;
}

.card-image-container:first-child:not(:only-child) {
    border-right: 2px solid var(--panel-bg);
}

.card-image {
    /* REMOVED: position: absolute; top: 0; left: 0; */
    max-width: 100%;
    max-height: 100%;
    width: auto; /* ให้รูปภาพใช้ความกว้างตามสัดส่วนของตัวเอง */
    height: auto; /* ให้รูปภาพใช้ความสูงตามสัดส่วนของตัวเอง */
    object-fit: contain; /* <<< MODIFIED: Changed to 'contain' */
    display: block; /* ลบช่องว่างใต้รูปภาพ */
}

/* === Card Content === */
.card-content {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.info-item { display: flex; flex-direction: column; }

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    font-weight: 500;
}

.info-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word; /* Prevents long remarks from overflowing */
}

/* === Card Actions === */
.card-actions {
    margin-top: auto;
    padding-top: 1.25rem;
    text-align: center;
}

.card-button {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background-color: var(--primary-color);
    color: white !important;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.card-button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

/* === No Results Message === */
.no-results {
    text-align: center;
    padding: 3rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
    grid-column: 1 / -1;
    background-color: var(--panel-bg);
    border-radius: var(--border-radius);
    border: 1px dashed var(--border-color);
}