:root {
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #3b82f6;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --danger: #ef4444;
    --success: #10b981;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    position: relative;
    overflow-x: hidden;
}

.background-effect {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.15), transparent 40%),
                radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.1), transparent 30%);
    z-index: -1;
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }
}

.glass-effect {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.step-badge {
    background: var(--primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: rgba(0,0,0,0.2);
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-family: inherit;
}

.tab-btn.active {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 0.75rem;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 200px;
    background: rgba(0,0,0,0.1);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

.icon-large {
    font-size: 2.5rem;
    color: var(--primary);
}

.drop-zone span {
    color: var(--primary);
    text-decoration: underline;
}

.preview-container {
    position: relative;
    width: 100%;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #000;
}

.preview-container video, .preview-container img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.preview-container button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.camera-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 0.75rem;
    overflow: hidden;
    height: 200px;
}

#camera-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-controls {
    position: absolute;
    bottom: 1rem;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-danger {
    background: var(--danger);
    color: white;
    padding: 0.75rem 1.5rem;
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: white;
    backdrop-filter: blur(4px);
}

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

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* API Settings */
.action-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

details summary {
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    outline: none;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.input-group input, .input-group select {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    color: white;
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-family: inherit;
    outline: none;
}

.input-group input:focus, .input-group select:focus {
    border-color: var(--primary);
}

/* Loading & Result */
.result-section {
    text-align: center;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

#result-video {
    width: 100%;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    max-height: 400px;
    background: #000;
}
