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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

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

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
}

.card-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.card-body p {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.btn {
    display: block;
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-info {
    background: #3b82f6;
    color: white;
}

.btn-info:hover {
    background: #2563eb;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

#video-info {
    background-color: #ecf0f1;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 0.9em;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: background 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    background: #5568d3;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.slider::-moz-range-thumb:hover {
    background: #5568d3;
}

.slider-value {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
    color: #667eea;
}

/* Input Fields */
.input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.input:focus {
    outline: none;
    border-color: #667eea;
}

select.input {
    cursor: pointer;
    background: white;
}

.slider-container label {
    font-weight: 500;
    color: #666;
    margin-right: 8px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: #333;
    padding: 16px 32px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    transition: bottom 0.3s ease;
    z-index: 1000;
    max-width: 90%;
}

.toast.show {
    bottom: 30px;
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

/* Chat Interface Styles */
.chat-card {
    grid-column: 1 / -1; /* Full width */
}

.chat-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Custom scrollbar for chat messages */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.chat-message {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message-user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: 20%;
    align-self: flex-end;
}

.chat-message-assistant {
    background: white;
    border: 1px solid #e5e7eb;
    margin-right: 20%;
    align-self: flex-start;
}

.chat-message-system {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    margin: 0 auto;
    text-align: center;
    font-size: 0.9em;
}

.chat-message-content {
    line-height: 1.5;
    margin-bottom: 8px;
}

.chat-message-instructions {
    margin-top: 12px;
    border-top: 1px solid #e5e7eb;
    padding-top: 8px;
}

.instructions-toggle {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    color: #374151;
    transition: all 0.2s;
}

.instructions-toggle:hover {
    background: #e5e7eb;
}

.instructions-json {
    margin-top: 8px;
    background: #1e1e1e;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
}

.instructions-json pre {
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.85em;
}

.instructions-json code {
    color: #a8dadc;
}

.chat-input-container {
    display: flex;
    gap: 8px;
}

.chat-input-container input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.chat-input-container input:focus {
    outline: none;
    border-color: #667eea;
}

.chat-input-container button {
    width: auto;
    padding: 12px 32px;
}

.chat-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.chat-actions button {
    width: auto;
    padding: 8px 20px;
    font-size: 0.9rem;
}

.chat-status {
    display: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    text-align: center;
}

.chat-status-processing {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #60a5fa;
}

.chat-status-processing::before {
    content: '⏳ ';
}

.chat-status-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card-body {
        padding: 20px;
    }

    .chat-message-user,
    .chat-message-assistant {
        max-width: 90%;
        margin-left: 0;
        margin-right: 0;
    }

    .chat-messages {
        height: 300px;
    }

    .chat-input-container {
        flex-direction: column;
    }

    .chat-input-container button {
        width: 100%;
    }
}
