body, html {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: #fff5f0;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    font-size: 14px;
}

.container {
    width: 100vw;
    max-width: 100vw;
    min-height: 100vh;
    height: 100vh;
    margin: 0;
    padding: 0 24px;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-top: 4px solid #e86343;
}

header {
    margin-bottom: 0;
    padding: 24px 0 0 0;
}

.main-flex-layout {
    flex: 1 1 0;
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch;
    min-height: 0;
    height: 100%;
    width: 100%;
    background: #fff;
    gap: 10px; /* Thêm khoảng cách mặc định giữa 2 cột */
}

.form-section, .result-section {
    background: #fffaf8;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(231, 76, 60, 0.04);
    margin-bottom: 0;
    border: 1.5px solid #fae3d9;
}

.form-section {
    flex: 0 0 370px;
    max-width: 420px;
    min-width: 320px;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 32px 24px 0 24px;
    margin-right: 0;
}

.result-section {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 32px 24px 0 24px;
    min-height: 340px;
    margin-left: 0;
}

footer {
    margin-top: 0;
    padding: 10px 0 10px 0;
    border-top: 1px solid #fae3d9;
    color: #e67e22;
    font-size: 11px;
    text-align: center;
}

@media (min-width: 1100px) {
    .main-flex-layout {
        gap: 64px !important; /* Tăng khoảng cách giữa 2 cột trên desktop */
    }
    .form-section, .result-section {
        padding: 40px 32px 24px 32px;
    }
    .result-section {
        min-width: 440px; /* Đảm bảo cột kết quả không bị thu nhỏ quá mức */
    }
}

@media (max-width: 900px) {
    html, body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    .container {
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
        padding-left: 12px;
        padding-right: 12px;
        box-sizing: border-box;
    }
    .main-flex-layout {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .form-section, .result-section {
        width: 100%;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
        padding-left: 0;
        padding-right: 0;
    }
    html, body, .container {
        min-height: 100vh !important;
        height: auto !important;
    }
    .container {
        padding: 0 2px;
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        height: auto;
    }
    .main-flex-layout {
        flex: 1 0 auto;
    }
    footer {
        position: relative;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #fff5f0;
        z-index: 10;
        margin-bottom: 0;
        padding-bottom: 16px;
        font-size: 12px;
        box-shadow: none;
        flex-shrink: 0;
    }
    body, .container {
        padding-bottom: 80px !important;
    }
    .container {
        min-height: unset;
        height: unset;
    }
    .main-flex-layout {
        flex-direction: column !important;
        height: unset;
        display: flex !important;
        gap: 0 !important;
    }
    .form-section, .result-section {
        max-width: 100%;
        min-width: 0;
        border: none;
        height: unset;
        padding: 18px 10px 10px 10px;
        box-sizing: border-box;
        border-radius: 12px;
        box-shadow: 0 1px 6px rgba(231,76,60,0.06);
        background: #fffaf8;
        margin-bottom: 18px;
    }
    .form-section {
        border-right: none;
    }
    .result-section {
        min-height: 200px;
    }
    footer {
        position: static;
        width: 100%;
        background: #fff5f0;
        z-index: 10;
        margin-bottom: 0;
        padding-bottom: 12px;
        font-size: 12px;
        box-shadow: none;
    }
    body, .container {
        padding-bottom: 60px !important;
    }
    .modal-result {
        z-index: 9999;
    }
    .result-section {
        padding-left: 10px;
        padding-right: 10px;
    }
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }
    .form-section, .result-section {
        max-width: 500px;
        width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }
    .form-section, .result-section {
        max-width: 420px;
        width: 100%;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }
}

