/* Chat Interface Styles - Mailbox Style */

/* Navbar Card */
.navbar-card {
    max-width: 1000px;
    margin: 1rem auto 0.5rem;
    width: calc(100% - 2rem);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Main Content Area */
.app-main {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    margin: 0 auto;
    width: calc(100% - 2rem);
    max-height: calc(100vh - 200px);
}

/* Session Header */
.chat-session-header {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* Footer Card */
.footer-card {
    max-width: 1000px;
    margin: 0.5rem auto 1rem;
    width: calc(100% - 2rem);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-light);
}

.footer-card a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer-card a:hover {
    text-decoration: underline;
}

.session-id {
    font-size: 0.75rem;
    color: var(--text-light);
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.welcome-icon {
    width: 64px;
    height: 64px;
    stroke: var(--primary-color);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.5;
}

.welcome-message p {
    font-size: 1rem;
    line-height: 1.5;
}

/* Message Bubbles */
.message {
    max-width: 70%;
    padding: 0.375rem 0.625rem;
    border-radius: 10px;
    word-wrap: break-word;
    animation: messageSlideIn 0.3s ease-out;
    line-height: 1.3;
    position: relative;
}

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

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 10px 10px 2px 10px;
    box-shadow: 0 1px 4px rgba(70, 130, 180, 0.25);
}

.message.agent {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-color);
    border: 1px solid var(--glass-border);
    border-radius: 10px 10px 10px 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.message.system {
    align-self: center;
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-light);
    border: 1px solid rgba(59, 130, 246, 0.2);
    font-size: 0.75rem;
    font-style: italic;
    max-width: 80%;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
}

.message.error {
    align-self: center;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
    max-width: 80%;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
}

.message-content {
    font-size: 0.8125rem;
    line-height: 1.3;
}

.message-time {
    font-size: 0.625rem;
    opacity: 0.6;
    margin-top: 0.125rem;
    line-height: 1;
}

/* File preview styles */
.file-preview {
    margin-bottom: 0.25rem;
}

.preview-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s;
}

.preview-image:hover {
    opacity: 0.9;
}

.file-info {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    opacity: 0.8;
}

.file-icon {
    font-size: 1.1em;
}

/* Sticker preview */
.sticker-container {
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-preview {
    cursor: default;
}

/* Message Action Buttons */
.message-actions {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0.25rem;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.message.user .message-actions {
    left: -70px;
}

.message.agent .message-actions {
    right: -70px;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #333;
}

.message-action-btn svg {
    width: 14px;
    height: 14px;
    stroke: #333;
}

.message-action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message-action-btn.reply-btn:hover {
    background: rgba(70, 130, 180, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.message-action-btn.reply-btn:hover svg {
    stroke: var(--primary-color);
}

.message-action-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.message-action-btn.delete-btn:hover svg {
    stroke: #ef4444;
}

/* Reply Preview */
.reply-preview {
    padding: 0.75rem 1rem;
    background: rgba(70, 130, 180, 0.1);
    border-left: 3px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reply-preview-content {
    flex: 1;
    min-width: 0;
}

.reply-preview-header {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.reply-preview-text {
    font-size: 0.875rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-preview-close {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.reply-preview-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
}

/* Image Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2001;
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
}

.image-modal-close:hover {
    background: white;
    transform: scale(1.1);
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.image-modal-info {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.modal-download-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s;
}

.modal-download-btn:hover {
    background: var(--accent-color);
    transform: translateY(-1px);
}

.modal-download-btn svg {
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Typing Indicator */
.typing-indicator {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-top: 1px solid var(--glass-border);
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: typingBounce 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 typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.typing-text {
    font-size: 0.8125rem;
    color: var(--text-light);
    font-style: italic;
}

/* Chat Input Footer */
.chat-input-footer {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.3);
    position: relative;
}

.chat-input-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 1rem;
    width: 320px;
    max-height: 350px;
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    margin-bottom: 0.5rem;
    z-index: 1000;
}

.emoji-picker-header {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px 12px 0 0;
}

.emoji-category {
    padding: 0.375rem 0.5rem;
    cursor: pointer;
    border-radius: 6px;
    font-size: 1.25rem;
    transition: background 0.2s;
    user-select: none;
}

.emoji-category:hover {
    background: rgba(70, 130, 180, 0.1);
}

.emoji-category.active {
    background: var(--primary-color);
    transform: scale(1.1);
}

.emoji-picker-body {
    padding: 0.75rem;
    max-height: 280px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.25rem;
}

.emoji-item {
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.375rem;
    text-align: center;
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
}

.emoji-item:hover {
    background: rgba(70, 130, 180, 0.1);
    transform: scale(1.2);
}

.emoji-picker-body::-webkit-scrollbar {
    width: 6px;
}

.emoji-picker-body::-webkit-scrollbar-track {
    background: transparent;
}

.emoji-picker-body::-webkit-scrollbar-thumb {
    background: rgba(70, 130, 180, 0.3);
    border-radius: 3px;
}

.emoji-picker-body::-webkit-scrollbar-thumb:hover {
    background: rgba(70, 130, 180, 0.5);
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(70, 130, 180, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(70, 130, 180, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-card, .footer-card {
        margin-left: 0.75rem;
        margin-right: 0.75rem;
        width: calc(100% - 1.5rem);
    }

    .chat-container {
        width: calc(100% - 1.5rem);
        max-height: calc(100vh - 180px);
    }

    .chat-input-footer {
        padding: 0.75rem;
    }

    .chat-session-header {
        padding: 0.5rem 0.75rem;
    }

    .chat-messages {
        padding: 0.5rem;
        gap: 0.375rem;
    }

    .message {
        max-width: 80%;
        padding: 0.375rem 0.625rem;
    }

    .session-id {
        font-size: 0.6875rem;
    }
}

@media (max-width: 480px) {
    .navbar-card {
        padding: 0.5rem;
    }

    .chat-input-footer {
        padding: 0.75rem 0.5rem;
    }

    .footer-card {
        padding: 0.375rem 0.5rem;
        font-size: 0.65rem;
    }

    .message {
        max-width: 85%;
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }

    .session-id {
        display: none;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
}

.toast.toast-success::before {
    background: #10b981;
}

.toast.toast-error::before {
    background: #ef4444;
}

.toast.toast-warning::before {
    background: #f59e0b;
}

.toast.toast-info::before {
    background: var(--primary-color);
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.toast-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.toast.toast-success .toast-icon {
    color: #10b981;
}

.toast.toast-error .toast-icon {
    color: #ef4444;
}

.toast.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast.toast-info .toast-icon {
    color: var(--primary-color);
}

.toast-message {
    flex: 1;
    color: var(--text-dark);
    font-size: 0.875rem;
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-dark);
}

.toast.toast-exit {
    animation: toastSlideOut 0.3s ease-in forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Confirm Dialog */
.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.confirm-content {
    position: relative;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
}

.confirm-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.confirm-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
}

.confirm-body {
    padding: 1.5rem;
}

.confirm-body p {
    margin: 0;
    color: var(--text-dark);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.confirm-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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