* {
    box-sizing: border-box;
}

body {
    background-color: #f0f2f5c4;
    /* Warna abu-abu muda seperti WA Web */
    font-family: system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    overscroll-behavior: contain;
    font-size: 16px;
}

#chat-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

#chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('bg-chat.png');
    background-repeat: repeat;
    opacity: 0.27;
    z-index: 0;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 100vh;
    position: relative;
    padding: 16px;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('bg-chat.png');
    opacity: 0.36;
    z-index: 1;
}

#chat-header {
    background-color: #075e54;
    color: white;
    padding-top: calc(14px + env(safe-area-inset-top));
    padding: 14px 16px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 72px;
    flex-shrink: 0;
}

#chat-header img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    margin-right: 12px;
    background: #ddd;
    flex-shrink: 0;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    position: relative;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
}

.date-separator {
    text-align: center;
    margin: 12px 0;
    font-size: 0.8em;
    background: #05874aff;
    padding: 4px 12px;
    border-radius: 12px;
    color: #f6f8f9ff;
    font-weight: 600;
    max-width: 210px;
    margin-left: auto;
    margin-right: auto;
}

.message-group {
    display: flex;
    align-items: center;
    position: relative;
    max-width: 100%;
}

.message-group.user {
    justify-content: flex-end;
    padding-right: 20px;
}

.message-group.bot {
    padding-left: 20px;
}

.message-content {
    display: flex;
    flex-direction: column;
    position: relative;
    max-width: 85%;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 10px;
    word-wrap: break-word;
    line-height: 1.5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 17px;
}

.user .message-bubble {
    background-color: #dcf8c6;
    border-bottom-right-radius: 2px;
}

.bot .message-bubble {
    background-color: #ffffff;
    border-bottom-left-radius: 2px;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.message-group.bot .message-avatar {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

.message-group.user .message-content .message-avatar {
    position: absolute;
    right: -18px;
    top: 35%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.message-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 4px;
    gap: 12px;
    height: 20px;
}

.message-reactions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.message-group.bot:hover .message-reactions {
    opacity: 1;
}

.reaction-btn {
    cursor: pointer;
    font-size: 16px;
    color: #888;
    transition: transform 0.2s, color 0.2s;
}

.reaction-btn:hover {
    transform: scale(1.2);
}

.reaction-btn.fa-thumbs-up:hover {
    color: #28a745;
}

.reaction-btn.fa-thumbs-down:hover {
    color: #dc3545;
}

.reaction-btn.selected {
    color: #075e54;
    transform: scale(1.1);
}

.reaction-btn.fa-thumbs-down.selected {
    color: #dc3545;
}

.admin-approved .fa-thumbs-up {
    color: #0d6efd !important;
    cursor: default;
}

.admin-approved .fa-thumbs-down {
    display: none;
}

.message-time {
    font-size: 0.75em;
    color: #999;
    opacity: 0.8;
}

#bot-typing-indicator {
    display: none;
    align-items: flex-start;
    margin-bottom: 12px;
    max-width: 85%;
    padding-left: 12px;
}

#bot-typing-indicator .typing-bubble {
    background: #f1f0f1;
    padding: 10px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

#chat-input-area {
    display: flex;
    padding: 10px 14px;
    background: white;
    border-top: 1px solid #d1d1d1;
    align-items: flex-end;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
    gap: 8px;
}

#user-message {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 16px;
    font-size: 17px;
    border-radius: 24px;
    background: #f0f0f0;
    resize: none;
    min-height: 28px;
    max-height: 140px;
    overflow-y: auto;
    line-height: 1.5;
    font-family: inherit;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

#send-btn {
    background: #075e54;
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

#send-btn:hover {
    background: #128c7e;
}

.identity-form {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 16px;
}

#scroll-to-bottom {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #075e54;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#scroll-to-bottom.show {
    opacity: 1;
}

#scroll-to-bottom i {
    font-size: 20px;
}

#location-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

