:root {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --success-color: #4cc9f0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* Header Styles */
.app-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.icon-large {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.app-header h1 {
    color: var(--dark-color);
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--gray-color);
    font-size: 1.1rem;
}

/* Card Base */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 25px;
    margin-bottom: 25px;
    transition: var(--transition);
}

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

/* Upload Section */
.upload-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.upload-header i {
    font-size: 1.8rem;
    color: var(--primary-color);
}

.upload-hint {
    color: var(--gray-color);
    margin-bottom: 25px;
    text-align: center;
}

.upload-area {
    border: 3px dashed var(--primary-color);
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    background: rgba(67, 97, 238, 0.05);
    margin-bottom: 20px;
}

.upload-area:hover {
    background: rgba(67, 97, 238, 0.1);
    border-color: var(--secondary-color);
}

.upload-icon {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    opacity: 0.7;
}

.upload-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark-color);
}

.upload-formats {
    color: var(--gray-color);
    font-size: 0.9rem;
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

/* Progress Bar */
.upload-progress {
    margin-top: 20px;
}

.progress-bar {
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--primary-color));
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 5px;
}

.progress-text {
    text-align: center;
    font-weight: 600;
    color: var(--dark-color);
}

/* Results Section */
.results-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.results-header i {
    font-size: 1.8rem;
    color: var(--success-color);
}

.count-display {
    text-align: center;
    margin: 25px 0;
}

.count-number {
    font-size: 5rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.count-label {
    font-size: 1.2rem;
    color: var(--gray-color);
    margin-top: 10px;
}

.confidence-info {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.confidence-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    min-width: 150px;
}

.confidence-label {
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-bottom: 5px;
}

.confidence-value {
    font-weight: 700;
    color: var(--dark-color);
}

.status-indicator {
    color: var(--success-color);
}

/* Image Section */
.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.section-header i {
    font-size: 1.8rem;
    color: var(--secondary-color);
}

.image-container {
    position: relative;
    width: 100%;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder {
    text-align: center;
    padding: 40px;
    color: var(--gray-color);
}

.placeholder-icon {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 20px;
}

#canvas {
    position: relative;
    max-width: 100%;
    height: auto;
    display: none;
    border-radius: 4px;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-info {
    margin-top: 15px;
    padding: 12px;
    background: #e7f5ff;
    border-radius: 8px;
    color: var(--primary-color);
    text-align: center;
    font-size: 0.9rem;
}

.image-info i {
    margin-right: 8px;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 20px;
    color: var(--gray-color);
    font-size: 0.9rem;
    margin-top: 30px;
}

#modelInfo {
    font-weight: 600;
    color: var(--dark-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .count-number {
        font-size: 4rem;
    }
    
    .confidence-info {
        flex-direction: column;
        align-items: center;
    }
    
    .confidence-item {
        width: 100%;
        max-width: 300px;
    }
    
    .image-container {
        min-height: 180px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .app-header {
        padding: 15px;
    }
    
    .icon-large {
        font-size: 2.5rem;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .upload-text {
        font-size: 1rem;
    }
    
    .count-number {
        font-size: 3.5rem;
    }
}

/* ... bestehende Styles ... */

/* History Section */
.history-section {
    margin-top: 40px;
}

.history-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    flex: 1;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
}

.filter-group label {
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    color: var(--dark-color);
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.storage-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    color: var(--gray-color);
    font-size: 0.9rem;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.history-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.history-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.history-image {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* 4:3 Aspect Ratio */
    overflow: hidden;
}

.history-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.history-info {
    padding: 15px;
}

.history-date {
    font-size: 0.8rem;
    color: var(--gray-color);
    margin-bottom: 5px;
}

.history-count {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.history-empty {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
    color: var(--gray-color);
}

.empty-icon {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 20px;
}

.empty-subtext {
    font-size: 0.9rem;
    margin-top: 5px;
    opacity: 0.7;
}

/* Buttons */
.btn-save, .btn-clear, .btn-storage, .btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-save {
    background: var(--success-color);
    color: white;
    margin-left: auto;
}

.btn-save:hover {
    background: #3ab4d9;
}

.btn-clear {
    background: #ff6b6b;
    color: white;
    margin-left: auto;
}

.btn-clear:hover {
    background: #ff5252;
}

.btn-storage {
    background: transparent;
    color: var(--primary-color);
    padding: 5px 10px;
    font-size: 0.8rem;
}

.btn-storage:hover {
    background: rgba(67, 97, 238, 0.1);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary-color);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray-color);
    line-height: 1;
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: auto;
    flex: 1;
}

.modal-image-container {
    text-align: center;
    max-height: 50vh;
    overflow: auto;
}

#modalCanvas {
    max-width: 100%;
    height: auto;
}

.modal-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

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

.modal-label {
    font-weight: 600;
    color: var(--gray-color);
    font-size: 0.9rem;
}

.modal-value {
    font-size: 1.2rem;
    color: var(--dark-color);
    font-weight: 600;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    .history-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-controls {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .storage-info {
        justify-content: center;
    }
    
    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .modal-body {
        flex-direction: column;
    }
    
    .modal-info {
        grid-template-columns: 1fr;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer button {
        width: 100%;
    }
}
