:root {
    --bg-color: #0d0d0d;
    --chat-bg: #1a1a1a;
    --primary-color: #d4af37;
    /* Gold */
    --primary-hover: #b5952f;
    --text-color: #ffffff;
    --text-muted: #a0a0a0;
    --input-bg: #262626;
    --bot-msg-bg: #2d2d2d;
    --user-msg-bg: #d4af37;
    --user-msg-text: #000000;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

.chat-wrapper {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background-color: var(--chat-bg);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    border-right: 1px solid #333;
    border-left: 1px solid #333;
}

@media (min-width: 481px) {
    .chat-wrapper {
        height: 90vh;
        border-radius: 16px;
        border: 1px solid #333;
    }
}

/* Header */
.chat-header {
    padding: 16px 20px;
    background: rgba(26, 26, 26, 0.95);
    border-bottom: 1px solid #333;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #FFD700, #B8860B);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000;
}

.header-info h3 {
    font-size: 16px;
    font-weight: 600;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #00ff41;
    border-radius: 50%;
    margin-right: 4px;
}

.status-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* Chat Body */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-thumb {
    background-color: #333;
    border-radius: 3px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease-out;
    word-wrap: break-word;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-message {
    background-color: var(--bot-msg-bg);
    color: var(--text-color);
    border-top-left-radius: 2px;
}

.user-message {
    background-color: var(--user-msg-bg);
    color: var(--user-msg-text);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    font-weight: 500;
}

/* Footer */
.chat-footer {
    padding: 16px;
    background-color: var(--chat-bg);
    border-top: 1px solid #333;
    display: flex;
    gap: 10px;
}

#user-input {
    flex: 1;
    background-color: var(--input-bg);
    border: 1px solid #333;
    padding: 12px 16px;
    border-radius: 24px;
    color: white;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

#user-input:focus {
    border-color: var(--primary-color);
}

#send-btn {
    background-color: var(--primary-color);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #000;
    transition: transform 0.2s, background-color 0.2s;
}

#send-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

#send-btn:active {
    transform: scale(0.95);
}

/* Loading Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background-color: var(--bot-msg-bg);
    border-radius: 12px;
    border-top-left-radius: 2px;
    width: fit-content;
    display: none;
    /* hidden by default */
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #888;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Save Message Feature */
.message {
    position: relative;
    padding-right: 32px;
    /* Space for save button */
}

.save-msg-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0;
}

.message:hover .save-msg-btn,
.save-msg-btn.saved {
    opacity: 1;
}

.save-msg-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.save-msg-btn.saved {
    color: var(--primary-color);
}

.view-saved-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}

.view-saved-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease-out;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--chat-bg);
    border: 1px solid #333;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.close-modal {
    color: #888;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #fff;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 14px;
    padding: 20px 0;
}

.saved-item {
    background-color: #262626;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    border-left: 3px solid var(--primary-color);
    position: relative;
    padding-right: 30px;
}

.saved-item .delete-saved {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.saved-item .delete-saved:hover {
    background-color: rgba(255, 0, 0, 0.2);
    color: #ff4d4d;
}

.saved-item-role {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}