/**
 * Company Research - Frontend Demo Styles
 */

.cr-demo-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    --cr-primary: #0F0B45;
    --cr-primary-light: #1a1463;
    --cr-primary-lighter: #2a2080;
    --cr-text-dark: #1a1a2e;
    --cr-text-muted: #6b7280;
    --cr-bg-light: #f8f9fc;
    --cr-white: #ffffff;
    --cr-border: #e5e7eb;
    --cr-success: #10b981;
    --cr-error: #ef4444;
    --cr-shadow: 0 4px 6px -1px rgba(15, 11, 69, 0.1), 0 2px 4px -1px rgba(15, 11, 69, 0.06);
    --cr-shadow-lg: 0 20px 25px -5px rgba(15, 11, 69, 0.1), 0 10px 10px -5px rgba(15, 11, 69, 0.04);
}

/* Header */
.cr-demo-header {
    text-align: center;
    margin-bottom: 50px;
}

.cr-demo-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--cr-primary);
    margin: 0 0 10px 0;
}

.cr-demo-header p {
    color: var(--cr-text-muted);
    font-size: 1.05rem;
    margin: 0;
}

/* Stepper */
.cr-stepper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 50px;
    gap: 0;
}

.cr-step-item {
    display: flex;
    align-items: center;
}

.cr-step-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cr-step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    background: var(--cr-white);
    border: 2px solid var(--cr-border);
    color: var(--cr-text-muted);
    transition: all 0.3s ease;
}

.cr-step-item.active .cr-step-circle {
    background: var(--cr-primary);
    border-color: var(--cr-primary);
    color: var(--cr-white);
    box-shadow: 0 0 0 4px rgba(15, 11, 69, 0.15);
}

.cr-step-item.completed .cr-step-circle {
    background: var(--cr-success);
    border-color: var(--cr-success);
    color: var(--cr-white);
}

.cr-step-line {
    width: 80px;
    height: 2px;
    background: var(--cr-border);
    margin: 0 8px;
    transition: all 0.3s ease;
}

.cr-step-item.completed + .cr-step-item .cr-step-line,
.cr-step-item.completed .cr-step-line {
    background: var(--cr-success);
}

.cr-step-label {
    position: absolute;
    margin-top: 70px;
    font-size: 0.8rem;
    color: var(--cr-text-muted);
    white-space: nowrap;
}

.cr-step-item.active .cr-step-label {
    color: var(--cr-primary);
    font-weight: 500;
}

/* Card */
.cr-demo-card {
    background: var(--cr-white);
    border-radius: 20px;
    box-shadow: var(--cr-shadow-lg);
    padding: 50px;
    margin-bottom: 30px;
}

/* Form Steps */
.cr-form-step {
    display: none;
}

.cr-form-step.active {
    display: block;
    animation: crFadeIn 0.4s ease;
}

@keyframes crFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Grid */
.cr-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.cr-form-group {
    display: flex;
    flex-direction: column;
}

.cr-form-group.full-width {
    grid-column: span 2;
}

.cr-form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cr-text-dark);
    margin-bottom: 8px;
}

.cr-form-group input {
    padding: 14px 18px;
    border: 1.5px solid var(--cr-border);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--cr-bg-light);
}

.cr-form-group input:focus {
    outline: none;
    border-color: var(--cr-primary);
    background: var(--cr-white);
    box-shadow: 0 0 0 4px rgba(15, 11, 69, 0.08);
}

.cr-form-group input::placeholder {
    color: #9ca3af;
}

/* Buttons */
.cr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 36px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cr-btn-primary {
    background: var(--cr-primary);
    color: var(--cr-white);
}

.cr-btn-primary:hover:not(:disabled) {
    background: var(--cr-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--cr-shadow);
}

.cr-btn-primary:disabled {
    background: #c7c9d9;
    cursor: not-allowed;
    transform: none;
}

.cr-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 35px;
}

.cr-btn-icon {
    width: 20px;
    height: 20px;
}

/* Loading Step */
.cr-loading-container {
    text-align: center;
    padding: 40px 0;
}

.cr-loading-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 35px;
    position: relative;
}

.cr-loading-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid var(--cr-border);
    border-top-color: var(--cr-primary);
    animation: crSpin 1s linear infinite;
}

@keyframes crSpin {
    to { transform: rotate(360deg); }
}

.cr-loading-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cr-primary);
}

.cr-loading-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--cr-primary);
    margin: 0 0 12px 0;
}

.cr-loading-subtitle {
    color: var(--cr-text-muted);
    font-size: 1rem;
    margin: 0 0 40px 0;
}

.cr-progress-bar-container {
    background: var(--cr-bg-light);
    border-radius: 100px;
    height: 8px;
    overflow: hidden;
    max-width: 400px;
    margin: 0 auto;
}

