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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 2.5em;
}

.container > p {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.upload-section {
    text-align: center;
    margin-bottom: 30px;
    padding: 40px 30px;
    border: 3px dashed #ddd;
    border-radius: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    background: #f8f9fa;
}

.upload-section:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
}

.upload-section.drag-over {
    border-color: #667eea;
    background: #e8f0fe;
    transform: scale(1.02);
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 4em;
    margin-bottom: 15px;
    opacity: 0.7;
}

.upload-section h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1.3em;
    font-weight: 600;
}

.upload-section p {
    color: #666;
    font-size: 0.9em;
    margin: 0;
}

.file-name {
    margin-top: 15px;
    padding: 10px 15px;
    background: #667eea;
    color: white;
    border-radius: 5px;
    font-size: 0.9em;
    display: inline-block;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.summary {
    margin-bottom: 30px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #667eea;
}

.card h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.card p {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.card small {
    color: #666;
    font-size: 0.9em;
}

.details {
    margin-top: 30px;
}

.details h3 {
    margin-bottom: 20px;
    color: #333;
}

.page-result {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.page-number {
    font-weight: bold;
    font-size: 1.2em;
    color: #333;
}

.page-summary {
    color: #666;
    font-size: 0.9em;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 15px;
}

.image-info {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.image-preview {
    width: 100%;
    height: 150px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #dee2e6;
}

.preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.no-preview {
    color: #999;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #f0f0f0;
}

.image-content {
    padding: 15px;
}

.image-info h5 {
    margin-bottom: 12px;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
}

.image-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.9em;
    max-height: none; /* Allow expansion for more details */
}

.image-details span {
    color: #666;
}

.dpi-value {
    font-weight: bold;
    color: #667eea;
}

.debug-info {
    font-weight: 600;
    color: #28a745;
    font-size: 0.85em;
}

.backend-badge {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.client-badge {
    background: #ffc107;
    color: #333;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.no-images {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
}

/* Overall Assessment Styles */
.overall-assessment {
    margin: 30px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.overall-assessment h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
    text-align: center;
}

.assessment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.assessment-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.2s ease;
}

.assessment-card:hover {
    transform: translateY(-2px);
}

.assessment-label {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.assessment-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.assessment-score {
    color: #667eea;
    font-weight: 600;
}

.assessment-detail {
    color: #666;
    font-size: 0.9em;
    margin-top: 8px;
}

/* Grade-specific colors */
.grade-xuất-sắc .assessment-value {
    color: #28a745;
}

.grade-tốt .assessment-value {
    color: #17a2b8;
}

.grade-trung-bình .assessment-value {
    color: #ffc107;
}

.grade-cần-cải-thiện .assessment-value {
    color: #dc3545;
}

.quality-breakdown {
    text-align: left;
}

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

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

.quality-item.high span:first-child {
    color: #28a745;
    font-weight: 600;
}

.quality-item.medium span:first-child {
    color: #ffc107;
    font-weight: 600;
}

.quality-item.low span:first-child {
    color: #dc3545;
    font-weight: 600;
}

.recommendation {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.recommendation h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.recommendation p {
    color: #555;
    line-height: 1.6;
    margin: 0;
}

@media (max-width: 768px) {
    .assessment-grid {
        grid-template-columns: 1fr;
    }
    
    .quality-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}