/* KeelCDP Lead Builder - Professional UI */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #ffffff;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: #fafafa;
    border-right: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
    z-index: 100;
}

.sidebar.collapsed {
    transform: translateX(-260px);
}

/* Floating Sidebar Toggle Button */
.sidebar-floating-toggle {
    position: fixed;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    z-index: 1000;
    white-space: nowrap;
}

.sidebar-floating-toggle:hover {
    background: #1d4ed8;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.sidebar-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.sidebar-toggle:hover {
    color: #1a1a1a;
}

.toggle-icon {
    font-size: 14px;
    font-weight: 600;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.filter-list-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
}

.filter-list-loading p {
    color: #666;
    font-size: 13px;
    margin-top: 8px;
}

.filter-item {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 10px 12px;
    margin-bottom: 6px;
    cursor: pointer;
    position: relative;
}

.filter-item:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.filter-item.active {
    background: #f0f7ff;
    border-color: #2563eb;
}

.filter-schedule-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
}

.filter-item:hover .filter-schedule-btn {
    opacity: 1;
}

.filter-schedule-btn:hover {
    background: #1d4ed8;
}

.filter-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 3px;
    padding-right: 60px;
}

.filter-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #666;
}

.filter-item-date {
    display: flex;
    align-items: center;
}

.filter-item-badge {
    background: #f0f0f0;
    padding: 1px 5px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 500;
    color: #666;
}

.filter-item-badge.static {
    background: #fef3c7;
    color: #92400e;
}

.filter-item-badge.favorite {
    background: #fee2e2;
    color: #b91c1c;
}

.filter-item-count {
    background: #2563eb;
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

.sidebar-empty {
    text-align: center;
    padding: 32px 16px;
    color: #888;
    font-size: 13px;
}

.chatbot-container {
    flex: 1;
    margin-left: 260px;
    height: 100vh;
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: margin-left 0.2s ease;
}

.sidebar.collapsed + .sidebar-floating-toggle + .chatbot-container {
    margin-left: 0;
}

/* Header */
.chatbot-header {
    background: #fafafa;
    color: #1a1a1a;
    padding: 16px 32px;
    border-bottom: 1px solid #e5e5e5;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1100px;
    margin: 0 auto;
    gap: 16px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    height: 32px;
    width: auto;
}

.header-text h1 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
    color: #1a1a1a;
}

.dealership-selector-wrapper {
    flex-shrink: 0;
}

.dealership-select {
    padding: 8px 12px;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    background: white;
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    cursor: pointer;
    outline: none;
    min-width: 220px;
}

.dealership-select:hover {
    border-color: #999;
}

.dealership-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.header-text p {
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
}

/* Footer */
.app-footer {
    padding: 8px 32px;
    background: #fafafa;
    border-top: 1px solid #e5e5e5;
    font-size: 11px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.footer-separator {
    color: #ccc;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    background: #ffffff;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Message Styles */
.message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.user-message {
    flex-direction: row-reverse;
}

.message-content {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.user-message .message-content {
    align-items: flex-end;
    max-width: 70%;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 6px;
    line-height: 1.5;
    word-wrap: break-word;
    font-size: 13px;
}

.bot-message .message-bubble {
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    color: #333;
}

.user-message .message-bubble {
    background: #2563eb;
    color: white;
}

.message-bubble p {
    margin: 0 0 8px 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-time {
    font-size: 11px;
    color: #888;
    padding: 0 2px;
}

/* Suggestions */
.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.suggestion-chip {
    background: white;
    border: 1px solid #d4d4d4;
    border-radius: 3px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    color: #444;
    font-weight: 500;
}

.suggestion-chip:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.2s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.4;
    }
    30% {
        opacity: 1;
    }
}

/* Input Area */
.chatbot-input {
    background: #fafafa;
    padding: 16px 32px;
    border-top: 1px solid #e5e5e5;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
}

#userInput {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    background: white;
    color: #1a1a1a;
}

#userInput:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

#userInput::placeholder {
    color: #888;
}