.cr-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--cr-primary) 0%, var(--cr-primary-lighter) 100%);
    border-radius: 100px;
    width: 0%;
    transition: width 0.3s ease;
}

.cr-loading-steps {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 350px;
    margin-left: auto;
    margin-right: auto;
}

.cr-loading-step-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--cr-bg-light);
    border-radius: 10px;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.cr-loading-step-item.active {
    opacity: 1;
    background: rgba(15, 11, 69, 0.05);
}

.cr-loading-step-item.completed {
    opacity: 1;
}

.cr-loading-step-icon {
    width: 24px;
    height: 24px;
    color: var(--cr-text-muted);
    flex-shrink: 0;
}

.cr-loading-step-item.completed .cr-loading-step-icon {
    color: var(--cr-success);
}

.cr-loading-step-item.active .cr-loading-step-icon {
    color: var(--cr-primary);
}

/* Error Message */
.cr-error-message {
    margin-top: 30px;
    padding: 16px 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    color: var(--cr-error);
    font-size: 0.95rem;
}

/* Test Interface */
.cr-test-intro {
    text-align: center;
    margin-bottom: 35px;
}

.cr-test-intro h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--cr-primary);
    margin: 0 0 10px 0;
}

.cr-test-intro p {
    color: var(--cr-text-muted);
    margin: 0;
}

.cr-success-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--cr-success);
    padding: 10px 20px;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 30px;
}

.cr-success-badge svg {
    width: 18px;
    height: 18px;
}

.cr-test-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: nowrap;
}

.cr-test-panel {
    background: var(--cr-bg-light);
    border-radius: 16px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 480px;
    min-width: 320px;
    width: 100%;
    min-height: 400px;
}

.cr-test-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--cr-border);
}

.cr-test-panel-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--cr-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cr-test-panel-icon svg {
    width: 22px;
    height: 22px;
    color: var(--cr-white);
}

.cr-test-panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--cr-text-dark);
}

/* Voice Panel */
.cr-voice-visualizer {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
}

.cr-voice-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cr-primary) 0%, var(--cr-primary-lighter) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.cr-voice-circle:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 40px rgba(15, 11, 69, 0.3);
}

.cr-voice-circle.active {
    animation: crPulse 1.5s ease-in-out infinite;
}

@keyframes crPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(15, 11, 69, 0.4); }
    50% { box-shadow: 0 0 0 25px rgba(15, 11, 69, 0); }
}

.cr-voice-circle svg {
    width: 50px;
    height: 50px;
    color: var(--cr-white);
}

.cr-voice-hint {
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--cr-text-muted);
}

.cr-voice-status {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--cr-primary);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cr-voice-status.visible {
    opacity: 1;
}

/* ElevenLabs Widget */
#cr-elevenlabs-widget {
    margin-top: 20px;
}

/* Chat Panel */

.cr-chat-start {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
}

.cr-chat-start-text {
    color: var(--cr-text-muted);
    margin-bottom: 20px;
    text-align: center;
}

.cr-chat-name-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 280px;
}

.cr-chat-name-input {
    padding: 14px 18px;
    border: 1.5px solid var(--cr-border);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--cr-white);
    text-align: center;
}

.cr-chat-name-input:focus {
    outline: none;
    border-color: var(--cr-primary);
    box-shadow: 0 0 0 4px rgba(15, 11, 69, 0.08);
}

.cr-chat-name-input::placeholder {
    color: #9ca3af;
}

/* Chat Window */
.cr-chat-window {
    display: flex;
    flex-direction: column;
    height: 350px;
}

.cr-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--cr-white);
    border-radius: 12px;
    margin-bottom: 12px;
}

.cr-chat-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 85%;
    animation: crChatFadeIn 0.3s ease;
}

@keyframes crChatFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.cr-chat-message-bot {
    align-self: flex-start;
}

.cr-chat-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.cr-chat-message-system {
    align-self: center;
    max-width: 100%;
}

.cr-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--cr-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cr-chat-avatar svg {
    width: 16px;
    height: 16px;
    color: var(--cr-white);
}

.cr-chat-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.cr-chat-message-bot .cr-chat-bubble {
    background: var(--cr-bg-light);
    color: var(--cr-text-dark);
    border-bottom-left-radius: 4px;
}

.cr-chat-message-user .cr-chat-bubble {
    background: var(--cr-primary);
    color: var(--cr-white);
    border-bottom-right-radius: 4px;
}

.cr-chat-system {
    font-size: 0.8rem;
    color: var(--cr-text-muted);
    text-align: center;
    padding: 8px 16px;
    background: rgba(107, 114, 128, 0.1);
    border-radius: 100px;
}

/* Typing Indicator */
.typing-dots {
    display: inline-flex;
    gap: 3px;
}