@media (max-width: 768px) {
    .message-bubble {
        font-size: 18px !important;
        padding: 14px 18px;
    }

    .message-time {
        font-size: 0.7em;
    }

    .date-separator {
        font-size: 0.8em;
        padding: 4px 10px;
    }

    input,
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Style untuk input dengan ikon */
.input-group-icon {
    position: relative;
}

.input-group-icon .form-control {
    padding-left: 2.5rem;
}

.input-group-icon .input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

/* --- Login Redesign Styles --- */
.login-wrapper {
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Left Side Content */
.info-content {
    position: relative;
    max-width: 650px;
    margin: 0 auto;
}

.features-list .d-flex {
    align-items: flex-start;
}

.features-list i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* Decorative Circle */
.decorative-circle {
    position: absolute;
    top: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(7, 94, 84, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
}

/* Right Side Login Container Override */
.login-wrapper .login-container {
    min-height: auto;
    box-shadow: none;
    background: transparent;
    padding: 0;
}

.login-wrapper .login-container::before {
    display: none;
}

/* Ensure the right column has the white background */
.col-lg-5.bg-white {
    background-color: #ffffff !important;
    z-index: 10;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .login-wrapper {
        height: auto;
        overflow-y: auto;
    }

    .login-wrapper .row {
        height: auto;
    }

    .col-lg-5 {
        min-height: 100vh;
        padding: 40px 20px;
    }
}

/* --- Login Form Refinements --- */

/* Container Spacing */
.login-container {
    width: 100%;
    padding: 0 1rem;
}

/* Form Labels */
#identity-form .form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

/* Input Group Styling Override */
#identity-form .input-group {
    position: relative;
    display: flex !important;
    /* Use flex to align icon and input */
    align-items: center;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
}

#identity-form .input-group:focus-within {
    box-shadow: 0 0 0 3px rgba(7, 94, 84, 0.15);
}

/* Input Fields */
#identity-form .form-control {
    padding: 0.75rem 1rem;
    /* Hapus padding kiri, Bootstrap akan menanganinya */
    border: 1px solid #ced4da;
    border-left: none;
    /* Hapus border kiri agar menyatu dengan ikon */
    border-radius: 0 0.5rem 0.5rem 0 !important;
    /* Sesuaikan border-radius */
    font-size: 1rem;
    height: auto;
    transition: border-color 0.2s;
}

#identity-form .form-control:focus {
    border-color: #075e54;
    box-shadow: none;
}

/* Input Icons */
#identity-form .input-icon {
    padding: 0.75rem 1rem;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-right: none;
    /* Hapus border kanan */
    border-radius: 0.5rem 0 0 0.5rem;
    color: #adb5bd;
    font-size: 1.1rem;
    margin-bottom: 0;
    /* Override default icon margin */
    transition: color 0.2s;
}

#identity-form .input-group:focus-within .input-icon {
    color: #075e54;
}

/* Buttons */
.btn-primary {
    background-color: #c85231 !important;
    /* Orange-ish color from image */
    border-color: #c85231 !important;
    font-weight: 600;
    padding: 0.8rem 1rem;
    border-radius: 0.5rem;
}

.btn-primary:hover {
    background-color: #b04223 !important;
    border-color: #b04223 !important;
}

.btn-outline-primary {
    color: #495057;
    border-color: #ced4da;
    font-weight: 500;
    padding: 0.7rem 1rem;
    border-radius: 0.5rem;
}

.btn-outline-primary:hover {
    background-color: #f8f9fa;
    color: #212529;
    border-color: #adb5bd;
}

/* Divider */
.text-muted.small {
    background: #fff;
    font-weight: 500;
    color: #adb5bd !important;
}

/* Table styling for chat messages */
.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.85rem;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    overflow: hidden;
}

.message-bubble th,
.message-bubble td {
    padding: 8px 10px;
    vertical-align: top;
    border: 1px solid rgba(0, 0, 0, 0.1);
    text-align: left;
}

.message-bubble th {
    background-color: rgba(0, 0, 0, 0.04);
    font-weight: 600;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
}