/**
 * RAG Lead Gen - Frontend Styles
 * Modern, responsive design for chat widget and assessments
 */

/* CSS Variables */
:root {
    --rag-primary: #0066cc;
    --rag-primary-dark: #0052a3;
    --rag-secondary: #6c757d;
    --rag-success: #28a745;
    --rag-danger: #dc3545;
    --rag-light: #f8f9fa;
    --rag-dark: #343a40;
    --rag-border: #dee2e6;
    --rag-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --rag-shadow-lg: 0 4px 20px rgba(0,0,0,0.15);
    --rag-radius: 8px;
    --rag-transition: all 0.3s ease;
}

/* Chat Widget */
.rag-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.rag-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--rag-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--rag-shadow-lg);
    transition: var(--rag-transition);
}

.rag-chat-toggle:hover {
    background: var(--rag-primary-dark);
    transform: scale(1.05);
}

.rag-chat-toggle svg {
    width: 30px;
    height: 30px;
}

.rag-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: var(--rag-radius);
    box-shadow: var(--rag-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rag-chat-header {
    background: var(--rag-primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rag-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.rag-chat-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--rag-transition);
}

.rag-chat-close:hover {
    background: rgba(255,255,255,0.2);
}

.rag-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f5f5;
}

.rag-chat-message {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: var(--rag-radius);
    max-width: 80%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rag-chat-message-user {
    background: var(--rag-primary);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.rag-chat-message-assistant {
    background: white;
    color: var(--rag-dark);
    margin-right: auto;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.rag-chat-sources {
    margin: 16px 0;
    padding: 12px;
    background: white;
    border-radius: var(--rag-radius);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.rag-sources-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--rag-dark);
    font-size: 14px;
}

.rag-source-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid var(--rag-border);
    color: var(--rag-primary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--rag-transition);
}

.rag-source-item:hover {
    color: var(--rag-primary-dark);
}

.rag-source-item strong {
    flex: 1;
}

.rag-source-item span {
    font-size: 12px;
    color: var(--rag-secondary);
}

.rag-chat-input-wrapper {
    display: flex;
    padding: 16px;
    background: white;
    border-top: 1px solid var(--rag-border);
}

.rag-chat-input-wrapper input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--rag-border);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: var(--rag-transition);
}

.rag-chat-input-wrapper input:focus {
    border-color: var(--rag-primary);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

.rag-chat-input-wrapper button {
    margin-left: 8px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--rag-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--rag-transition);
}

.rag-chat-input-wrapper button:hover {
    background: var(--rag-primary-dark);
    transform: scale(1.05);
}

.rag-chat-input-wrapper button svg {
    width: 20px;
    height: 20px;
}

.rag-chat-typing {
    padding: 12px 20px;
    display: flex;
    gap: 4px;
}

.rag-chat-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rag-secondary);
    animation: typing 1.4s infinite;
}

.rag-chat-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.rag-chat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Assessment Form */
.rag-assessment-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 40px;
    background: white;
    border-radius: var(--rag-radius);
    box-shadow: var(--rag-shadow);
}

.rag-assessment-progress {
    margin-bottom: 32px;
}

.rag-progress-bar {
    height: 8px;
    background: var(--rag-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.rag-progress-text {
    display: block;
    margin-top: 8px;
    text-align: center;
    color: var(--rag-secondary);
    font-size: 14px;
}

.rag-assessment-question h3 {
    margin-bottom: 24px;
    color: var(--rag-dark);
    font-size: 22px;
    line-height: 1.4;
}

.rag-assessment-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rag-option {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--rag-light);
    border: 2px solid transparent;
    border-radius: var(--rag-radius);
    cursor: pointer;
    transition: var(--rag-transition);
}

.rag-option:hover {
    background: #e9ecef;
    border-color: var(--rag-primary);
}

.rag-option input[type="radio"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.rag-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--rag-primary);
}

