:root {
    /* Kontrol brand palette (based on #179dd9) */
    --primary-color: #179dd9;
    --primary-dark: #0f7fb0;
    --brand-deep: #0b5c82;
    --brand-tint: #e0f4fb;
    --brand-tint-2: #f0fafd;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --border-color: #d9e8f0;
    --text-color: #1e293b;
    --text-light: #52667a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    padding: 20px;
}

/* Company logo chip in headers */
.logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.logo-wrap .logo {
    display: block;
    max-height: 72px;
    width: auto;
    max-width: 100%;
    background: #ffffff;
    padding: 10px 22px;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background: #179dd9;
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1em;
    opacity: 0.95;
}

.admin-link {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.admin-link:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

main {
    flex: 1;
    padding: 40px 30px;
}

footer {
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
    padding: 20px 30px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9em;
}

/* Upload Section */
.upload-section {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.upload-box {
    flex: 1;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
    background: var(--light-bg);
}

.upload-box h2 {
    margin-bottom: 20px;
    color: var(--text-color);
}

.file-input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: white;
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-label:hover {
    background: #e6f3fb;
    border-color: var(--primary-dark);
}

.file-label .icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.file-label .text {
    text-align: center;
}

.file-label strong {
    color: var(--primary-color);
}

.file-label .subtext {
    font-size: 0.9em;
    color: var(--text-light);
    margin-top: 5px;
    display: block;
}

#fileInput {
    display: none;
}

.info-box {
    flex: 1;
    background: var(--brand-tint);
    border-left: 4px solid var(--primary-color);
    padding: 20px;
    border-radius: 8px;
}

.info-box h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1em;
}

.info-box ul {
    list-style: none;
}

.info-box li {
    padding: 8px 0;
    color: var(--text-color);
    font-size: 0.95em;
}

/* Assessment Section */
.assessment-section {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.assessment-header {
    margin-bottom: 30px;
}

.assessment-header h2 {
    margin-bottom: 10px;
}

#jobInfo {
    color: var(--text-light);
    font-size: 0.95em;
}

.progress-container {
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--primary-color));
    transition: width 0.5s ease;
    border-radius: 10px;
}

#progressText {
    text-align: center;
    font-size: 0.9em;
    color: var(--text-light);
}

.status-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--light-bg);
    border-radius: 8px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-label {
    font-weight: 600;
    color: var(--text-color);
}

.status-value {
    color: var(--primary-color);
    font-weight: 600;
}

/* Question Section */
.question-section {
    animation: slideIn 0.3s ease;
}

.question-box {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

.question-box h3 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 1.1em;
    line-height: 1.5;
}

.conversation-history {
    margin-bottom: 20px;
    max-height: 250px;
    overflow-y: auto;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.conversation-history.empty {
    display: none;
}

.message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 6px;
    line-height: 1.5;
}

.message.user {
    background: var(--brand-tint);
    border-left: 4px solid var(--primary-color);
    text-align: left;
}

.message.assistant {
    background: #fff3cd;
    border-left: 4px solid var(--warning-color);
    text-align: left;
}

.message strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color);
    font-size: 0.85em;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1em;
    resize: vertical;
    margin-bottom: 15px;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.follow-up-box {
    background: #fffbf0;
    border: 1px solid var(--warning-color);
    border-left: 4px solid var(--warning-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

.follow-up-box .warning-icon {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.follow-up-box h4 {
    color: var(--warning-color);
    margin-bottom: 10px;
}

.follow-up-box p {
    color: var(--text-color);
    margin: 8px 0;
}

.follow-up-box .subtext {
    font-size: 0.9em;
    color: var(--text-light);
}

/* Partial Answer Box (doc already answered part of question) */
.partial-answer-box {
    background: var(--brand-tint-2);
    border: 1px solid var(--primary-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

.partial-answer-box .partial-answer-icon {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.partial-answer-box h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.partial-answer-box p {
    color: var(--text-color);
    margin: 8px 0;
}

.partial-answer-box .subtext {
    font-size: 0.9em;
    color: var(--text-light);
}

.partial-answer-text {
    background: #ffffff;
    border: 1px solid #d0e6f5;
    border-radius: 6px;
    padding: 14px;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.92em;
    line-height: 1.5;
    color: var(--text-color);
    white-space: pre-wrap;
}

/* Processing Box */
.processing-box {
    text-align: center;
    padding: 40px 20px;
    animation: slideIn 0.3s ease;
}

.spinner {
    border: 4px solid var(--light-bg);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#processingText {
    color: var(--text-light);
}

/* Report Section */
.report-section {
    animation: slideIn 0.3s ease;
}

.report-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.report-header h2 {
    color: var(--success-color);
    margin-bottom: 10px;
}

#reportTimestamp {
    color: var(--text-light);
    font-size: 0.9em;
}

.report-content {
    margin-bottom: 30px;
    line-height: 1.6;
}

.report-content iframe {
    width: 100%;
    height: 800px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 157, 217, 0.3);
}

.btn-outline {
    background: #ffffff;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--brand-tint);
    color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 157, 217, 0.2);
}

/* Reference document links on the assessment home page */
.doc-links-section {
    margin-top: 28px;
}

.doc-links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 18px;
    background: var(--brand-tint-2);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.doc-links .btn {
    min-width: 210px;
    text-align: center;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-large {
    padding: 14px 32px;
    font-size: 1.1em;
    width: 100%;
}

/* Messages */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin-bottom: 15px;
    font-size: 0.95em;
}

.status-message {
    background: #d4edda;
    color: #155724;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #c3e6cb;
    margin-bottom: 15px;
    font-size: 0.95em;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        min-height: auto;
        margin: 20px auto;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 1.8em;
    }

    main {
        padding: 20px;
    }

    .upload-section {
        flex-direction: column;
        gap: 20px;
    }

    .upload-box,
    .info-box {
        padding: 20px;
    }

    .status-info {
        grid-template-columns: 1fr;
    }

    .question-box {
        padding: 15px;
    }

    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .report-content iframe {
        height: 600px;
    }
}
