/* ==================== GLOBAL STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* ==================== HEADER ==================== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    display: flex;
    gap: 20px;
    padding: 30px;
}

.camera-section {
    flex: 2;
}

.results-section {
    flex: 1;
    min-width: 300px;
}

h2 {
    color: #1f2937;
    margin-bottom: 20px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ==================== VIDEO CONTAINER ==================== */
.video-container {
    position: relative;
    width: 100%;
    height: 600px;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.video-container video,
.video-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#result {
    display: none;
}

/* ==================== CONTROLS ==================== */
.controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-gallery {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* ==================== STATS GRID ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ==================== OBJECTS LIST ==================== */
.objects-list {
    background: #f9fafb;
    border-radius: 15px;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.object-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.object-name {
    font-weight: 600;
    color: #1f2937;
    flex: 1;
}

.object-confidence {
    background: #6366f1;
    color: white;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ==================== FOOTER ==================== */
.footer {
    background: #1f2937;
    color: white;
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
}

/* ==================== MOBILE RESPONSIVE ==================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 15px;
    }

    .header {
        padding: 20px 15px;
    }

    .header h1 {
        font-size: 1.5rem !important;
        line-height: 1.3;
        word-break: break-word;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .status-badge {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .main-content {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .camera-section,
    .results-section {
        width: 100% !important;
        max-width: 100% !important;
        min-width: unset;
    }

    .video-container {
        height: auto !important;
        min-height: 250px;
        max-height: 400px;
    }

    .video-container video,
    .video-container img {
        width: 100% !important;
        height: auto !important;
        max-height: 400px;
        object-fit: contain;
    }

    .controls {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .controls .btn,
    .controls a.btn {
        width: 100% !important;
        min-width: unset !important;
        padding: 14px 20px;
        font-size: 1rem;
        justify-content: center;
        text-align: center;
    }

    .confidence-control {
        padding: 0 10px;
    }

    .confidence-control input[type="range"] {
        width: 100% !important;
        max-width: 100% !important;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 1.8rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    .objects-list {
        max-height: 300px;
        padding: 15px;
    }

    .object-item {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    h2 {
        font-size: 1.2rem !important;
    }

    .footer {
        padding: 15px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.2rem !important;
    }

    .controls .btn {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .video-container {
        max-height: 300px;
    }

    .main-content {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .camera-section {
        width: 60% !important;
    }

    .results-section {
        width: 38% !important;
    }
}

@media (pointer: coarse) {
    .btn {
        min-height: 48px;
        font-size: 1rem;
    }

    input[type="range"] {
        height: 40px;
        cursor: pointer;
    }
}

/* ==================== SCROLLBAR STYLING ==================== */
.objects-list::-webkit-scrollbar {
    width: 8px;
}

.objects-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.objects-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.objects-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}
