/* ===== WP AI Interviewer — Chat Frontend v1.2.0 ===== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

.wpaiv-chat-container {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    max-width: 680px;
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 40px rgba(0,0,0,.15);
    background: #0f1117;
    color: #e2e8f0;
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.wpaiv-chat-screen { flex: 1; display: flex; flex-direction: column; }
.wpaiv-hidden { display: none !important; }

.wpaiv-form-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 20px 20px;
}
.wpaiv-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #cbd5e1;
}
.wpaiv-form-group input {
    width: 100%;
    border: 1.5px solid #2d3148;
    border-radius: 12px;
    background: #15172a;
    color: #f1f5f9;
    padding: 12px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.wpaiv-form-group input:focus {
    border-color: var(--wpaiv-accent, #6366f1);
    box-shadow: 0 0 0 3px rgba(var(--wpaiv-primary-rgb, 99,102,241), .15);
}
.wpaiv-form-group input::placeholder { color: #64748b; }
.wpaiv-field-note {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: #64748b;
}

/* ================================================================
   SCREEN 1 — VACANCY SELECT
   ============================================================== */
.wpaiv-chat-hero {
    text-align: center;
    padding: 40px 32px 24px;
}
.wpaiv-chat-avatar {
    font-size: 34px;
    width: 72px; height: 72px;
    background: linear-gradient(135deg,var(--wpaiv-primary-start, #6366f1),var(--wpaiv-primary-end, #8b5cf6));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 0 30px rgba(var(--wpaiv-primary-rgb, 99,102,241), .4);
}
.wpaiv-chat-avatar.has-logo {
    background: #fff;
    padding: 8px;
    overflow: hidden;
}
.wpaiv-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 50%;
}
.wpaiv-avatar-cv { background: linear-gradient(135deg,#0ea5e9,var(--wpaiv-primary-start, #6366f1)); }
.wpaiv-chat-hero h2 { font-size: 22px; font-weight: 700; margin: 0 0 8px; color: #f1f5f9; }
.wpaiv-chat-hero p  { font-size: 14px; color: #94a3b8; margin: 0; line-height: 1.7; }

.wpaiv-vacancy-cards { padding: 0 20px 28px; display: flex; flex-direction: column; gap: 10px; }

.wpaiv-vacancy-card {
    background: #1a1d2e; border: 1.5px solid #2d3148; border-radius: 14px;
    padding: 16px 18px; display: flex; align-items: center; gap: 14px;
    cursor: pointer; transition: all .2s; text-align: left; color: #e2e8f0; width: 100%;
}
.wpaiv-vacancy-card:hover {
    border-color: var(--wpaiv-accent, #6366f1); background: #1e2235;
    transform: translateY(-1px); box-shadow: 0 4px 16px rgba(var(--wpaiv-primary-rgb, 99,102,241), .2);
}
.wpaiv-vc-icon { font-size: 22px; flex-shrink: 0; }
.wpaiv-vc-info { flex: 1; }
.wpaiv-vc-info strong { display: block; font-size: 15px; font-weight: 600; color: #f1f5f9; }
.wpaiv-vc-info span  { font-size: 12px; color: #64748b; }
.wpaiv-vc-arrow { color: var(--wpaiv-accent, #6366f1); font-size: 18px; font-weight: bold; }
.wpaiv-chat-empty { text-align: center; padding: 40px; color: #64748b; font-size: 14px; }

.wpaiv-entry-vacancy {
    margin-top: 8px !important;
    color: var(--wpaiv-accent, #6366f1) !important;
    font-weight: 600;
}
.wpaiv-entry-card {
    margin: 0 20px 24px;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid #2d3148;
    background: #15172a;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}
.wpaiv-entry-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
}
.wpaiv-entry-status-approved,
.wpaiv-entry-status-active { background: rgba(var(--wpaiv-primary-rgb, 99,102,241), .16); color: var(--wpaiv-accent, #6366f1); }
.wpaiv-entry-status-completed { background: rgba(16,185,129,.18); color: #6ee7b7; }
.wpaiv-entry-status-pending_review { background: rgba(245,158,11,.16); color: #fbbf24; }
.wpaiv-entry-status-rejected { background: rgba(239,68,68,.14); color: #fca5a5; }
.wpaiv-entry-file {
    font-size: 13px;
    color: #cbd5e1;
}
.wpaiv-entry-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.wpaiv-entry-error {
    font-size: 12px;
    color: #fca5a5;
}
.wpaiv-pending-profile-box {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    background: rgba(var(--wpaiv-primary-rgb, 99,102,241), .08);
    border: 1px solid rgba(var(--wpaiv-primary-rgb, 99,102,241), .18);
}
.wpaiv-pending-profile-box strong {
    display: block;
    color: #f8fafc;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
}
.wpaiv-pending-profile-box p {
    margin: 0;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.7;
}
.wpaiv-pending-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 14px;
}

/* ================================================================
   SCREEN 2 — CV UPLOAD
   ============================================================== */
.wpaiv-cv-upload-area {
    margin: 0 20px;
    position: relative;
}
#wpaiv-cv-file { display: none; }

.wpaiv-dropzone-inner {
    border: 2px dashed #2d3148; border-radius: 16px;
    padding: 40px 24px; text-align: center; transition: all .2s;
    cursor: pointer;
}
.wpaiv-dropzone-inner:hover,
.wpaiv-cv-upload-area.drag-over .wpaiv-dropzone-inner {
    border-color: var(--wpaiv-accent, #6366f1); background: #15172a;
}
.wpaiv-dropzone-icon {
    font-size: 36px; display: block; margin-bottom: 12px; color: var(--wpaiv-accent, #6366f1);
}
.wpaiv-dropzone-label { font-size: 14px; color: #94a3b8; margin: 0 0 6px; }
.wpaiv-dropzone-link  { color: var(--wpaiv-accent, #6366f1); cursor: pointer; text-decoration: underline; }
.wpaiv-dropzone-hint  { font-size: 12px; color: #475569; margin: 0; }
.wpaiv-dropzone-error { font-size: 12px; color: #f87171; margin: 10px 0 0; }

.wpaiv-dropzone-selected {
    border: 1.5px solid #10b981; border-radius: 16px;
    padding: 16px 20px; display: flex; align-items: center; gap: 10px;
    background: #0d1f19; color: #34d399; font-size: 14px;
}
.wpaiv-file-icon { font-size: 22px; flex-shrink: 0; }
.wpaiv-dropzone-selected span:nth-child(2) { flex: 1; word-break: break-all; }
#wpaiv-cv-remove {
    background: none; border: none; color: #6b7280; cursor: pointer;
    font-size: 16px; padding: 4px; transition: color .15s;
}
#wpaiv-cv-remove:hover { color: #ef4444; }

/* Uploading state */
.wpaiv-cv-uploading {
    display: flex; flex-direction: column; align-items: center;
    gap: 16px; padding: 32px 20px; text-align: center;
}
.wpaiv-upload-spinner {
    width: 48px; height: 48px; border-radius: 50%;
    border: 3px solid #1e2235; border-top-color: var(--wpaiv-accent, #6366f1);
    animation: wpaiv-spin .8s linear infinite;
}
.wpaiv-upload-steps { font-size: 14px; color: #94a3b8; min-height: 24px; }

/* CV screen actions */
.wpaiv-cv-screen-actions {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px; gap: 12px; margin-top: auto;
}

/* ================================================================
   SCREEN 3 — CHAT
   ============================================================== */
.wpaiv-chat-topbar {
    background: #131621; border-bottom: 1px solid #1e2235;
    padding: 14px 20px; display: flex; align-items: center; justify-content: space-between;
}
.wpaiv-chat-topbar-info { display: flex; align-items: center; gap: 10px; }
.wpaiv-chat-brand {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg,var(--wpaiv-primary-start, #6366f1),var(--wpaiv-primary-end, #8b5cf6));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wpaiv-text-on-primary, #ffffff);
    font-size: 18px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.wpaiv-chat-brand.has-logo {
    background: #fff;
    padding: 4px;
}
.wpaiv-chat-brand img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 50%;
}
.wpaiv-online-dot {
    width: 10px; height: 10px; background: #10b981; border-radius: 50%;
    box-shadow: 0 0 8px rgba(16,185,129,.6);
    flex-shrink: 0;
    position: absolute;
    right: 1px;
    bottom: 1px;
    border: 2px solid #131621;
}
.wpaiv-chat-topbar-info strong { display: block; font-size: 14px; font-weight: 600; color: #f1f5f9; }
.wpaiv-chat-topbar-info span  { font-size: 11px; color: var(--wpaiv-accent, #6366f1); }
.wpaiv-topbar-actions { display: flex; align-items: center; gap: 8px; }

.wpaiv-cv-topbadge {
    font-size: 11px; color: #34d399; background: #0d1f19;
    border: 1px solid #134e35; border-radius: 20px; padding: 4px 10px;
    display: flex; align-items: center; gap: 4px; max-width: 140px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

#wpaiv-restart-btn {
    background: none; border: 1px solid #2d3148; color: #94a3b8;
    border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 14px; transition: all .2s;
}
#wpaiv-restart-btn:hover { border-color: var(--wpaiv-accent, #6366f1); color: var(--wpaiv-accent, #6366f1); }

/* Messages */
.wpaiv-messages {
    flex: 1; overflow-y: auto; padding: 20px 20px 10px;
    display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth;
}
.wpaiv-messages::-webkit-scrollbar { width: 4px; }
.wpaiv-messages::-webkit-scrollbar-track { background: transparent; }
.wpaiv-messages::-webkit-scrollbar-thumb { background: #2d3148; border-radius: 4px; }

.wpaiv-msg { display: flex; flex-direction: column; max-width: 78%; animation: wpaiv-fadein .25s ease; }
.wpaiv-msg-assistant { align-self: flex-start; }
.wpaiv-msg-user      { align-self: flex-end; }

.wpaiv-msg-bubble { padding: 12px 16px; border-radius: 18px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.wpaiv-msg-assistant .wpaiv-msg-bubble {
    background: #1a1d2e; border: 1px solid #2d3148; border-bottom-left-radius: 4px; color: #e2e8f0;
}
.wpaiv-msg-user .wpaiv-msg-bubble {
    background: linear-gradient(135deg,var(--wpaiv-primary-start, #6366f1),var(--wpaiv-primary-end, #8b5cf6));
    border-bottom-right-radius: 4px;
    color: var(--wpaiv-text-on-primary, #ffffff);
}
.wpaiv-msg-time { font-size: 11px; color: #475569; margin-top: 4px; padding: 0 4px; }
.wpaiv-msg-user .wpaiv-msg-time { text-align: right; }

/* Typing indicator */
.wpaiv-typing-indicator { display: flex; gap: 5px; padding: 0 24px 10px; }
.wpaiv-typing-indicator span {
    width: 8px; height: 8px; background: #4b5563; border-radius: 50%;
    animation: wpaiv-bounce .9s infinite;
}
.wpaiv-typing-indicator span:nth-child(2) { animation-delay: .15s; }
.wpaiv-typing-indicator span:nth-child(3) { animation-delay: .3s; }

/* Input area */
.wpaiv-chat-input-area {
    display: flex; gap: 10px; padding: 14px 16px;
    background: #131621; border-top: 1px solid #1e2235; align-items: flex-end;
}
#wpaiv-input {
    flex: 1; background: #1a1d2e; border: 1.5px solid #2d3148; border-radius: 12px;
    color: #e2e8f0; font-family: inherit; font-size: 14px; padding: 11px 14px;
    resize: none; outline: none; transition: border-color .2s; line-height: 1.5;
    max-height: 120px; overflow-y: auto;
}
#wpaiv-input:focus { border-color: var(--wpaiv-accent, #6366f1); }
#wpaiv-input::placeholder { color: #475569; }

#wpaiv-send-btn {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    background: linear-gradient(135deg,var(--wpaiv-primary-start, #6366f1),var(--wpaiv-primary-end, #8b5cf6)); border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: transform .15s, box-shadow .15s;
}
#wpaiv-send-btn:hover { transform: scale(1.05); box-shadow: 0 4px 14px rgba(var(--wpaiv-primary-rgb, 99,102,241), .4); }
#wpaiv-send-btn svg { width: 18px; height: 18px; color: var(--wpaiv-text-on-primary, #ffffff); }
#wpaiv-send-btn:disabled { opacity: .5; cursor: default; transform: none; }

/* Ended */
.wpaiv-chat-ended {
    padding: 14px 20px; background: #0d1f19; border-top: 1px solid #134e35;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13px; color: #34d399; gap: 12px; flex-wrap: wrap;
}
.wpaiv-btn-outline {
    background: transparent; border: 1.5px solid var(--wpaiv-accent, #6366f1); color: var(--wpaiv-accent, #6366f1);
    padding: 7px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all .2s;
}
.wpaiv-btn-outline:hover { background: var(--wpaiv-accent, #6366f1); color: var(--wpaiv-text-on-primary, #ffffff); }

/* Shared buttons */
.wpaiv-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px; border-radius: 10px; font-size: 14px; font-weight: 600;
    cursor: pointer; border: none; transition: all .2s; font-family: inherit; text-decoration: none;
}
.wpaiv-btn-primary {
    background: linear-gradient(135deg,var(--wpaiv-primary-start, #6366f1),var(--wpaiv-primary-end, #8b5cf6));
    color: var(--wpaiv-text-on-primary, #ffffff);
    box-shadow: 0 2px 8px rgba(var(--wpaiv-primary-rgb, 99,102,241), .3);
}
.wpaiv-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(var(--wpaiv-primary-rgb, 99,102,241), .4); color: var(--wpaiv-text-on-primary, #ffffff); }
.wpaiv-btn-primary:disabled { opacity: .45; transform: none; cursor: not-allowed; }
.wpaiv-btn-ghost { background: #1a1d2e; color: #94a3b8; border: 1px solid #2d3148; }
.wpaiv-btn-ghost:hover { border-color: var(--wpaiv-accent, #6366f1); color: var(--wpaiv-accent, #6366f1); }

/* ================================================================
   ANIMATIONS
   ============================================================== */
@keyframes wpaiv-fadein  { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
@keyframes wpaiv-bounce  { 0%,80%,100% { transform:translateY(0); } 40% { transform:translateY(-6px); } }
@keyframes wpaiv-spin    { to { transform:rotate(360deg); } }

/* Responsive */
@media (max-width: 480px) {
    .wpaiv-chat-container { border-radius: 12px; }
    .wpaiv-msg { max-width: 90%; }
    .wpaiv-cv-screen-actions { flex-direction: column; }
    .wpaiv-cv-screen-actions .wpaiv-btn { width: 100%; justify-content: center; }
    .wpaiv-entry-card { margin: 0 16px 20px; }
}
