/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #e0e7ff 0%, #f0f4ff 100%);
    min-height: 100vh;
    padding: 20px;
    color: #1e293b;
}

.container {
    max-width: 820px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    padding: 30px 20px 20px;
    color: #1e293b;
}

header h1 {
    font-size: 2.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header .subtitle {
    font-size: 1.1rem;
    color: #475569;
    margin-top: 6px;
    -webkit-text-fill-color: #475569;
}

/* Card */
.card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(4px);
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
}

/* Form Elements */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
    background: #f8fafc;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    background: white;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.7;
}

/* Word Counter */
.char-counter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 6px;
    gap: 12px;
}

#word-counter {
    font-weight: 600;
    min-width: 80px;
}

#word-counter.limit-warning {
    color: #dc2626;
}

#word-counter.limit-ok {
    color: #16a34a;
}

.progress-container {
    flex: 1;
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

#word-progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
    background: #4f46e5;
}

#word-progress-bar.warning {
    background: #f97316;
}

#word-progress-bar.danger {
    background: #dc2626;
}

#word-limit-warning {
    color: #dc2626;
    font-size: 0.85rem;
    margin-top: 4px;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 12px 28px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.45);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f1f5f9;
    color: #334155;
}

.btn-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

/* Badge */
.badge {
    background: #e0e7ff;
    color: #4f46e5;
    padding: 4px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.exam-header {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

/* Question */
.question-box {
    background: #f8fafc;
    padding: 18px 22px;
    border-radius: 14px;
    border-left: 5px solid #4f46e5;
    margin-bottom: 20px;
}

.question-box h3 {
    color: #1e293b;
    margin-bottom: 8px;
}

.question-box p {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #334155;
}

.hint {
    margin-top: 10px;
    color: #64748b;
}

/* Question Keywords */
.question-keywords {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f0f9ff;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.question-keywords h4 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: #1e40af;
}

.keyword-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.keyword-tag-specific {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
    transition: all 0.3s ease;
}

.keyword-tag-specific.found {
    background: #dcfce7;
    color: #16a34a;
    border-color: #86efac;
}

.keyword-tag-specific.missing {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

/* Result */
.result-card {
    border-top: 5px solid #4f46e5;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.result-item {
    background: #f8fafc;
    padding: 16px;
    border-radius: 14px;
    text-align: center;
}

.result-item .label {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.result-item .score {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-top: 4px;
}

.score.high {
    color: #16a34a;
}
.score.medium {
    color: #eab308;
}
.score.low {
    color: #dc2626;
}

.badge-status {
    display: inline-block;
    padding: 4px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.badge-status.lulus {
    background: #dcfce7;
    color: #16a34a;
}
.badge-status.tidak-lulus {
    background: #fee2e2;
    color: #dc2626;
}

.feedback-box {
    background: #f8fafc;
    padding: 20px 24px;
    border-radius: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    font-size: 0.98rem;
    border: 1px solid #e2e8f0;
    max-height: 500px;
    overflow-y: auto;
}

.feedback-box h4 {
    margin-top: 12px;
    color: #1e293b;
}
.feedback-box h4:first-child {
    margin-top: 0;
}
.feedback-box ul {
    margin-left: 20px;
    margin-bottom: 10px;
}

/* Penalty Badge */
.penalty-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    background: #fee2e2;
    color: #dc2626;
}

/* Footer */
footer {
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
    padding: 20px 0 10px;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 0 6px;
    }
    .card {
        padding: 18px;
    }
    header h1 {
        font-size: 1.8rem;
    }
    .result-grid {
        grid-template-columns: 1fr 1fr;
    }
    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    .char-counter {
        flex-direction: column;
        gap: 6px;
    }
    .keyword-tags-container {
        gap: 4px;
    }
    .keyword-tag-specific {
        font-size: 0.75rem;
        padding: 2px 10px;
    }
    .exam-header {
        gap: 6px;
    }
    .exam-header .badge {
        font-size: 0.7rem;
        padding: 2px 8px;
    }
}

/* Keyword Section - Tambahan */
.keyword-section {
    margin-top: 15px;
    padding: 16px 18px;
    background: #f0f9ff;
    border-radius: 12px;
    border-left: 4px solid #3b82f6;
}

.keyword-section h4 {
    margin: 0 0 10px 0;
    color: #1e40af;
    font-size: 0.95rem;
}

.keyword-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.keyword-stat-item {
    background: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
}

.keyword-stat-item.found {
    background: #dcfce7;
    color: #16a34a;
}

.keyword-stat-item.missing {
    background: #fee2e2;
    color: #dc2626;
}

.keyword-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.keyword-tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #e2e8f0;
    color: #475569;
}

.keyword-tag.found {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #86efac;
}

.keyword-tag.missing {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.keyword-tag.extra {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.keyword-tag.reference {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.keyword-progress {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.keyword-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}

.keyword-detail-toggle {
    background: none;
    border: none;
    color: #4f46e5;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 6px;
    text-decoration: underline;
}

.keyword-detail-toggle:hover {
    color: #7c3aed;
}

.keyword-detail-hidden {
    display: none;
}

/* Ollama Status */
.ollama-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

.ollama-status.online {
    background: #dcfce7;
    color: #16a34a;
}

.ollama-status.offline {
    background: #fee2e2;
    color: #dc2626;
}

.ollama-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.ollama-status.online .dot {
    background: #16a34a;
    animation: pulse 1.5s ease-in-out infinite;
}

.ollama-status.offline .dot {
    background: #dc2626;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.ai-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #4f46e5;
    color: white;
    margin-left: 8px;
}

.feedback-box.ollama-mode {
    border-left: 4px solid #4f46e5;
}

.feedback-box.fallback-mode {
    border-left: 4px solid #eab308;
}

.model-info {
    margin-top: 12px;
    font-size: 0.85rem;
    color: #94a3b8;
    text-align: right;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.model-info .ollama {
    color: #4f46e5;
}

.model-info .sbert {
    color: #16a34a;
}

/* Penalty Info */
.penalty-info {
    margin-top: 8px;
    padding: 10px 14px;
    background: #fee2e2;
    border-radius: 8px;
    border-left: 4px solid #dc2626;
}

.penalty-info strong {
    color: #dc2626;
}

.penalty-info ul {
    margin-left: 20px;
    color: #64748b;
    font-size: 0.85rem;
}

/* Scrollbar */
.feedback-box::-webkit-scrollbar {
    width: 6px;
}

.feedback-box::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.feedback-box::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.feedback-box::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}