.typing-dots span {
    animation: typingBounce 1.4s infinite;
    font-weight: bold;
    font-size: 1.2em;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

.cr-chat-send-btn.loading {
    opacity: 0.5;
    cursor: wait;
}

/* Demo Page Chat Styles */
.demo-chat-message {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.demo-chat-message-bot {
    flex-direction: row;
}

.demo-chat-message-user {
    flex-direction: row-reverse;
}

.demo-chat-message-system {
    justify-content: center;
}

.demo-chat-avatar {
    width: 32px;
    height: 32px;
    background: var(--cr-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.demo-chat-avatar svg {
    width: 18px;
    height: 18px;
    color: white;
}

.demo-chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.demo-chat-message-bot .demo-chat-bubble {
    background: var(--cr-bg-light);
    color: var(--cr-text-dark);
    border-bottom-left-radius: 4px;
}

.demo-chat-message-user .demo-chat-bubble {
    background: var(--cr-primary);
    color: var(--cr-white);
    border-bottom-right-radius: 4px;
}

/* Chat Input */
.cr-chat-input-container {
    display: flex;
    gap: 8px;
}

.cr-chat-input {
    flex: 1;
    padding: 14px 18px;
    border: 1.5px solid var(--cr-border);
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--cr-white);
}

.cr-chat-input:focus {
    outline: none;
    border-color: var(--cr-primary);
    box-shadow: 0 0 0 4px rgba(15, 11, 69, 0.08);
}

.cr-chat-input::placeholder {
    color: #9ca3af;
}

.cr-chat-send-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 12px;
    background: var(--cr-primary);
    color: var(--cr-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cr-chat-send-btn:hover {
    background: var(--cr-primary-light);
    transform: translateY(-2px);
}

.cr-chat-send-btn svg {
    width: 22px;
    height: 22px;
}

/* Demo Link Box */
.cr-demo-link-box {
    margin-top: 30px;
    background: linear-gradient(135deg, rgba(15, 11, 69, 0.05) 0%, rgba(42, 32, 128, 0.08) 100%);
    border: 1px solid rgba(15, 11, 69, 0.1);
    border-radius: 16px;
    padding: 24px;
}

.cr-demo-link-content {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.cr-demo-link-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: var(--cr-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cr-demo-link-icon svg {
    width: 24px;
    height: 24px;
    color: var(--cr-white);
}

.cr-demo-link-text {
    flex: 1;
}

.cr-demo-link-text h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--cr-primary);
    margin: 0 0 8px 0;
}

.cr-demo-link-text > p {
    color: var(--cr-text-muted);
    margin: 0 0 16px 0;
    font-size: 0.9rem;
}

.cr-demo-link-url-box {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.cr-demo-link-url {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--cr-border);
    border-radius: 10px;
    font-size: 0.9rem;
    background: var(--cr-white);
    color: var(--cr-text-dark);
    font-family: monospace;
}

.cr-demo-link-copy {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 10px;
    background: var(--cr-primary);
    color: var(--cr-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cr-demo-link-copy:hover {
    background: var(--cr-primary-light);
    transform: translateY(-2px);
}

.cr-demo-link-copy svg {
    width: 20px;
    height: 20px;
}

.cr-demo-link-copy.copied {
    background: var(--cr-success);
}

.cr-demo-link-validity {
    font-size: 0.85rem;
    color: var(--cr-text-muted);
    margin: 0;
}

.cr-demo-link-validity span {
    font-weight: 500;
    color: var(--cr-primary);
}

/* Demo Link Anchor (clickable) */
.cr-demo-link-anchor {
    flex: 1;
    text-decoration: none;
    display: block;
}

.cr-demo-link-anchor .cr-demo-link-url {
    cursor: pointer;
    color: var(--cr-primary);
    text-decoration: underline;
}

.cr-demo-link-anchor .cr-demo-link-url:hover {
    color: var(--cr-primary-light);
}

/* Share Buttons */
.cr-demo-link-share {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cr-demo-link-share svg {
    width: 20px;
    height: 20px;
}

.cr-demo-link-share.cr-whatsapp {
    background: #25D366;
    color: white;
}

.cr-demo-link-share.cr-whatsapp:hover {
    background: #128C7E;
}

/* Responsive */
/* Tablet */
@media (max-width: 900px) {
    .cr-test-container {
        flex-direction: column;
        flex-wrap: wrap;
        align-items: center;
    }

    .cr-test-panel {
        max-width: 100%;
        min-width: auto;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .cr-demo-container {
        padding: 24px 16px;
    }

    .cr-demo-card {
        padding: 30px 24px;
    }

    .cr-form-grid {
        grid-template-columns: 1fr;
    }

    .cr-form-group.full-width {
        grid-column: span 1;
    }

    .cr-step-line {
        width: 40px;
    }

    .cr-step-label {
        font-size: 0.7rem;
    }

    .cr-test-panel {
        max-width: 100%;
    }
}
