/* assets/css/style.css */

:root {
    --bg-color: #f0f2f5;
    --chat-bg: #e5ddd5;
    --header-bg: #075e54;
    --header-text: #ffffff;
    --my-message-bg: #dcf8c6;
    --bot-message-bg: #ffffff;
    --text-color: #303030;
    --time-color: #999999;
    --input-bg: #f0f0f0;
    --bubble-radius: 12px;
}

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

body, html {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* For mobile browsers with dynamic UI */
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--chat-bg);
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

/* Header */
.chat-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    border: 2px solid rgba(255,255,255,0.2);
}

.contact-info {
    display: flex;
    flex-direction: column;
}

.contact-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.status {
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #25d366;
    border-radius: 50%;
    display: inline-block;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.header-btn {
    background: none;
    border: none;
    color: var(--header-text);
    cursor: pointer;
    padding: 6px;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-btn:hover {
    opacity: 1;
}

.header-btn svg {
    width: 22px;
    height: 22px;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h100v100H0z" fill="%23e5ddd5"/><path d="M... (minimal repeating pattern could go here, omitting for clean look)" fill="%23d8cbb8" fill-opacity="0.2"/></svg>');
    scroll-behavior: smooth;
}

.message-wrapper {
    display: flex;
    width: 100%;
}

.message-wrapper.bot {
    justify-content: flex-start;
}

.message-wrapper.visitor {
    justify-content: flex-end;
}

.bubble {
    max-width: 80%;
    padding: 10px 14px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    color: var(--text-color);
}

.bubble.bot {
    background-color: var(--bot-message-bg);
    border-radius: var(--bubble-radius) var(--bubble-radius) var(--bubble-radius) 0;
}

.bubble.visitor {
    background-color: var(--my-message-bg);
    border-radius: var(--bubble-radius) var(--bubble-radius) 0 var(--bubble-radius);
}

.bubble img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: zoom-in;
    margin-top: 5px;
    display: block;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    margin-bottom: 20px; /* Space for the typing bubbles */
}

.bubble.typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 18px;
    min-width: 60px;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: #90949c;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input Area */
.chat-input-area {
    background-color: var(--input-bg);
    padding: 10px;
    z-index: 10;
}

#chat-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

#message-input {
    flex: 1;
    border: none;
    padding: 12px 16px;
    border-radius: 24px;
    font-size: 15px;
    outline: none;
    font-family: inherit;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

#send-button {
    background-color: var(--header-bg);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

#send-button:active {
    transform: scale(0.95);
}

#send-button svg {
    width: 20px;
    height: 20px;
}

#send-button:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}

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

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    animation: zoom 0.3s;
}

@keyframes zoom {
    from {transform: scale(0.8)}
    to {transform: scale(1)}
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Info Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal-box {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px;
    max-width: 90%;
    width: 320px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideUp 0.3s ease-out;
    color: #303030;
}

.modal-box p {
    margin-bottom: 12px;
    line-height: 1.5;
    font-size: 14.5px;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 18px;
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
