/* =========================================================================
   CV Chat – Styles
   ========================================================================= */

/* Layout */
.cvchat-page { background: #f5f7fa; min-height: 100vh; }

.cvchat-container {
    display: flex;
    gap: 0;
    max-width: 1100px;
    margin: 0 auto;
    height: min(820px, calc(100vh - 180px));
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 24px rgba(0,0,0,.07);
    overflow: hidden;
}
.cvchat-demo-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    pointer-events: none;
}

/* Sidebar */
.cvchat-sidebar {
    width: 280px;
    min-width: 280px;
    background: linear-gradient(180deg, #f8f9fb 0%, #fff 100%);
    border-right: 1px solid #e9ecef;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.cvchat-photo-area {
    text-align: center;
}
.cvchat-photo-circle {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: #e9ecef;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px dashed #ced4da;
    transition: border-color .2s;
    cursor: pointer;
    position: relative;
}
.cvchat-photo-circle:hover { border-color: var(--pcv-primary, #4361ee); }
.cvchat-photo-pulse {
    animation: photoPulse 1.5s ease-in-out infinite;
    border-color: #f59e0b !important;
}
@keyframes photoPulse {
    0%   { box-shadow: 0 0 0 0 rgba(245,158,11,.5); }
    50%  { box-shadow: 0 0 0 12px rgba(245,158,11,0); }
    100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); }
}
.cvchat-photo-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cvchat-photo-circle .cvchat-photo-placeholder {
    color: #adb5bd;
    font-size: 2rem;
}
.cvchat-photo-btn {
    font-size: .82rem;
    color: var(--pcv-primary, #4361ee);
    cursor: pointer;
    font-weight: 500;
}
.cvchat-photo-btn:hover { text-decoration: underline; }

/* Progress */
.cvchat-progress-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.cvchat-progress-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: .85rem;
    color: #6c757d;
    transition: all .2s;
}
.cvchat-progress-list li.active {
    background: rgba(67,97,238,.08);
    color: var(--pcv-primary, #4361ee);
    font-weight: 600;
}
.cvchat-progress-list li.completed {
    color: #198754;
}
.cvchat-progress-list li .step-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    background: #e9ecef;
    color: #6c757d;
    flex-shrink: 0;
}
.cvchat-progress-list li.active .step-icon {
    background: var(--pcv-primary, #4361ee);
    color: #fff;
}
.cvchat-progress-list li.completed .step-icon {
    background: #198754;
    color: #fff;
}
.cvchat-progress-list li.completed {
    cursor: pointer;
}
.cvchat-progress-list li.completed:hover {
    background: rgba(25,135,84,.08);
    color: #146c43;
}

/* Navigation separator in chat */
.cvchat-nav-separator {
    text-align: center;
    margin: 16px 0;
    position: relative;
}
.cvchat-nav-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #dee2e6;
}
.cvchat-nav-separator span {
    position: relative;
    background: #fff;
    padding: 2px 14px;
    font-size: .75rem;
    color: #6c757d;
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

/* Template selector in sidebar */
.cvchat-template-select {
    margin-top: auto;
}
.cvchat-template-select label {
    font-size: .8rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
    display: block;
}
.cvchat-template-select select {
    width: 100%;
    font-size: .82rem;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}
.cvchat-form-link {
    display: block;
    text-align: center;
    font-size: .8rem;
    color: #6c757d;
    margin-top: 8px;
}
.cvchat-form-link:hover { color: var(--pcv-primary, #4361ee); }

/* Chat area */
.cvchat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cvchat-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}
.cvchat-header-info {
    flex: 1;
    min-width: 0;
}
.cvchat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pcv-primary, #4361ee), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.cvchat-header-info h6 {
    margin: 0;
    font-size: .92rem;
    font-weight: 600;
}
.cvchat-header-info small {
    color: #6c757d;
    font-size: .78rem;
}
.cvchat-reset-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #f8f9fa, #fff);
    border: none;
    color: #9ca3af;
    font-size: .72rem;
    font-weight: 500;
    letter-spacing: .02em;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all .2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.cvchat-reset-btn i {
    font-size: .72rem;
    transition: transform .3s ease;
}
.cvchat-reset-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}
.cvchat-reset-btn:hover i {
    transform: rotate(-180deg);
}
.cvchat-reset-btn:active {
    transform: scale(.96);
}

/* Messages */
.cvchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cvchat-msg {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: chatFadeIn .3s ease;
}
@keyframes chatFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.cvchat-msg--bot { align-self: flex-start; }
.cvchat-msg--user { align-self: flex-end; flex-direction: row-reverse; }

.cvchat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .82rem;
}
.cvchat-msg--bot .cvchat-msg-avatar {
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cvchat-msg--user .cvchat-msg-avatar {
    background: #e9ecef;
    color: #495057;
}

.cvchat-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: .9rem;
    line-height: 1.55;
}
.cvchat-msg--bot .cvchat-msg-bubble {
    background: #f0f2f5;
    color: #212529;
    border-bottom-left-radius: 4px;
}
.cvchat-msg--user .cvchat-msg-bubble {
    background: var(--pcv-primary, #4361ee);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Quick reply buttons (job templates, options) */
.cvchat-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.cvchat-quick-btn {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid #dee2e6;
    background: #fff;
    font-size: .82rem;
    color: #495057;
    cursor: pointer;
    transition: all .2s;
    text-align: left;
}
.cvchat-quick-btn:hover {
    border-color: var(--pcv-primary, #4361ee);
    color: var(--pcv-primary, #4361ee);
    background: rgba(67,97,238,.04);
}
.cvchat-quick-btn.selected {
    border-color: var(--pcv-primary, #4361ee);
    background: rgba(67,97,238,.1);
    color: var(--pcv-primary, #4361ee);
    font-weight: 500;
}

/* Typing indicator */
.cvchat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #f0f2f5;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}
.cvchat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #adb5bd;
    animation: typingDot 1.2s infinite;
}
.cvchat-typing span:nth-child(2) { animation-delay: .2s; }
.cvchat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typingDot {
    0%,60%,100% { opacity: .3; transform: scale(.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* AI Thinking indicator */
.cvchat-ai-thinking-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #f0f2f5 0%, #e8edf5 100%);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    min-width: 240px;
    border: 1px solid rgba(67,97,238,.12);
    animation: aiPulse 2s ease-in-out infinite;
}
.cvchat-ai-brain {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pcv-primary, #4361ee), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
    animation: aiSpin 3s linear infinite;
}
.cvchat-ai-thinking-text {
    font-size: .85rem;
    color: #495057;
    font-weight: 500;
    flex: 1;
}
.cvchat-ai-dots {
    display: flex;
    gap: 3px;
    align-items: center;
}
.cvchat-ai-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pcv-primary, #4361ee);
    animation: aiDot 1.4s ease-in-out infinite;
}
.cvchat-ai-dots span:nth-child(2) { animation-delay: .2s; }
.cvchat-ai-dots span:nth-child(3) { animation-delay: .4s; }
.cvchat-ai-dots span:nth-child(4) { animation-delay: .6s; }

@keyframes aiPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(67,97,238,.08); }
    50% { box-shadow: 0 0 0 8px rgba(67,97,238,.04); }
}
@keyframes aiSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes aiDot {
    0%, 80%, 100% { opacity: .3; transform: scale(.7); }
    40% { opacity: 1; transform: scale(1.1); }
}

/* Input area */
.cvchat-input-area {
    padding: 16px 24px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.cvchat-input-area input[type="text"],
.cvchat-input-area textarea {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: .9rem;
    resize: none;
    outline: none;
    transition: border-color .2s;
    min-height: 42px;
    max-height: 100px;
    font-family: inherit;
}
.cvchat-input-area input[type="text"]:focus,
.cvchat-input-area textarea:focus {
    border-color: var(--pcv-primary, #4361ee);
}
.cvchat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--pcv-primary, #4361ee);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.cvchat-send-btn:hover { background: #3a56d4; }
.cvchat-send-btn:disabled { background: #adb5bd; cursor: not-allowed; }
.cvchat-skip-btn {
    font-size: .8rem;
    color: #6c757d;
    cursor: pointer;
    padding: 4px 8px;
    align-self: center;
}
.cvchat-skip-btn:hover { color: var(--pcv-primary, #4361ee); }

/* Review summary card */
.cvchat-review {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    font-size: .85rem;
    line-height: 1.6;
}
.cvchat-review h6 {
    font-size: .88rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--pcv-primary, #4361ee);
}
.cvchat-review dl {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 4px 12px;
    margin: 0;
}
.cvchat-review dt { font-weight: 600; color: #495057; }
.cvchat-review dd { margin: 0; color: #212529; }

/* Template recommendation cards */
.cvchat-tpl-cards {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
}
.cvchat-tpl-card {
    flex: 0 0 130px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all .25s;
    background: #fff;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
}
.cvchat-tpl-card:hover {
    border-color: var(--pcv-primary, #4361ee);
    box-shadow: 0 4px 16px rgba(67,97,238,.15);
    transform: translateY(-2px);
}
.cvchat-tpl-card--selected {
    border-color: var(--pcv-primary, #4361ee) !important;
    box-shadow: 0 0 0 3px rgba(67,97,238,.2);
}
.cvchat-tpl-card--selected .cvchat-tpl-select-btn {
    background: var(--pcv-primary, #4361ee);
    color: #fff;
}
.cvchat-tpl-thumb {
    height: 100px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.cvchat-tpl-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}
.cvchat-tpl-info {
    padding: 8px 10px 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}
.cvchat-tpl-name {
    font-size: .78rem;
    font-weight: 600;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cvchat-tpl-badge {
    font-size: .65rem;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
    width: fit-content;
}
.cvchat-tpl-badge--free {
    background: #d1fae5;
    color: #065f46;
}
.cvchat-tpl-badge--premium {
    background: #fef3c7;
    color: #92400e;
}
.cvchat-tpl-select-btn {
    display: block;
    width: 100%;
    padding: 6px;
    border: none;
    background: #f0f2f5;
    color: #495057;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    text-align: center;
}
.cvchat-tpl-select-btn:hover {
    background: var(--pcv-primary, #4361ee);
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .cvchat-container {
        flex-direction: column;
        border-radius: 0;
        height: auto;
        min-height: 100vh;
    }
    .cvchat-sidebar {
        width: 100%;
        min-width: 100%;
        flex-direction: row;
        padding: 12px 16px;
        gap: 12px;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    .cvchat-photo-area { display: none; }
    .cvchat-progress-list {
        display: flex;
        gap: 4px;
    }
    .cvchat-progress-list li {
        padding: 4px 8px;
        font-size: .75rem;
        white-space: nowrap;
    }
    .cvchat-progress-list li span:not(.step-icon) { display: none; }
    .cvchat-template-select { display: none; }
    .cvchat-form-link { display: none; }
    .cvchat-messages { padding: 16px; }
    .cvchat-input-area { padding: 12px 16px; }
    .cvchat-msg { max-width: 92%; }
}

/* Hero section for chat page */
.aicv-hero {
    background: linear-gradient(135deg, #f8f9fb 0%, #eef1f8 100%);
    padding: 40px 0 24px;
}
.aicv-hero h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1.2;
}
.aicv-hero p { color: #555; font-size: 1rem; line-height: 1.7; }

.aicv-steps-row {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}
.aicv-step-card {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 8px rgba(0,0,0,.05);
    text-align: center;
}
.aicv-step-card .step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--pcv-primary, #4361ee);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 10px;
}
.aicv-step-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 4px; }
.aicv-step-card p { font-size: .82rem; color: #6c757d; margin: 0; }

.aicv-advantages {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}
.aicv-advantages span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: .82rem;
    color: #495057;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.aicv-advantages span i { color: #198754; }

/* SEO bottom section */
.aicv-seo-section { padding: 48px 0; background: #fff; }
.aicv-faq-item { margin-bottom: 12px; }
.aicv-faq-item h3 {
    font-size: .95rem;
    font-weight: 600;
    margin-bottom: 4px;
    cursor: pointer;
}
.aicv-faq-item p { font-size: .88rem; color: #555; line-height: 1.7; }

@media (max-width: 768px) {
    .aicv-hero { padding: 24px 0 16px; }
    .aicv-hero h1 { font-size: 1.5rem; }
    .aicv-steps-row { flex-direction: column; gap: 12px; }
}

/* =========================================================================
   Auth Gate Overlay
   ========================================================================= */
.cvchat-auth-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(6px);
    border-radius: 18px;
}
.cvchat-auth-card {
    text-align: center;
    max-width: 420px;
    padding: 40px 32px;
}
.cvchat-auth-icon { margin-bottom: 16px; }
.cvchat-auth-card h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 10px;
}
.cvchat-auth-card > p {
    font-size: .92rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 24px;
}
.cvchat-auth-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 18px;
}
.cvchat-auth-buttons .btn { min-width: 140px; }
.cvchat-auth-form-link {
    font-size: .82rem;
    color: #888;
    margin: 0;
}
.cvchat-auth-form-link a { color: var(--pcv-primary, #4361ee); }

/* Template recommendation badge */
.cvchat-template-badge {
    display: inline-block;
    font-size: .7rem;
    background: linear-gradient(135deg, #4361ee, #10b981);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
    font-weight: 600;
}
