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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
    padding: 20px;
}

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

h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5rem;
    background: linear-gradient(90deg, #00d4ff, #7b2cbf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Controls Bar */
.controls-bar {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Buttons */
.upload-btn {
    background: linear-gradient(90deg, #00d4ff, #7b2cbf);
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.4);
}

.detect-btn {
    background: linear-gradient(90deg, #7b2cbf, #00d4ff);
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.detect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(123, 44, 191, 0.4);
}

.detect-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.cancel-btn {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
}

.timer {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 1.1rem;
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
    padding: 8px 15px;
    border-radius: 8px;
    min-width: 60px;
    text-align: center;
}

/* Threshold Control */
.threshold-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 300px;
}

.threshold-control label {
    color: #aaa;
}

.threshold-control input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.threshold-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #00d4ff;
    border-radius: 50%;
    cursor: pointer;
}

.threshold-value {
    background: rgba(0, 212, 255, 0.2);
    padding: 5px 12px;
    border-radius: 5px;
    min-width: 50px;
    text-align: center;
}

/* Filter Select */
.filter-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    padding: 6px 10px;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    margin-left: 10px;
}

.filter-select option {
    background: #1a1a2e;
    color: #fff;
}

/* File Info */
.file-info {
    color: #888;
    font-size: 0.9rem;
    margin-left: 10px;
}

/* Classes Toggle */
.classes-toggle {
    color: #888;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.classes-toggle:hover {
    color: #00d4ff;
}

.classes-toggle.active {
    color: #00d4ff;
}

.classes-toggle .toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.classes-toggle.active .toggle-icon {
    transform: rotate(90deg);
}

.classes-toggle #classes-count {
    color: #00d4ff;
    font-weight: bold;
}

/* Classes Panel */
.classes-panel {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.classes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.class-tag {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 6px 12px;
    border-left: 3px solid;
    font-size: 0.85rem;
    color: #ddd;
}

/* Inline Stats */
.inline-stats {
    display: flex;
    gap: 15px;
    margin-left: auto;
}

.inline-stat {
    color: #aaa;
    font-size: 0.85rem;
}

.inline-stat strong {
    color: #00d4ff;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #7b2cbf);
    width: 0%;
    transition: width 0.3s;
}

/* Drop Zone */
.drop-zone {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 212, 255, 0.1);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border: 4px dashed #00d4ff;
}

.drop-zone.active {
    display: flex;
}

.drop-zone-content {
    text-align: center;
    color: #fff;
}

.drop-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.drop-zone-content p {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Images Container */
.images-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .images-container {
        grid-template-columns: 1fr;
    }
}

/* Image Panel */
.image-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.image-panel h2 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #ddd;
    display: flex;
    align-items: center;
    gap: 10px;
}

.image-panel h2 .badge {
    background: rgba(0, 212, 255, 0.2);
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    color: #00d4ff;
}

.image-wrapper {
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

.image-wrapper img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 8px;
}

.placeholder {
    color: #555;
    text-align: center;
}

/* Batch Navigation */
.batch-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-info {
    color: #aaa;
}

/* Detection Results */
.detected-objects {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.detected-objects h3 {
    font-size: 0.95rem;
    color: #aaa;
    margin-bottom: 10px;
    font-weight: normal;
}

.results-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.detection-item {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 6px 12px;
    border-left: 3px solid;
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.85rem;
}

.detection-class {
    font-weight: 600;
}

.detection-conf {
    color: #888;
    font-size: 0.8rem;
}

.no-results {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* Download Section */
.download-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.download-info {
    color: #aaa;
    font-size: 0.95rem;
}

.download-info span {
    color: #00d4ff;
    font-weight: bold;
}

.download-actions {
    display: flex;
    gap: 10px;
}

.download-btn {
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    padding: 10px 20px;
    color: #00d4ff;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.download-btn:hover {
    background: rgba(0, 212, 255, 0.3);
    transform: translateY(-1px);
}

.download-btn.primary {
    background: linear-gradient(90deg, #00d4ff, #7b2cbf);
    border: none;
    color: #fff;
}

.download-btn.primary:hover {
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.4);
}

.download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00d4ff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

/* Utility */
.hidden {
    display: none;
}