.rag-assessment-nav {
    margin-top: 32px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.rag-btn {
    padding: 12px 32px;
    border-radius: var(--rag-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--rag-transition);
}

.rag-btn-primary {
    background: var(--rag-primary);
    color: white;
}

.rag-btn-primary:hover {
    background: var(--rag-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--rag-shadow);
}

.rag-btn-secondary {
    background: var(--rag-secondary);
    color: white;
}

.rag-btn-secondary:hover {
    background: #5a6268;
}

/* Contact Form */
.rag-assessment-contact {
    animation: fadeIn 0.5s ease;
}

.rag-assessment-contact h3 {
    margin-bottom: 24px;
    color: var(--rag-dark);
    font-size: 24px;
}

.rag-form-group {
    margin-bottom: 20px;
}

.rag-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--rag-dark);
}

.rag-form-group input[type="text"],
.rag-form-group input[type="email"],
.rag-form-group input[type="tel"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--rag-border);
    border-radius: var(--rag-radius);
    font-size: 16px;
    transition: var(--rag-transition);
}

.rag-form-group input:focus {
    border-color: var(--rag-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

.rag-checkbox {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
}

.rag-checkbox input[type="checkbox"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.rag-checkbox span {
    font-weight: normal;
    color: var(--rag-dark);
    font-size: 14px;
    line-height: 1.5;
}

/* Results */
.rag-assessment-results {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.rag-assessment-results h2 {
    margin-bottom: 32px;
    color: var(--rag-dark);
    font-size: 32px;
}

.rag-score-card {
    padding: 40px;
    background: linear-gradient(135deg, var(--rag-primary), var(--rag-primary-dark));
    color: white;
    border-radius: var(--rag-radius);
    margin-bottom: 32px;
}

.rag-score-number {
    font-size: 72px;
    font-weight: bold;
    line-height: 1;
}

.rag-score-label {
    font-size: 18px;
    opacity: 0.9;
    margin-top: 8px;
}

.rag-score-category {
    font-size: 28px;
    font-weight: 600;
    margin-top: 16px;
}

.rag-results-overview,
.rag-results-actions {
    text-align: left;
    margin-bottom: 32px;
    padding: 24px;
    background: var(--rag-light);
    border-radius: var(--rag-radius);
}

.rag-results-overview h3,
.rag-results-actions h3 {
    margin-bottom: 16px;
    color: var(--rag-dark);
}

.rag-results-actions ul {
    list-style: none;
    padding: 0;
}

.rag-results-actions li {
    padding: 12px 0;
    padding-left: 32px;
    border-bottom: 1px solid var(--rag-border);
    position: relative;
}

.rag-results-actions li:last-child {
    border-bottom: none;
}

.rag-results-actions li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--rag-success);
    font-weight: bold;
    font-size: 20px;
}

.rag-results-cta {
    padding: 32px;
    background: var(--rag-light);
    border-radius: var(--rag-radius);
    margin-top: 32px;
}

.rag-results-cta h3 {
    margin-bottom: 12px;
    color: var(--rag-dark);
}

.rag-results-cta p {
    margin-bottom: 24px;
    color: var(--rag-secondary);
}

/* GDPR Notice */
.rag-gdpr-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 20px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 10000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.rag-gdpr-content {
    flex: 1;
}

.rag-gdpr-content p {
    margin: 0 0 8px 0;
    color: var(--rag-dark);
}

.rag-gdpr-content a {
    color: var(--rag-primary);
    text-decoration: none;
    font-size: 14px;
}

.rag-gdpr-actions {
    display: flex;
    gap: 12px;
}

.rag-btn-accept {
    background: var(--rag-success);
    color: white;
}

.rag-btn-decline {
    background: var(--rag-secondary);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .rag-chat-window {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .rag-assessment-container {
        padding: 20px;
        margin: 20px;
    }
    
    .rag-gdpr-notice {
        flex-direction: column;
        text-align: center;
    }
    
    .rag-gdpr-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .rag-gdpr-actions button {
        width: 100%;
    }
}

/* Accessibility */
.rag-btn:focus,
.rag-option:focus-within,
input:focus {
    outline: 2px solid var(--rag-primary);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .rag-chat-widget {
        display: none !important;
    }
    
    .rag-gdpr-notice {
        display: none !important;
    }
}