/* Chatbot Widget */

:root {
    --chatbot-primary-color: #4DA8DA; /* Light blue primary color */
    --chatbot-secondary-color: #66B2FF; /* Complementary light blue */
    --chatbot-light-color: #f8f9fa;
    --chatbot-dark-color: #343a40;
    --chatbot-success-color: #28a745;
    --chatbot-danger-color: #dc3545;
    --chatbot-warning-color: #ffc107;
    --chatbot-info-color: #17a2b8;
    --chatbot-border-radius: 4px;
    --chatbot-box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --chatbot-transition: all 0.3s ease;
}

.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 350px;
    width: 100%;
}

@scope (.chatbot-widget) {

    :root {
        --primary-color: #4DA8DA; /* Light blue primary color */
        --secondary-color: #66B2FF; /* Complementary light blue */
        --light-color: #f8f9fa;
        --dark-color: #343a40;
        --success-color: #28a745;
        --danger-color: #dc3545;
        --warning-color: #ffc107;
        --info-color: #17a2b8;
        --border-radius: 4px;
        --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        --transition: all 0.3s ease;
    }

    body {
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        line-height: 1.6;
        color: #333;
        background-color: #f5f5f5;
        margin: 0;
        padding: 0;
    }

    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 15px;
    }

    /* Header */
    .header {
        background-color: var(--chatbot-primary-color);
        color: white;
        padding: 1rem 0;
        box-shadow: var(--chatbot-box-shadow);
    }

    .header .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .header h1 {
        margin: 0;
        font-size: 1.5rem;
    }


    .chatbot-button {
        position: fixed;
        bottom: 20px;
        right: 20px;
        background-color: var(--chatbot-secondary-color);
        color: white;
        width: 60px;
        height: 60px;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        box-shadow: var(--chatbot-box-shadow);
        transition: var(--chatbot-transition);
        z-index: 10000; /* above everything */
    }

    .chatbot-button:hover {
        background-color: #4DA8DA;
        transform: scale(1.05);
    }

    .chatbot-button i {
        font-size: 24px;
    }

    .chatbot-container {
        position: fixed;
        bottom: 90px; /* above button */
        right: 20px;
        width: 350px;
        height: 500px;
        background-color: white;
        border-radius: 10px;
        box-shadow: var(--chatbot-box-shadow);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        transition: var(--chatbot-transition);
        transform: scale(0);
        transform-origin: bottom right;
        opacity: 0;
        z-index: 9999;
        border: 1px solid #ccc; /* visible border */
    }

    .chatbot-container.active {
        transform: scale(1);
        opacity: 1;
    }

    .chatbot-header {
        background-color: var(--chatbot-primary-color);
        color: white;
        padding: 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .chatbot-header h3 {
        margin: 0;
        font-size: 1rem;
    }

    .chatbot-close {
        background: none;
        border: none;
        /* color: white; */
        font-size: 16px;
        cursor: pointer;
    }

    .chatbot-messages {
        flex-grow: 1;
        padding: 15px;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .message {
        margin-bottom: 10px;
        max-width: 80%;
        padding: 10px 15px;
        border-radius: var(--chatbot-border-radius);
        line-height: 1.4;
    }

    .message.bot {
        background-color: #e6f2ff;
        color: #333;
        align-self: flex-start;
        border-bottom-left-radius: 0;
    }

    .message.user {
        background-color: var(--chatbot-primary-color);
        color: white;
        align-self: flex-end;
        border-bottom-right-radius: 0;
    }

    .chatbot-input {
        padding: 15px;
        border-top: 1px solid #e1e1e1;
        display: flex;
        background-color: white;
    }

    .chatbot-input input {
        flex-grow: 1;
        padding: 10px;
        border: 1px solid #ccc;
        border-radius: var(--chatbot-border-radius);
        margin-right: 10px;
    }

    .chatbot-input button {
        background-color: var(--chatbot-secondary-color);
        color: white;
        border: none;
        padding: 10px 15px;
        border-radius: var(--chatbot-border-radius);
        cursor: pointer;
        transition: var(--chatbot-transition);
    }

    .chatbot-input button:hover {
        background-color: #4DA8DA;
    }

    /* Chatbot Lead Form */
    .lead-form {
        padding: 15px;
        background-color: #f9f9f9;
        border-radius: var(--chatbot-border-radius);
        margin-bottom: 15px;
    }

    .lead-form h4 {
        margin-top: 0;
        font-size: 1rem;
        color: var(--chatbot-primary-color);
    }

    .form-group {
        margin-bottom: 10px;
    }

    .form-group label {
        display: block;
        font-size: 0.9rem;
        margin-bottom: 5px;
        color: #555;
    }

    .form-group input {
        width: 100%;
        padding: 8px;
        border: 1px solid #ccc;
        border-radius: var(--chatbot-border-radius);
    }

    .btn {
        display: inline-block;
        padding: 8px 16px;
        background-color: var(--chatbot-primary-color);
        color: white;
        border: none;
        border-radius: var(--chatbot-border-radius);
        cursor: pointer;
        text-decoration: none;
        text-align: center;
        transition: var(--chatbot-transition);
    }

    .btn:hover {
        opacity: 0.9;
    }

    .btn-secondary {
        background-color: var(--chatbot-secondary-color);
    }

    .btn-success {
        background-color: var(--chatbot-success-color);
    }

    .btn-danger {
        background-color: var(--chatbot-danger-color);
    }

    /* Action Buttons */
    .action-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 15px;
    }

    .action-button {
        background-color: #e6f2ff;
        border: 1px solid #ccc;
        border-radius: var(--chatbot-border-radius);
        padding: 8px 12px;
        cursor: pointer;
        transition: var(--chatbot-transition);
        font-size: 0.9rem;
    }

    .action-button:hover {
        background-color: #d1e7ff;
    }

    /* Admin Login */
    .login-container {
        max-width: 400px;
        margin: 100px auto;
        padding: 30px;
        background-color: white;
        border-radius: 10px;
        box-shadow: var(--chatbot-box-shadow);
    }

    .login-container h2 {
        text-align: center;
        color: var(--chatbot-primary-color);
        margin-bottom: 30px;
    }

    .form-control {
        width: 100%;
        padding: 10px;
        margin-bottom: 15px;
        border: 1px solid #ccc;
        border-radius: var(--chatbot-border-radius);
    }

    .btn-block {
        width: 100%;
    }

    /* Admin Dashboard */
    .dashboard-container {
        background-color: white;
        padding: 20px;
        margin: 20px 0;
        border-radius: 10px;
        box-shadow: var(--chatbot-box-shadow);
    }

    .dashboard-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
    }

    .filter-card {
        background-color: #f9f9f9;
        padding: 15px;
        border-radius: var(--chatbot-border-radius);
        margin-bottom: 20px;
    }

    .filter-group {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
        margin-bottom: 15px;
    }

    .filter-item {
        flex: 1;
        min-width: 200px;
    }

    .filter-item label {
        display: block;
        margin-bottom: 5px;
        font-weight: bold;
    }

    .filter-item select,
    .filter-item input {
        width: 100%;
        padding: 8px;
        border: 1px solid #ccc;
        border-radius: var(--chatbot-border-radius);
    }

    .lead-table {
        width: 100%;
        border-collapse: collapse;
    }

    .lead-table th, 
    .lead-table td {
        padding: 12px 15px;
        text-align: left;
        border-bottom: 1px solid #e1e1e1;
    }

    .lead-table th {
        background-color: #f3f3f3;
        font-weight: bold;
    }

    .lead-table tr:hover {
        background-color: #f9f9f9;
    }

    .status-badge {
        display: inline-block;
        padding: 5px 10px;
        border-radius: 20px;
        font-size: 0.8rem;
        font-weight: bold;
    }

    .status-new {
        background-color: #e6f2ff;
        color: #0066cc;
    }

    .status-contacted {
        background-color: #fff0e6;
        color: #ff6600;
    }

    .status-closed {
        background-color: #e6ffe6;
    }

    /* Auto-captured leads styling */
    .auto-lead-badge {
        display: inline-block;
        margin-right: 5px;
        color: #007bff;
        font-size: 1.1em;
    }

    .auto-tag {
        display: inline-block;
        margin-left: 5px;
        padding: 2px 6px;
        border-radius: 10px;
        font-size: 0.75rem;
        background-color: #e6f7ff;
        color: #0088cc;
        border: 1px solid #b3e0ff;
    }

    .inquiry-type-tag {
        display: block;
        margin-top: 5px;
        font-size: 0.8rem;
        color: #666;
    }

    .auto-lead-form {
        background-color: #f8f9fa;
        border: 1px solid #dee2e6;
        border-radius: 5px;
        padding: 15px;
        margin-top: 20px;
    }

    .status-closed {
        color: #00cc66;
    }

    /* Demo page styles */
    .demo-page {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .demo-content {
        flex-grow: 1;
        padding: 40px 0;
    }

    .demo-car {
        background-color: white;
        padding: 30px;
        border-radius: 10px;
        box-shadow: var(--chatbot-box-shadow);
        text-align: center;
    }

    .demo-car h2 {
        color: var(--chatbot-primary-color);
        margin-bottom: 15px;
    }

    .demo-car .price {
        color: var(--chatbot-secondary-color);
        font-size: 1.5rem;
        font-weight: bold;
        margin-bottom: 20px;
    }

    .car-specs {
        display: flex;
        justify-content: center;
        gap: 30px;
        margin-bottom: 30px;
    }

    .car-spec-item {
        text-align: center;
    }

    .car-spec-item .value {
        font-weight: bold;
        font-size: 1.1rem;
    }

    .car-image-placeholder {
        height: 200px;
        background-color: #f0f0f0;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 20px;
        border-radius: 5px;
    }

    /* Responsive adjustments */
    @media (max-width: 768px) {
        .chatbot-widget {
            max-width: 100%;
            width: calc(100% - 40px);
        }
        
        .chatbot-container {
            width: 100%;
            height: 400px;
        }
        
        .filter-group {
            flex-direction: column;
            gap: 10px;
        }
        
        .filter-item {
            min-width: auto;
        }
        
        .lead-table {
            display: block;
            overflow-x: auto;
        }
    }

    @media (max-width: 480px) {
        .chatbot-container {
            height: 350px;
        }
        
        .action-buttons {
            flex-direction: column;
        }
    }

    /* Alert messages */
    .alert {
        padding: 10px 15px;
        margin-bottom: 15px;
        border-radius: var(--chatbot-border-radius);
    }

    .alert-success {
        background-color: #d4edda;
        color: #155724;
        border: 1px solid #c3e6cb;
    }

    .alert-danger {
        background-color: #f8d7da;
        color: #721c24;
        border: 1px solid #f5c6cb;
    }

    .alert-warning {
        background-color: #fff3cd;
        color: #856404;
        border: 1px solid #ffeeba;
    }

    /* Loading spinner */
    .spinner {
        width: 40px;
        height: 40px;
        margin: 20px auto;
        border: 4px solid rgba(0, 0, 0, 0.1);
        border-left-color: var(--chatbot-primary-color);
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

    @keyframes spin {
        to { transform: rotate(360deg); }
    }

    /* Footer */
    .footer {
        background-color: var(--chatbot-dark-color);
        color: white;
        padding: 20px 0;
        text-align: center;
    }
}