/* Sửa lỗi chiều ngang mobile: loại bỏ width: 100vw, max-width: 100vw, chỉ dùng width: 100% và căn giữa */
@media (max-width: 900px) {
    .container {
        width: 100%;
        max-width: 100%;
        padding-left: 12px;
        padding-right: 12px;
        box-sizing: border-box;
    }
    .main-flex-layout {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .form-section, .result-section {
        width: 100%;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
        padding-left: 0;
        padding-right: 0;
    }
    html, body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* Modal hiển thị kết quả tra cứu cho mobile */
@media (max-width: 900px) {
  .modal-result {
    display: none; /* sẽ bật bằng JS khi có kết quả */
    position: fixed;
    z-index: 9999;
    left: 0; top: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    overflow-y: auto;
  }
  .modal-result.active {
    display: block;
  }
  .modal-overlay {
    position: fixed;
    left: 0; top: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1;
  }
  .modal-content {
    position: relative;
    z-index: 2;
    background: #fff;
    border-radius: 16px 16px 0 0;
    max-width: 98vw;
    margin: 40px auto 0 auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    padding: 18px 8px 24px 8px;
    min-height: 40vh;
    animation: modalShow 0.25s;
  }
  .modal-close {
    position: absolute;
    right: 12px;
    top: 12px;
    background: #fff5f0;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 1.6em;
    color: #e74c3c;
    box-shadow: 0 2px 8px rgba(231,76,60,0.08);
    cursor: pointer;
    z-index: 3;
    transition: background 0.2s;
  }
  .modal-close:hover {
    background: #ffe3db;
  }
  #modalResultContent {
    margin-top: 32px;
    max-height: 70vh;
    overflow-y: auto;
  }
}
@keyframes modalShow {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .container {
        margin: 8px;
        padding: 8px;
    }
    .main-flex-layout {
        flex-direction: column !important;
        display: flex !important;
        gap: 16px !important;
    }
    .form-section, .result-section {
        max-width: 100%;
        min-width: 0;
        border: none;
        height: unset;
        padding: 10px 4px 0 4px;
        box-sizing: border-box;
    }
    .form-section {
        border-right: none;
    }
    .result-section {
        min-height: 180px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 0 2px;
    }
    .form-section, .result-section {
        padding: 10px 2vw 8px 2vw;
        border-radius: 8px;
        margin-bottom: 14px;
    }
    .result-section {
        min-height: 120px;
    }
}

h1, h2, h3 {
    color: #d35400;
    margin-top: 0;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #fae3d9;
    color: #d35400;
}

.form-group {
    margin-bottom: 6px;
    border-radius: 6px;
    padding: 3px 0;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.form-group:hover {
    border-color: #ffd8cc;
    background-color: #fff9f7;
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
    color: #c0392b;
    font-size: 12px;
}

input[type="text"],
select {
    width: 100%;
    padding: 7px;
    border: 1px solid #ffd8cc;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 12px;
    transition: border-color 0.3s, box-shadow 0.3s;
    background-color: #fffbf9;
}

input[type="text"]:focus,
select:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
    outline: none;
    background-color: #fff;
}

.captcha-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.captcha-image {
    margin-right: 15px;
    border: 1px solid #ffd8cc;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    max-width: 110px;
    height: 32px;
}

.refresh-button {
    display: none !important;
}

.submit-button {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    width: 100%;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s;
    margin-top: 8px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.submit-button:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.15);
}

.result-container {
    margin-top: 10px;
    border-top: 2px solid #fae3d9;
    padding-top: 10px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-container h2 {
    margin-bottom: 12px;
    color: #d35400;
    text-align: center;
    position: relative;
    padding-bottom: 4px;
    font-size: 1.1em;
}

.result-container h2:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(to right, #e74c3c, #e67e22);
    border-radius: 3px;
}

/* Cải thiện bảng hiển thị vi phạm */
.violation-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    font-size: 12px;
}

.violation-table th,
.violation-table td {
    padding: 4px 5px;
    border: 1px solid #ffd8cc;
    text-align: left;
    font-size: 12px;
}

.violation-table th {
    background-color: #fae3d9;
    font-weight: bold;
    color: #c0392b;
}

.violation-table tr:nth-child(even) {
    background-color: #fff9f7;
}

.violation-table tr:hover {
    background-color: #ffeee8;
}

.error-message {
    color: #c0392b;
    padding: 15px;
    background-color: #fcece9;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #e74c3c;
    box-shadow: 0 3px 6px rgba(0,0,0,0.05);
}

