/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Header */
header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #667eea;
    font-size: 1.5rem;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.card h2 {
    color: #333;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group.checkbox label {
    display: flex;
    align-items: center;
    font-weight: normal;
}

.form-group.checkbox input {
    width: auto;
    margin-right: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f7fafc;
}

.drop-zone:hover {
    border-color: #667eea;
    background: #edf2ff;
}

.drop-zone.active {
    border-color: #667eea;
    background: #edf2ff;
}

.drop-zone p {
    margin: 0.5rem 0;
    color: #718096;
}

.drop-zone p.small {
    font-size: 0.875rem;
    color: #a0aec0;
}

/* Image Preview */
.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.image-preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.3s;
}

.image-preview-item .remove-btn:hover {
    background: #f56565;
    color: white;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-box {
    background: white;
    border-radius: 8px;
    padding: 2.5rem 2rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.login-box h1 {
    color: #667eea;
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.login-box .subtitle {
    text-align: center;
    color: #718096;
    margin-bottom: 2rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    margin-top: 1rem;
    font-size: 1.1rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: #333;
}

.modal-content video,
.modal-content img {
    max-width: 100%;
    max-height: 50vh;
    width: auto;
    height: auto;
    border-radius: 4px;
    margin: 0 auto 1rem;
    display: block;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.camera-info,
.preview-info {
    text-align: center;
    color: #718096;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

#previewImage {
    object-fit: contain;
}

/* Result Table */
.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.result-table th,
.result-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.result-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
}

.result-table tr:hover {
    background: #f7fafc;
}

/* JSON Editor */
#jsonTextarea {
    width: 100%;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    padding: 1rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    background: #f7fafc;
    margin-top: 1rem;
}

/* Error and Success Messages */
.error-message,
.success-message {
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 1rem;
    text-align: center;
}

.error-message {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.success-message {
    background: #c6f6d5;
    color: #276749;
    border: 1px solid #9ae6b4;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-block;
}

.status-success {
    background: #c6f6d5;
    color: #276749;
}

.status-error, .status-failed {
    background: #fed7d7;
    color: #c53030;
}

.status-warning, .status-processing {
    background: #fef3c7;
    color: #92400e;
}

.status-secondary, .status-discarded {
    background: #e2e8f0;
    color: #475569;
}

.status-default {
    background: #f3f4f6;
    color: #6b7280;
}

/* Small Button */
.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Session Details */
.session-details h4 {
    color: #667eea;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.session-details h4:first-child {
    margin-top: 0;
}

.error-text {
    color: #c53030;
}

/* Pagination Controls */
#paginationControls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

/* Capture Feedback Bubble */
.capture-bubble {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #48bb78;
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 2000;
    animation: bubbleIn 0.3s ease-out;
}

.capture-bubble.fade-out {
    animation: bubbleOut 0.3s ease-in;
    opacity: 0;
}

@keyframes bubbleIn {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes bubbleOut {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem 1rem;
    }
    
    .card {
        padding: 1.5rem 1rem;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .image-preview {
        justify-content: center;
    }
}