/* ═══════════════════════════════════════════
   AI Recruiter Chat — Public Chat Interface
   Premium Dark Design with Glassmorphism
   ═══════════════════════════════════════════ */

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

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --glass-bg: rgba(17, 17, 40, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-inner: rgba(255, 255, 255, 0.04);
    --text-primary: #f0f0f8;
    --text-secondary: #a0a0c0;
    --text-muted: #60607a;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --user-bubble: linear-gradient(135deg, #6366f1, #8b5cf6);
    --bot-bubble: rgba(255, 255, 255, 0.06);
    --input-bg: rgba(255, 255, 255, 0.05);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-bubble: 20px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ─── Animated Background ────────────────── */
.chat-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: orbFloat 20s ease-in-out infinite;
}
.glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #6366f1, transparent 70%);
    top: -10%;
    right: -10%;
    animation-delay: 0s;
}
.glow-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #8b5cf6, transparent 70%);
    bottom: -10%;
    left: -5%;
    animation-delay: -7s;
}
.glow-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #06b6d4, transparent 70%);
    top: 40%;
    left: 50%;
    animation-delay: -14s;
}
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 30px) scale(0.9); }
}

/* ─── App Container ──────────────────────── */
.chat-app {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Screens ────────────────────────────── */
.chat-screen {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeSlideIn 0.5s ease;
}
.chat-screen.active {
    display: flex;
}
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Glass Card ─────────────────────────── */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.glass-inner {
    background: var(--glass-inner);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════
   SCREEN 1: Registration
   ═══════════════════════════════════════════ */
.reg-card {
    width: 100%;
    max-width: 500px;
    padding: 40px 36px;
    animation: fadeSlideIn 0.6s ease;
}
.reg-header {
    text-align: center;
    margin-bottom: 28px;
}
.brand-icon {
    font-size: 48px;
    margin-bottom: 12px;
    animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.reg-header h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.reg-vacancy {
    color: var(--accent-light);
    font-weight: 600;
    font-size: 15px;
    margin-top: 6px;
}

.reg-info-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.info-icon {
    font-size: 16px;
}

/* ─── Form Fields ────────────────────────── */
.reg-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.form-field label .req {
    color: #f87171;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-field input {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-field input::placeholder {
    color: var(--text-muted);
}
.form-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ─── Primary Button ─────────────────────── */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: var(--user-bubble);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
    margin-top: 8px;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-primary svg {
    flex-shrink: 0;
}

.reg-disclaimer {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 16px;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════
   SCREEN 2: Chat
   ═══════════════════════════════════════════ */
.chat-container {
    width: 100%;
    max-width: 700px;
    height: min(90vh, 800px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.bot-info {
    display: flex;
    flex-direction: column;
}
.bot-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.bot-status {
    font-size: 12px;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 5px;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.vacancy-label {
    font-size: 12px;
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.15);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar {
    width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: msgAppear 0.35s ease;
}
@keyframes msgAppear {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.message.bot {
    align-self: flex-start;
}
.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 4px;
}
.message.bot .msg-avatar {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
.message.user .msg-avatar {
    background: linear-gradient(135deg, #374151, #4b5563);
}
.msg-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.msg-bubble {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.65;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.message.bot .msg-bubble {
    background: var(--bot-bubble);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-bubble) 4px;
    color: var(--text-primary);
}
.message.user .msg-bubble {
    background: var(--user-bubble);
    border-radius: var(--radius-bubble) var(--radius-bubble) 4px var(--radius-bubble);
    color: #fff;
}
.msg-time {
    font-size: 10px;
    color: var(--text-muted);
    padding: 0 4px;
}
.message.user .msg-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 0 20px 12px;
    animation: fadeIn 0.3s ease;
}
.typing-indicator.active {
    display: flex;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.typing-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 10px 16px;
    background: var(--bot-bubble);
    border: 1px solid var(--glass-border);
    border-radius: 20px 20px 20px 4px;
}
.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat Input */
.chat-input-area {
    padding: 12px 20px 16px;
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 6px 8px 6px 16px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    padding: 8px 0;
    max-height: 120px;
    line-height: 1.5;
}
#chat-input::placeholder {
    color: var(--text-muted);
}
.btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--user-bubble);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--transition), opacity var(--transition), box-shadow var(--transition);
}
.btn-send:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}
.input-meta {
    display: flex;
    justify-content: flex-end;
    padding: 4px 4px 0;
}
#char-count {
    font-size: 11px;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════
   SCREEN 3: Completed
   ═══════════════════════════════════════════ */
.complete-card {
    width: 100%;
    max-width: 480px;
    padding: 48px 36px;
    text-align: center;
}
.complete-icon {
    margin-bottom: 24px;
}
.check-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 24px var(--success-glow);
}
@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.complete-card h1 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, #a7f3d0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.complete-sub {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 28px;
}
.complete-info {
    padding: 20px;
    text-align: left;
    margin-bottom: 24px;
}
.complete-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.5;
}
.complete-info p:last-child {
    margin-bottom: 0;
}
.complete-close {
    font-size: 13px;
    color: var(--text-muted);
}

/* ─── Responsive ─────────────────────────── */
@media (max-width: 768px) {
    .chat-screen {
        padding: 0;
    }
    .reg-card {
        max-width: 100%;
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 24px;
    }
    .chat-container {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    .complete-card {
        max-width: 100%;
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .message {
        max-width: 90%;
    }
    .vacancy-label {
        display: none;
    }
}

@media (max-width: 400px) {
    .reg-info-bar {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    .reg-header h1 {
        font-size: 22px;
    }
}

/* ─── Loading Spinner for button ─────────── */
.btn-loading {
    position: relative;
    color: transparent !important;
}
.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
