/* --- General Styling & Variables --- */
:root {
    --primary-color: #0052cc;
    --primary-hover: #0041a3;
    --secondary-color: #10B981;
    --secondary-hover: #059669;
    --text-dark: #172B4D;
    --text-light: #42526E;
    --border-color: #DFE1E6;
    --background-light: #F4F5F7;
    --background-white: #FFFFFF;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --border-radius: 8px;
}

/* ... (Các style cho desktop giữ nguyên) ... */

#ktm-search-container {
    font-family: Tahoma, sans-serif;
    background-color: var(--background-white);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin: 40px auto;
}

#ktm-search-container h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 1.5rem 0;
}

.ktm-tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.ktm-tab-link {
    padding: 1rem 1.5rem;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    position: relative;
    top: 1px;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease-in-out;
}

.ktm-tab-link:hover {
    color: var(--primary-color);
}

.ktm-tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.ktm-tab-content {
    display: none;
}

.ktm-tab-content.active {
    display: block;
}

.ktm-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
}

.ktm-form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.ktm-form-group input[type="text"],
.ktm-form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    color: var(--text-light);
    transition: all 0.2s ease-in-out;
    font-family: Tahoma, sans-serif;
    background-color: var(--background-white);
}

.ktm-form-group input:focus,
.ktm-form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.2);
}

.ktm-form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
}

.ktm-form-actions .button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ktm-form-actions .button.button-primary {
    background-color: var(--primary-color);
    color: var(--background-white);
}

.ktm-form-actions .button.button-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.ktm-form-actions .button:not(.button-primary) {
    background-color: var(--background-light);
    color: var(--text-light);
    border-color: var(--border-color);
}

.ktm-form-actions .button:not(.button-primary):hover {
    background-color: #DFE1E6;
    border-color: #C1C7D0;
}

#ktm-search-results-wrapper {
    margin-top: 2.5rem;
}

.ktm-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.ktm-results-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

a.ktm-export-button {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease-in-out;
}

a.ktm-export-button:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.ktm-results-table-container {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--background-white);
    box-shadow: var(--shadow);
}

.ktm-results-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.ktm-results-table th,
.ktm-results-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-light);
}

.ktm-results-table thead th {
    background-color: var(--background-light);
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ktm-notice {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid;
    font-weight: 500;
    margin-top: 1rem;
}

.ktm-loader {
    border: 4px solid var(--background-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}

.ktm-pagination {
    margin-top: 2.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ktm-pagination .page-numbers {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

.ktm-pagination .page-numbers:hover {
    background-color: #E9F2FF;
    border-color: var(--primary-color);
}

.ktm-pagination .page-numbers.current {
    background-color: var(--primary-color);
    color: var(--background-white);
    border-color: var(--primary-color);
    cursor: default;
}

.ktm-pagination .page-numbers.dots {
    border: none;
    background: none;
    padding: 0.5rem 0.2rem;
}

/* --- *** SỬA LỖI & CẢI TIẾN: Giao diện cho điện thoại *** --- */
@media screen and (max-width: 768px) {
    /* Cho phép container cuộn ngang */
    .ktm-results-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Giúp cuộn mượt hơn trên iOS */
    }

    /* Đặt chiều rộng tối thiểu cho bảng để nó không bị vỡ layout */
    .ktm-results-table {
        min-width: 800px; 
    }

    /* Giữ cho nội dung trong các ô không bị xuống hàng */
    .ktm-results-table th,
    .ktm-results-table td {
        white-space: nowrap;
    }
}