.send-btn {
    padding: 10px 20px;
    background: #2563eb;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.send-btn:hover {
    background: #1d4ed8;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}



/* Error Message */
.error-message {
    background: #fef2f2;
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 13px;
    border-left: 3px solid #dc2626;
}

/* View Data Button */
.view-data-btn {
    margin-top: 10px;
    padding: 8px 14px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.view-data-btn:hover {
    background: #1d4ed8;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 6px;
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #888;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    line-height: 1;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #444;
}

.modal-body {
    flex: 1;
    overflow: hidden;
    padding: 20px;
}

.modal-table-info {
    margin-bottom: 12px;
    font-size: 13px;
    color: #666;
}

.modal-table-wrapper {
    overflow: auto;
    max-height: calc(90vh - 180px);
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.modal-table thead {
    background: #fafafa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #444;
    border-bottom: 1px solid #e5e5e5;
    white-space: nowrap;
}

.modal-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

.modal-table tbody tr:hover {
    background: #fafafa;
}

.modal-table tbody tr:last-child td {
    border-bottom: none;
}

.equity-cell {
    font-weight: 600;
    color: #059669;
}

.empty-cell {
    color: #ccc;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary,
.btn-secondary {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #f0f0f0;
    color: #444;
}

.btn-secondary:hover {
    background: #e5e5e5;
}

/* Email Modal */
.email-modal {
    max-width: 450px;
}

.email-form {
    margin: 16px 0;
}

.email-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.email-form input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

.email-form input[type="email"]:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.email-error {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border-left: 3px solid #dc2626;
    border-radius: 3px;
    color: #b91c1c;
    font-size: 12px;
}

.email-success {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    border-radius: 3px;
    color: #16a34a;
    font-size: 12px;
}

/* Schedule Modal */
.schedule-modal {
    max-width: 480px;
}

.schedule-form {
    margin: 16px 0;
}

.schedule-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
    margin-top: 14px;
}

.schedule-form label:first-child {
    margin-top: 0;
}

.schedule-form input[type="email"],
.schedule-form input[type="time"],
.schedule-form input[type="datetime-local"],
.schedule-form input[type="number"],
.schedule-form select,
.schedule-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}

/* Ensure both day input and select have identical dimensions */
.schedule-day-field {
    display: none;
    width: 100%;
    height: 40px;
    padding: 10px 12px;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
    background-color: white;
}

.schedule-day-field:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

#scheduleDayHint {
    display: none;
}

.schedule-form input:focus,
.schedule-form select:focus,
.schedule-form textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.schedule-form select {
    cursor: pointer;
    background-color: white;
}

.schedule-form textarea {
    resize: vertical;
    min-height: 50px;
}

.schedule-error {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border-left: 3px solid #dc2626;
    border-radius: 3px;
    color: #b91c1c;
    font-size: 12px;
}

.schedule-success {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    border-radius: 3px;
    color: #16a34a;
    font-size: 12px;
}

.btn-spinner {
    display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }

    .sidebar.collapsed {
        transform: translateX(-240px);
    }

    .chatbot-container {
        margin-left: 240px;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .email-modal,
    .schedule-modal {
        width: 90%;
        height: auto;
        max-width: 90%;
    }

    .modal-table-wrapper {
        max-height: calc(100vh - 160px);
    }

    .modal-table {
        font-size: 11px;
    }

    .modal-table th,
    .modal-table td {
        padding: 8px 10px;
    }

    .chatbot-header {
        padding: 12px 16px;
    }

    .header-text h1 {
        font-size: 15px;
    }

    .chatbot-messages {
        padding: 16px 12px;
    }

    .chatbot-input {
        padding: 12px 16px;
    }

    .message-content {
        max-width: 85%;
    }

    .send-btn {
        padding: 10px 16px;
    }

    .suggestion-chip {
        font-size: 11px;
        padding: 5px 10px;
    }
}
