/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.chat-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chat-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 650px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
    flex: 1;
}

.chat-header-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.chat-new-session-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.chat-new-session-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.chat-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f7f8fa;
}

.chat-message {
    margin-bottom: 16px;
    display: flex;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e4e8;
    border-bottom-left-radius: 4px;
}

.message-content p {
    margin: 0;
    line-height: 1.4;
}

.message-content p + p {
    margin-top: 8px;
}

.message-content b,
.message-content strong {
    font-weight: 600;
    color: #667eea;
}

.bot-message .message-content b,
.bot-message .message-content strong {
    color: #667eea;
}

.user-message .message-content b,
.user-message .message-content strong {
    color: white;
    font-weight: 700;
}

.message-hint {
    font-size: 13px;
    opacity: 0.8;
    font-style: italic;
}

.chat-input-container {
    padding: 14px;
    background: white;
    border-top: 1px solid #e1e4e8;
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.chat-input:disabled {
    background-color: #f7f8fa;
    cursor: not-allowed;
}

.chat-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chat-send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .chat-container {
        width: calc(100vw - 40px);
        height: calc(100vh - 110px);
        bottom: 70px;
    }
    
    .chat-toggle-btn {
        width: 56px;
        height: 56px;
    }
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.typing-indicator .message-content {
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #667eea;
    animation: typingAnimation 1.0s infinite;
}

.typing-indicator .dot:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator .dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingAnimation {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Interactive Buttons */
.chat-button-container {
    margin-top: 8px;
    display: flex;
    gap: 6px;
}

.chat-button-container.yes-no {
    flex-direction: row;
}

.chat-button-container.multiple-choice {
    flex-direction: column;
}

.chat-button {
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.chat-button:active:not(:disabled) {
    transform: translateY(0);
}

.chat-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Yes/No button styles */
.chat-button.yes-button {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    flex: 1;
}

.chat-button.yes-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #218838 0%, #1aa179 100%);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
}

.chat-button.no-button {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    flex: 1;
}

.chat-button.no-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #bd2130 0%, #a71d2a 100%);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}

/* Multiple choice button styles */
.chat-button.choice-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
    text-align: left;
    padding-left: 12px;
}

.chat-button.choice-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Company option buttons - larger, more detailed */
.chat-button.company-option {
    background: white;
    color: #333;
    border: 2px solid #667eea;
    text-align: left;
    padding: 10px 14px;
    font-weight: 500;
    min-height: 44px;
}

.chat-button.company-option:hover:not(:disabled) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #764ba2;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Button container animation */
.chat-button-container {
    animation: buttonSlideIn 0.3s ease-out;
}

@keyframes buttonSlideIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mode Selection Screen */
.chat-mode-selection {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f7f8fa;
}

.mode-selection-content {
    width: 100%;
    max-width: 320px;
}

.mode-selection-content h4 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
}

.mode-btn {
    width: 100%;
    background: white;
    border: 2px solid #e1e4e8;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.mode-btn:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.mode-btn svg {
    color: #667eea;
    margin-bottom: 4px;
}

.mode-btn span {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: block;
}

.mode-btn small {
    font-size: 13px;
    color: #666;
    font-weight: 400;
    display: block;
}

/* Quick Quote Modal */
.quick-quote-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.quick-quote-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.quick-quote-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quick-quote-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.quick-quote-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.quick-quote-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.quick-quote-body {
    padding: 24px;
}

.form-row {
    margin-bottom: 20px;
    display: flex;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    flex: 1 1 100%;
}

.form-group.half-width {
    flex: 1 1 calc(50% - 8px);
    position: relative;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.form-group input.form-control {
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input.form-control:disabled,
.form-group input.form-control[readonly] {
    background-color: #f7f8fa;
    cursor: not-allowed;
}

.btn-calculate-mileage {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-calculate-mileage:hover:not(:disabled) {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-calculate-mileage:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-actions {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.btn-submit-quote {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 160px;
}

.btn-submit-quote:hover:not(:disabled) {
    background: linear-gradient(135deg, #218838 0%, #1aa179 100%);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
    transform: translateY(-2px);
}

.btn-submit-quote:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.quote-results {
    margin-top: 28px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    border: 2px solid #667eea;
}

.quote-results h4 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.quote-range {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.quote-value {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.quote-value label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quote-value span {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
}

.quote-value.low span {
    color: #28a745;
}

.quote-value.high span {
    color: #dc3545;
}

.quote-disclaimer {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin: 0;
    font-style: italic;
}

.quote-error {
    margin-top: 12px;
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-size: 14px;
    text-align: center;
}

/* Mobile responsiveness for Quick Quote modal */
@media (max-width: 640px) {
    .quick-quote-content {
        max-height: 95vh;
    }
    
    .quick-quote-body {
        padding: 16px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-group.half-width {
        flex: 1 1 100%;
    }
    
    .btn-calculate-mileage {
        position: static;
        width: 100%;
        margin-top: 8px;
    }
    
    .quote-range {
        flex-direction: column;
        gap: 12px;
    }
    
    .quote-value span {
        font-size: 24px;
    }
}

