/* General Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: url('background.jpg') no-repeat center center fixed;
    background-size: cover;
    position: relative;
}

/* Add overlay to make text more readable */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: -1;
}

/* Chat Toggle Button */
.chat-toggle {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 64px;
    height: 64px;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(106, 34, 201);
    color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    cursor: pointer;
}

.chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(106, 34, 201, 0.4);
}

/* Chat Container */
.chat-container {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 390px;
    height: 700px;
    display: none;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.chat-container.show {
    display: flex;
}

.chat-container.minimized {
    height: 60px;
    overflow: hidden;
}

/* Intercom-style Header */
.intercom-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
}

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

.header-back-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.header-back-btn:hover {
    background: #f8f9fa;
}

.header-title {
    font-size: 14px;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-btn:hover {
    background: #f8f9fa;
}

/* Card overrides */
.card {
    border: none;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 15px 20px;
}

.chat-messages {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100% - 120px); /* Account for header and input */
    scrollbar-width: thin;
    scrollbar-color: #dfe6e9 transparent;
}

/* Custom scrollbar for WebKit browsers */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #dfe6e9;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: #b2bec3;
}

.card-footer {
    background-color: #f8f9fa;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 15px;
}

/* Message Styles */
.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
}

.message {
    max-width: 80%;
    padding: 10px 16px 8px;
    border-radius: 18px;
    position: relative;
    line-height: 1.4;
    word-wrap: break-word;
    font-size: 14px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-bottom: 4px;
}

.message.sent {
    background: rgb(106, 34, 201);  /* Purple */
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.received {
    background: #f1f2f6;  /* Light grey */
    color: #2f3542;      /* Dark grey text */
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message:first-child {
    margin-top: auto;
}

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

.message-content {
    margin-bottom: 4px;
}

.message-sender {
    font-weight: 600;
    font-size: 12px;
    color: inherit;
    opacity: 0.9;
}

.message.sent .message-sender {
    color: rgba(255, 255, 255, 0.9);
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-left: 8px;
    font-weight: 400;
}

.message.sent .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.message-text {
    line-height: 1.4;
    white-space: pre-wrap;
}

/* Input Area */
.input-group {
    display: flex;
    gap: 8px;
    background: white;
    border: 1px solid #dee2e6;
}

.form-control {
    border: none;
    padding: 10px 15px;
    font-size: 14px;
}

.form-control:focus {
    box-shadow: none;
}

.btn-primary {
    background-color: #6f42c1;
    border-color: #6f42c1;
}

.btn-primary:hover {
    background-color: #5a32a3;
    border-color: #5a32a3;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
