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

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

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

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

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Job Description Setup Section */
.jd-setup-section {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
    display: block;
}

.jd-setup-section.hidden {
    display: none;
}

.jd-setup-content h2 {
    color: #1f2937;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.jd-setup-content p {
    color: #6b7280;
    margin-bottom: 20px;
    line-height: 1.6;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
}

.input-group textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

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

#jdSetupInput {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 20px;
}

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

.jd-setup-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.main-content.hidden {
    display: none;
}

@media (max-width: 968px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.video-section {
    position: relative;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

#webcam {
    width: 100%;
    height: 100%;
    min-height: 400px;
    object-fit: cover;
}

.recording-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    display: none;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.recording-indicator.active {
    display: flex;
}

.pulse {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.question-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.progress-bar {
    background: #e5e7eb;
    height: 30px;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

#progressText {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: #333;
    z-index: 1;
}

.question-container {
    min-height: 120px;
}

#currentQuestion {
    font-size: 1.5rem;
    color: #1f2937;
    margin-bottom: 15px;
    line-height: 1.5;
}

.question-timer {
    font-size: 1.2rem;
    color: #6b7280;
    font-weight: 500;
}

.jd-section {
    padding: 20px;
    background: #f9fafb;
    border-radius: 10px;
}

.jd-section h2 {
    margin-bottom: 10px;
    color: #1f2937;
}

.jd-section p {
    margin-bottom: 15px;
    color: #6b7280;
}

#jdInput {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
}

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

.transcript-section {
    background: #f9fafb;
    padding: 20px;
    border-radius: 10px;
}

.transcript-section h3 {
    margin-bottom: 10px;
    color: #1f2937;
}

.transcript {
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    line-height: 1.6;
    color: #374151;
}

.transcript.interim {
    color: #9ca3af;
    font-style: italic;
}

.feedback-section {
    background: #fef3c7;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #f59e0b;
    max-height: 80vh;
    overflow-y: auto;
}

.feedback-section h3 {
    margin-bottom: 10px;
    color: #92400e;
}

.feedback {
    color: #78350f;
    line-height: 1.6;
}

.feedback ul {
    margin-left: 20px;
    margin-top: 10px;
}

.feedback li {
    margin-bottom: 8px;
}

/* Responsive grid for comparison view */
@media (max-width: 768px) {
    .feedback div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* Smooth scrolling for feedback section */
.feedback-section::-webkit-scrollbar {
    width: 8px;
}

.feedback-section::-webkit-scrollbar-track {
    background: #fef3c7;
    border-radius: 10px;
}

.feedback-section::-webkit-scrollbar-thumb {
    background: #f59e0b;
    border-radius: 10px;
}

.feedback-section::-webkit-scrollbar-thumb:hover {
    background: #d97706;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #10b981;
    color: white;
}

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

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

.history-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.history-section h2 {
    margin-bottom: 20px;
    color: #1f2937;
}

#responseHistory {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.response-item {
    background: #f9fafb;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.response-item h3 {
    color: #1f2937;
    margin-bottom: 10px;
}

.response-item .response-text {
    color: #4b5563;
    margin-bottom: 10px;
    line-height: 1.6;
}

.response-item .response-feedback {
    background: #fef3c7;
    padding: 15px;
    border-radius: 8px;
    color: #78350f;
    margin-top: 10px;
}

#restartBtn {
    margin-top: 20px;
    width: 100%;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #dc2626;
}

.success-message {
    background: #d1fae5;
    color: #065f46;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #10b981;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover,
.close:focus {
    color: #000;
}

.modal h2 {
    color: #1f2937;
    margin-bottom: 10px;
}

.modal p {
    color: #6b7280;
    margin-bottom: 20px;
}

.api-config {
    margin-bottom: 30px;
}

.api-config label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
}

.api-config input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-family: monospace;
    margin-bottom: 8px;
}

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

.api-config small {
    display: block;
    color: #6b7280;
    margin-bottom: 15px;
    font-size: 0.875rem;
}

.api-config .btn {
    margin-right: 10px;
    margin-top: 10px;
}

.api-status {
    min-height: 20px;
    margin: 10px 0;
}

.api-info {
    background: #f9fafb;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.api-info h3 {
    color: #1f2937;
    margin-bottom: 10px;
}

.api-info ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.api-info li {
    margin-bottom: 8px;
    color: #374151;
}

.api-info a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.api-info a:hover {
    text-decoration: underline;
}

/* AI Processing Indicator */
.ai-processing {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #ede9fe;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #7c3aed;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 4px solid #e9d5ff;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#processingText {
    color: #5b21b6;
    font-weight: 600;
}
