* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #F2F5F8;
    min-height: 100vh;
    padding: 20px;
    color: #263238;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 95, 106, 0.12);
    overflow: hidden;
}

header {
    background: #005F6A;
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 0 30px 40px 30px;
}

.search-section {
    margin-bottom: 40px;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.95em;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #005F6A;
    box-shadow: 0 0 0 3px rgba(0, 95, 106, 0.15);
}

.captcha-section {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-top: 15px;
    display: none !important; /* Ẩn toàn bộ block captcha */
}

.captcha-section-title {
    color: #333;
    margin-bottom: 10px;
    font-size: 1em;
    font-weight: 600;
    display: none; /* Ẩn tiêu đề nhưng giữ code */
}

.captcha-attempts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.captcha-attempt {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px 10px;
    transition: all 0.3s ease;
}

.captcha-attempt.last-attempt {
    border: 1.5px solid #005F6A;
    box-shadow: 0 1px 4px rgba(0, 95, 106, 0.2);
}

.captcha-attempt:hover {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.attempt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f0f0f0;
}

.attempt-number {
    font-weight: 600;
    color: #555;
    font-size: 0.85em;
}

.attempt-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
}

.attempt-status.success {
    background: #d4edda;
    color: #155724;
}

.attempt-status.error {
    background: #f8d7da;
    color: #721c24;
}

.attempt-image {
    margin-bottom: 6px;
    text-align: center;
}

.attempt-image .captcha-img {
    max-width: 100px;
    margin: 0 auto;
    padding: 5px;
}

.attempt-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.attempt-details .info-item {
    padding: 3px 0;
    font-size: 0.8em;
}

.attempt-details .info-label {
    font-size: 0.75em;
}

.attempt-details .info-value {
    font-size: 0.8em;
}

.captcha-group {
    margin-bottom: 20px;
}

.captcha-group label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
}

.captcha-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.captcha-img {
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    padding: 10px;
    max-width: 200px;
    height: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-refresh {
    padding: 10px 20px;
    background: #005F6A;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: #004A54;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 95, 106, 0.35);
}

.captcha-info {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #666;
}

.info-value {
    color: #333;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.info-value.success {
    color: #28a745;
}

.info-value.error {
    color: #dc3545;
}

.btn-search {
    padding: 15px 30px;
    background: #005F6A;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-search:hover:not(:disabled) {
    background: #004A54;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 95, 106, 0.4);
}

.btn-search:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.results-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.results-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.violations-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.violation-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.violation-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.violation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.violation-title {
    font-size: 1.3em;
    font-weight: 700;
    color: #333;
}

.violation-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.violation-status.paid {
    background: #d4edda;
    color: #155724;
}

.violation-status.unpaid {
    background: #f8d7da;
    color: #721c24;
}

.violation-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-label {
    font-size: 0.85em;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 1em;
    color: #333;
    font-weight: 500;
}

.resolution-places {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.resolution-places-title {
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
}

.resolution-place {
    background: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid #005F6A;
}

.resolution-place-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.resolution-place-address {
    color: #666;
    font-size: 0.9em;
}

.no-violations {
    text-align: center;
    padding: 40px;
    color: #28a745;
    font-size: 1.2em;
    font-weight: 600;
}

.error-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 4px solid #dc3545;
    font-weight: 500;
}

/* Khối biển số + danh sách đã tra — tinh gọn, tiết kiệm chiều dọc */
.form-group-plate {
    gap: 10px;
}

.history-section {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 6px;
    min-height: 0;
}

.history-label {
    font-size: 0.8em;
    color: #888;
    font-weight: 500;
    flex-shrink: 0;
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    align-items: center;
}

.history-empty {
    color: #aaa;
    font-size: 0.8em;
}

/* Chip biển số nhỏ: dạng khung biển số, có nút xóa */
.history-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(180deg, #fff 0%, #f5f5f5 100%);
    padding: 4px 6px 4px 10px;
    border-radius: 6px;
    border: 1px solid #005F6A;
    box-shadow: 0 1px 2px rgba(0, 95, 106, 0.15);
    transition: all 0.2s ease;
    max-width: 100%;
}

.history-item:hover {
    border-color: #004A54;
    box-shadow: 0 2px 6px rgba(0, 95, 106, 0.2);
}

.history-plate {
    font-weight: 700;
    color: #005F6A;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    letter-spacing: 0.02em;
    transition: color 0.2s ease;
}

.history-plate:hover {
    color: #003d44;
}

.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: rgba(0, 95, 106, 0.1);
    border: none;
    border-radius: 4px;
    color: #005F6A;
    font-size: 1em;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-delete:hover {
    background: #dc3545;
    color: #fff;
}

.app-download-section {
    text-align: center;
    padding: 12px 14px;
    margin-top: 0;
    margin-bottom: 12px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 12px;
}

.app-download-text {
    font-size: 1em;
    font-weight: 600;
    color: #263238;
    margin-bottom: 6px;
}

.google-play-badge {
    display: inline-block;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.google-play-badge:hover {
    opacity: 0.9;
    transform: scale(1.03);
}

.google-play-badge img {
    display: block;
    height: 50px;
    width: auto;
}

.app-thumbnail-link {
    margin-right: 12px;
    vertical-align: middle;
}

.app-thumbnail {
    display: block;
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 16px;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
    border-top: 1px solid #e0e0e0;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    main {
        padding: 0 20px 30px 20px;
    }

    .violation-details {
        grid-template-columns: 1fr;
    }

    .captcha-container {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-refresh {
        width: 100%;
    }
}

