/* ANPR Custom Styles */
#message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    display: none;
}

#message p {
    margin: 0;
    font-weight: 500;
}

#message p.success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 5px;
}

#message p.error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 5px;
}

/* Container chính */
.containeranpr {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

/* Form upload */
#upload-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

#imageUpload {
    width: 100%;
    padding: 10px;
    border: 2px dashed #007bff;
    border-radius: 8px;
    background: white;
    margin-bottom: 15px;
    cursor: pointer;
    transition: border-color 0.3s;
}

#imageUpload:hover {
    border-color: #0056b3;
}

/* Vehicle Info */
#vehicleInfo {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

#vehicleInfo p {
    margin: 10px 0;
    font-size: 16px;
}

#colorBox {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ddd;
    margin-left: 10px;
    vertical-align: middle;
}

/* Result container */
#result-container {
    margin: 20px 0;
}

#result-container textarea {
    width: 100%;
    height: 200px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: #f8f9fa;
    resize: vertical;
}

/* Canvas */
#uploaded-image {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

#uploaded-canvas {
    max-width: 100%;
    height: auto;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: crosshair;
    transition: border-color 0.3s;
}

#uploaded-canvas:hover {
    border-color: #007bff;
}

/* Image controls */
.image-controls {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.bounding-box-info {
    margin-top: 10px;
    padding: 15px;
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border-radius: 8px;
    border-left: 4px solid #2196f3;
    text-align: left;
}

.bounding-box-info p {
    margin: 8px 0;
    font-size: 14px;
    color: #333;
}

.bounding-box-info strong {
    color: #1976d2;
}

#platePosition, #plateSize {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,123,255,0.3);
}

button:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,123,255,0.4);
}

button:active {
    transform: translateY(0);
}

#download-json {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

#download-json:hover {
    background: linear-gradient(135deg, #1e7e34, #155724);
}

#toggleBoundingBox {
    background: linear-gradient(135deg, #6f42c1, #5a2d82);
}

#toggleBoundingBox:hover {
    background: linear-gradient(135deg, #5a2d82, #4a1f6b);
}

/* Data container */
#data-container {
    grid-column: 1 / -1;
    margin-top: 40px;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

#data-container h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
    text-align: center;
}

/* Table container với scroll */
.table-container {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    margin-top: 20px;
}

/* Custom scrollbar */
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Table styling */
#data-container table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: white;
    margin: 0;
    min-width: 800px; /* Đảm bảo table có độ rộng tối thiểu */
}

/* Sticky header */
#data-container thead th {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#data-container th, #data-container td {
    text-align: center;
    padding: 15px 10px;
    word-wrap: break-word;
    border-bottom: 1px solid #e9ecef;
}

#data-container th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    font-weight: 600;
    text-transform: uppercase;
    color: #495057;
    font-size: 14px;
    letter-spacing: 0.5px;
}

#data-container tr:hover {
    background-color: #f8f9fa;
    transition: background-color 0.3s ease;
}

/* Image styling */
#data-container td img {
    display: block;
    margin: 0 auto;
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}

#data-container td img:hover {
    transform: scale(1.1);
}

/* Delete button */
.delete-row {
    background: linear-gradient(135deg, #dc3545, #c82333);
    padding: 8px 15px;
    font-size: 12px;
}

.delete-row:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
}

#refresh-data {
    background: linear-gradient(135deg, #17a2b8, #138496);
    margin-bottom: 20px;
}

#refresh-data:hover {
    background: linear-gradient(135deg, #138496, #0f6674);
}

/* Loading spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress bar */
.progress-container {
    margin: 15px 0;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .containeranpr {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 15px;
    }
    
    #data-container {
        padding: 20px 15px;
    }
    
    #data-container th, #data-container td {
        font-size: 12px;
        padding: 10px 5px;
    }

    #data-container button {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    button {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    #data-container table {
        font-size: 11px;
    }
    
    #data-container td img {
        width: 40px;
        height: 40px;
    }
    
    #vehicleInfo {
        padding: 15px;
    }
    
    #result-container textarea {
        height: 150px;
        font-size: 11px;
    }
}

/* Animation for success/error messages */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#message.show {
    display: block;
    animation: fadeInUp 0.5s ease;
}

/* Table empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}