.info-message {
    color: #d35400;
    padding: 15px;
    background-color: #fef5ec;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #e67e22;
    box-shadow: 0 3px 6px rgba(0,0,0,0.05);
}

/* Cải thiện phần hiển thị kết quả vi phạm */
.violation-details-wrapper {
    background: #fff;
    border: 1px solid #ffd8cc;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    margin-top: 10px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    padding: 10px;
}

.violation-details-wrapper:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
}

.violation-details-wrapper .form-horizontal {
    padding: 25px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #fffaf8 !important;
    border: none !important;
}

.violation-details-wrapper .form-group {
    margin-bottom: 20px;
    border-bottom: 1px solid #ffd8cc;
    padding: 15px;
    transition: background-color 0.2s;
    border-radius: 6px;
}

.violation-details-wrapper .form-group:hover {
    background-color: #fff5f0;
}

.violation-details-wrapper .form-group:last-child {
    border-bottom: none;
}

.violation-details-wrapper .row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.violation-details-wrapper .control-label {
    flex: 0 0 240px;
    font-weight: bold;
    color: #d35400;
}

.violation-details-wrapper .control-label i {
    color: #e74c3c;
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

.violation-details-wrapper .col-md-9 {
    flex: 1;
    padding-left: 15px;
    font-size: 15px;
}

/* Định dạng trạng thái vi phạm */
.violation-details-wrapper .badge {
    display: inline-block;
    padding: 2px 8px;
    font-weight: bold;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-size: 12px;
}

.violation-details-wrapper .text-danger {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.violation-details-wrapper .text-success {
    background-color: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

/* Định dạng phần thông tin liên hệ */
.resolution-info {
    background-color: #fff5f0;
    border-radius: 6px;
    padding: 15px;
    margin-top: 5px;
    border-left: 3px solid #e67e22;
}

.resolution-info div {
    padding: 5px 0;
}

.resolution-info i {
    color: #e67e22;
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

/* Định dạng đường kẻ ngang */
.violation-details-wrapper hr {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, #ffd8cc, transparent);
    margin: 20px 0;
}

/* Additional styles for the enhanced interface */
header {
    margin-bottom: 30px;
}

footer {
    text-align: center;
    margin-top: 10px;
    padding-top: 5px;
    border-top: 1px solid #fae3d9;
    color: #e67e22;
    font-size: 11px;
}

/* Form hint style */
.form-hint {
    display: block;
    margin-top: 5px;
    color: #e67e22;
    font-size: 0.85em;
    font-style: italic;
}

/* No results message styling */
.no-results {
    text-align: center;
    padding: 12px;
    background-color: #fff9f7;
    border-radius: 8px;
    border: 1px solid #ffd8cc;
    font-size: 12px;
}

.no-results i {
    font-size: 48px;
    color: #e67e22;
    margin-bottom: 15px;
    display: block;
}

.no-results p {
    font-size: 18px;
    color: #d35400;
}

/* Captcha error message */
.captcha-error {
    padding: 10px;
    background-color: #fef5ec;
    color: #d35400;
    border-radius: 6px;
    border: 1px solid #fae3d9;
}

/* Style for icons in labels and buttons */
label i, button i, h2 i, h3 i, h4 i {
    margin-right: 8px;
}

/* Improving focus indication for accessibility */
a:focus, button:focus, input:focus, select:focus {
    outline: 3px solid rgba(231, 76, 60, 0.5);
    outline-offset: 2px;
}

/* Add transition effects to interactive elements */
a, button, input, select, .badge, .form-group, .violation-details-wrapper {
    transition: all 0.3s ease;
}

/* Print styles for violation reports */
@media print {
    body, .container {
        margin: 0;
        padding: 0;
        background: white;
    }
    
    header, form, footer, .submit-button {
        display: none;
    }
    
    .result-container {
        margin-top: 0;
        border-top: none;
    }
    
    .violation-details-wrapper {
        box-shadow: none;
        border: none;
    }
}

/* Media Queries for Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 15px;
        padding: 20px;
    }
    
    .violation-details-wrapper .row {
        flex-direction: column;
    }
    
    .violation-details-wrapper .control-label {
        flex: 0 0 100%;
        margin-bottom: 8px;
    }
    
    .violation-details-wrapper .col-md-9 {
        flex: 0 0 100%;
        padding-left: 0;
    }
    
    .captcha-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .captcha-image {
        margin-bottom: 10px;
    }
    
    .refresh-button {
        margin-left: 0;
        margin-top: 10px;
    }
}

/* Styles cho phần kết quả tra cứu đã cải tiến */

/* Card styles */
.card-header {
    background-color: #fae3d9;
    padding: 8px 10px;
    font-weight: bold;
    color: #d35400;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom: 1px solid #ffd8cc;
    display: flex;
    align-items: center;
    font-size: 15px;
}

.card-header i {
    margin-right: 10px;
    color: #e74c3c;
}

.card-body {
    padding: 10px;
    background-color: #fff;
}

/* Vehicle Info Card */
.vehicle-info-card {
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #ffd8cc;
    transition: box-shadow 0.3s ease;
    padding: 10px;
    margin-top: 10px;
}

.vehicle-info-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
}

.info-row {
    display: flex;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ffd8cc;
}

.info-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.info-label {
    flex: 0 0 120px;
    font-weight: bold;
    color: #d35400;
    font-size: 12px;
}

.info-label i {
    color: #e67e22;
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

.info-value {
    flex: 1;
    font-size: 12px;
}

/* Violation Header */
.violation-header {
    background: linear-gradient(135deg, #fae3d9, #ffd8cc);
    color: #c0392b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    font-size: 15px;
}

.violation-header .badge {
    font-size: 14px;
}

/* Violation Items */
.violation-item {
    display: flex;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #ffd8cc;
    background-color: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
}

.violation-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.violation-icon {
    flex: 0 0 50px;
    height: 50px;
    background-color: #fae3d9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.violation-icon i {
    color: #e74c3c;
    font-size: 20px;
}

.highlight-icon {
    background-color: rgba(231, 76, 60, 0.2);
}

.violation-content {
    flex: 1;
}

.violation-label {
    color: #7f8c8d;
    font-size: 13px;
    margin-bottom: 5px;
}

.violation-value {
    font-weight: 500;
    color: #333;
    font-size: 16px;
}

.highlight-text {
    color: #c0392b;
    font-weight: bold;
}

/* Resolution Card */
.resolution-card {
    margin-top: 10px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #ffd8cc;
    padding: 10px;
}

.resolution-unit {
    font-weight: bold;
    margin-bottom: 10px;
    color: #c0392b;
    font-size: 16px;
}

.resolution-details {
    background-color: #fff5f0;
    padding: 15px;
    border-radius: 6px;
    border-left: 3px solid #e67e22;
}

.resolution-details div {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.resolution-details i {
    width: 20px;
    margin-right: 8px;
    color: #e67e22;
}

/* Message container */
.message-container {
    text-align: center;
    padding: 12px;
    background-color: #fff9f7;
    border-radius: 8px;
    border: 1px solid #ffd8cc;
    font-size: 12px;
}

.message-container i {
    font-size: 40px;
    color: #e67e22;
    margin-bottom: 15px;
    display: block;
}

.message-container p {
    font-size: 18px;
    color: #d35400;
}

/* Raw HTML container */
.raw-html-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #ffd8cc;
    padding: 20px;
}

/* Animation for elements */
.vehicle-info-card, .violation-details-wrapper, .resolution-card {
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Simple Violation Format Styles */
.simple-violation-format {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin-top: 15px;
}

.violation-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.violation-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.violation-header {
    background: linear-gradient(135deg, #e74c3c, #d35400);
    color: white;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
}

.violation-header i {
    margin-right: 10px;
    font-size: 20px;
}

.violation-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
}

.violation-section {
    background-color: #fff9f7;
    border-radius: 8px;
    padding: 8px;
    border: 1px solid #ffd8cc;
    font-size: 12px;
}

.violation-section.full-width {
    grid-column: 1 / -1;
}

.violation-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #d35400;
    font-size: 16px;
    border-bottom: 2px solid #fae3d9;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
}

.violation-section h3 i {
    margin-right: 8px;
    color: #e74c3c;
}

.violation-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.violation-item {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    border-radius: 6px;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
}

.violation-item:hover {
    background-color: #fff5f0;
    border-left-color: #e67e22;
}

.violation-item.highlight {
    background-color: #fef5ec;
    border-left-color: #e74c3c;
}

.item-label {
    display: flex;
    align-items: center;
    color: #7f8c8d;
    font-size: 13px;
    margin-bottom: 4px;
}

.item-label i {
    margin-right: 8px;
    color: #e67e22;
    width: 16px;
    text-align: center;
}

.item-value {
    font-weight: 500;
    color: #333;
    padding-left: 24px;
}

.status-badge {
    display: inline-block;
    background-color: #e67e22;
    color: white;
    padding: 2px 6px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: normal;
}

.status-badge.paid {
    background-color: #27ae60 !important;
    color: #fff !important;
}

/* Responsive layout */
@media (max-width: 768px) {
    .violation-grid {
        grid-template-columns: 1fr;
    }
    
    .violation-header {
        font-size: 16px;
    }
    
    .violation-item {
        padding: 10px 8px;
    }
}

@media print {
    .violation-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .violation-header {
        background: #f5f5f5;
        color: #333;
        border-bottom: 1px solid #ddd;
    }
    
    .status-badge {
        border: 1px solid #e67e22;
        background-color: transparent;
        color: #e67e22;
    }
}

/* --- TỐI ƯU HIỂN THỊ GỌN GÀNG VÀ 2 CỘT --- */
@media (min-width: 900px) {
    .main-flex-layout {
        display: flex;
        flex-direction: row;
        gap: 64px; /* Tăng gap ở desktop */
        align-items: flex-start;
    }
    .main-flex-layout .form-section, .main-flex-layout .result-section {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
    }
    .main-flex-layout .form-section {
        max-width: none;
    }
    .main-flex-layout .result-section {
        min-width: 0;
        max-width: none;
    }
}

/* Responsive: mobile vẫn 1 cột */
@media (max-width: 899px) {
    .main-flex-layout {
        display: block;
    }
    .main-flex-layout .form-section, .main-flex-layout .result-section {
        max-width: 100%;
    }
}

/* --- FORM-SECTION DESKTOP STYLE --- */
@media (min-width: 900px) {
    .form-section {
        font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
        font-size: 16px;
        background: #fff7f2;
        border: 2px solid #e67e22;
        box-shadow: 0 4px 24px rgba(230, 99, 67, 0.08);
        border-radius: 18px;
        padding: 48px 36px 32px 36px;
        margin-right: 0;
        min-width: 0;
        max-width: none;
    }
    .form-section label {
        font-size: 15px;
        color: #b34700;
        margin-bottom: 8px;
    }
    .form-section input[type="text"],
    .form-section select {
        font-size: 15px;
        padding: 10px 12px;
        border-radius: 8px;
        margin-bottom: 10px;
    }
    .form-section .form-group {
        margin-bottom: 18px;
        padding: 6px 0;
    }
    .form-section .submit-button {
        font-size: 15px;
        padding: 10px 0;
        border-radius: 8px;
    }
}

/* --- HOÀN TÁC MOBILE FORM-SECTION --- */
@media (max-width: 900px) {
    .form-section {
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        font-size: 14px;
        background: #fffaf8;
        border: none;
        box-shadow: 0 1px 6px rgba(231,76,60,0.06);
        border-radius: 12px;
        padding: 18px 10px 10px 10px;
        margin-bottom: 18px;
    }
    .form-section label {
        font-size: 12px;
        color: #c0392b;
        margin-bottom: 4px;
    }
    .form-section input[type="text"],
    .form-section select {
        font-size: 12px;
        padding: 7px;
        border-radius: 6px;
        margin-bottom: 6px;
    }
    .form-section .form-group {
        margin-bottom: 6px;
        padding: 3px 0;
    }
    .form-section .submit-button {
        font-size: 12px;
        padding: 5px 10px;
        border-radius: 6px;
    }
}

/* --- KHẮC PHỤC MOBILE BỊ CUỘN NGANG --- */
@media (max-width: 900px) {
    html, body, .container, .main-flex-layout, .form-section, .result-section {
        max-width: 100vw !important;
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box;
    }
    body {
        overflow-x: hidden !important;
    }
}

/* --- TỐI ƯU HIỂN THỊ KẾT QUẢ Ở CỘT TRÁI DESKTOP --- */
@media (min-width: 900px) {
    .result-section {
        font-size: 15px;
        padding: 48px 36px 32px 36px;
        background: #fffefb;
        border-radius: 18px;
        box-shadow: 0 4px 24px rgba(230, 99, 67, 0.08);
        max-height: none;
        overflow-y: visible;
        padding-bottom: 32px;
        overflow: hidden;
        position: relative;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding-top: 18px; /* Giảm khoảng trống phía trên */
    }
    .result-section .result-container,
    .result-section .no-results,
    .result-section .message-container {
        font-size: 1em; /* Giảm cỡ chữ bên trong */
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(231,76,60,0.04);
        padding: 18px 12px;
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .result-section table.violation-table {
        font-size: 0.97em;
        table-layout: fixed;
        width: 100%;
        border-radius: 8px;
        overflow: hidden;
        background: #fff;
    }
    .result-section th, .result-section td {
        font-size: 0.97em;
        padding: 7px 8px;
        max-width: 220px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        word-break: break-all;
    }
    .result-section h2, .result-section h3 {
        font-size: 1.08em;
        margin-top: 0.5em;
        margin-bottom: 0.7em;
    }
    .result-section .status-badge {
        font-size: 1em;
        padding: 4px 12px;
    }
    .result-section h2, .result-section h3 {
        font-size: 1.25em;
    }
    .result-section {
        display: block;
        overflow-x: visible;
    }
    .result-section table.violation-table td.allow-wrap {
        white-space: normal;
        word-break: break-word;
        text-overflow: initial;
    }
}

/* --- KHÔI PHỤC HIỂN THỊ KẾT QUẢ Ở DESKTOP, KHÔNG ĐỤNG MOBILE --- */
@media (min-width: 900px) {
    html, body, .container, .main-flex-layout, .form-section, .result-section {
        width: auto !important;
        max-width: none !important;
        overflow-x: visible !important;
    }
    .result-section {
        display: block;
        overflow-x: visible;
    }
}

/* Giới hạn chiều rộng và xử lý dữ liệu dài trong bảng kết quả */
@media (min-width: 900px) {
    .result-section table.violation-table {
        table-layout: fixed;
        width: 100%;
    }
    .result-section table.violation-table th,
    .result-section table.violation-table td {
        max-width: 260px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        word-break: break-all;
    }
    /* Cho phép xuống dòng với các trường hợp đặc biệt */
    .result-section table.violation-table td.allow-wrap {
        white-space: normal;
        word-break: break-word;
        text-overflow: initial;
    }
}

/* --- CẬP NHẬT CHO KẾT QUẢ CỘT PHẢI --- */
@media (min-width: 900px) {
    .result-section {
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .result-section .result-container,
    .result-section .no-results,
    .result-section .message-container {
        padding-top: 4px;
        padding-bottom: 4px;
    }
    .result-section table.violation-table {
        width: 100%;
        table-layout: auto;
    }
    .result-section table.violation-table th,
    .result-section table.violation-table td {
        max-width: none;
        white-space: normal;
        word-break: break-word;
        overflow: visible;
        text-overflow: unset;
        font-size: 0.97em;
        padding: 7px 8px;
    }
}

/* Căn đều trái phải cho phần giao diện mobile */
@media (max-width: 900px) {
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }
    .main-flex-layout {
        padding-left: 0;
        padding-right: 0;
    }
    .form-section, .result-section {
        margin-left: auto;
        margin-right: auto;
        width: 100%;
        box-sizing: border-box;
    }
}