* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: #0a0e11;
    color: #e9edef;
    height: 100vh;
    overflow: hidden;
}

body[data-theme="instagram"] {
    background-color: #000000;
    color: #262626;
}

.app-container {
    max-width: 450px;
    height: 100vh;
    margin: 0 auto;
    background-color: #0b141a;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-header {
    background-color: #202c33;
    padding: 10px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.back-button {
    background: none;
    border: none;
    color: #aebac1;
    cursor: pointer;
    padding: 5px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    cursor: pointer;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #6b7c85;
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 16px;
    font-weight: 400;
    color: #e9edef;
}

.user-status {
    font-size: 13px;
    color: #8696a0;
}

.header-actions {
    display: flex;
    gap: 20px;
}

.icon-button {
    background: none;
    border: none;
    color: #aebac1;
    cursor: pointer;
    padding: 5px;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAARklEQVQYV2NkYGD4z0ABYBw1kL6WMjAw/CdDIQMDw39iLf3PwMDwn1hLGaCW/idRIQMTA8N/Ei1lZGD4T4IiRoIUjRpIAABYvBMJOJVKqgAAAABJRU5ErkJggg==');
    background-size: 200px;
    padding: 20px 8px 80px 8px;
    scroll-behavior: smooth;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.date-divider {
    text-align: center;
    margin: 20px 0;
}

.date-divider span {
    background-color: #1f2c34;
    padding: 5px 12px;
    border-radius: 7px;
    font-size: 12px;
    color: #8696a0;
}

.message {
    max-width: 65%;
    margin: 2px 0;
    display: flex;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.sent {
    align-self: flex-end;
    margin-left: auto;
}

.message.received {
    align-self: flex-start;
}

.message-bubble {
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
}

.message.sent .message-bubble {
    background-color: #005c4b;
    border-top-right-radius: 0;
}

.message.received .message-bubble {
    background-color: #202c33;
    border-top-left-radius: 0;
}

.message-bubble p {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    color: #8696a0;
    margin-top: 4px;
    text-align: right;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #8696a0;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.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(-10px);
    }
}

.chat-input-container {
    background-color: #202c33;
    padding: 10px 16px;
    border-top: 1px solid #2a3942;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #2a3942;
    border-radius: 25px;
    padding: 5px 5px 5px 20px;
}

.chat-input {
    flex: 1;
    background: none;
    border: none;
    color: #e9edef;
    font-size: 15px;
    outline: none;
}

.chat-input::placeholder {
    color: #8696a0;
}

.send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #00a884;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.send-button:hover {
    background-color: #00937a;
}

.choice-container {
    background-color: #202c33;
    padding: 10px 16px;
    border-top: 1px solid #2a3942;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.choice-button {
    background-color: #00a884;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
}

.choice-button:hover {
    background-color: #00937a;
}

.message-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.message-choice-button {
    background-color: transparent;
    color: #00a884;
    border: 1px solid #00a884;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    white-space: nowrap;
    word-wrap: break-word;
    max-width: 100%;
}

.message-choice-button:hover:not(:disabled) {
    background-color: #00a884;
    color: white;
}

.message-choice-button:disabled {
    cursor: not-allowed;
}

.choice-message .message-bubble {
    max-width: 80%;
}

.message.sent .message-choice-button {
    background-color: #005c4b;
    color: white;
    border: 1px solid #005c4b;
}

.message.sent .message-choice-button:hover:not(:disabled) {
    background-color: #00a884;
    border-color: #00a884;
}

/* Novos estilos para botões de escolha sem bolha */
.choice-buttons-container {
    display: flex;
    justify-content: flex-end;
    margin: 10px 8px;
    animation: messageSlide 0.3s ease-out;
}

.choice-buttons-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 65%;
}

.chat-choice-button {
    background-color: #00a884;
    color: white;
    border: none;
    padding: 1rem 20px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    min-width: 100px;
}

.chat-choice-button:hover {
    background-color: #00937a;
    transform: scale(1.02);
}

.chat-choice-button:active {
    transform: scale(0.98);
}

.image-message img {
    max-width: 100%;
    border-radius: 8px;
    cursor: pointer;
}

.audio-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    min-width: 250px;
}

.audio-play-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #00a884;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    padding: 0;
    outline: none;
}

.audio-play-button:focus {
    outline: none;
}

.audio-play-button svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.audio-progress {
    flex: 1;
    height: 3px;
    background-color: #3b4a54;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.audio-progress-bar {
    height: 100%;
    background-color: #00a884;
    width: 0%;
    transition: width 0.1s;
}

.audio-duration {
    font-size: 11px;
    color: #8696a0;
}

/* Mensagem Embed */
.embed-message {
    padding: 0 !important;
    overflow: hidden;
}

.embed-message iframe {
    display: block;
    max-width: 100%;
}

.file-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #202c33;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.file-loader h2 {
    margin-bottom: 20px;
    font-size: 20px;
    color: #e9edef;
}

.file-loader input[type="file"] {
    margin: 20px 0;
    padding: 10px;
    border: 2px dashed #00a884;
    border-radius: 8px;
    background-color: transparent;
    color: #e9edef;
    cursor: pointer;
    width: 100%;
}

.file-loader p {
    color: #8696a0;
    font-size: 14px;
}

.theme-selector {
    margin-top: 30px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.theme-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #e9edef;
    font-size: 14px;
}

.theme-selector input[type="radio"] {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

@media (max-width: 450px) {
    .app-container {
        max-width: 100%;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height para mobile */
    }
    
    .chat-container {
        flex: 1;
        min-height: 0; /* Importante para flex funcionar corretamente */
        padding-bottom: 20px; /* Reduzir padding inferior */
    }
    
    .chat-input-container,
    .choice-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        max-width: 450px;
        margin: 0 auto;
    }
    
    /* Ajustar padding do chat para não ficar atrás do input */
    .chat-messages {
        padding-bottom: 80px;
    }
}

/* ===== TEMA INSTAGRAM DIRECT ===== */
body[data-theme="instagram"] .app-container {
    background-color: #ffffff;
}

body[data-theme="instagram"] .chat-header {
    background-color: #ffffff;
    border-bottom: 1px solid #dbdbdb;
    padding: 8px 16px;
}

body[data-theme="instagram"] .back-button {
    color: #262626;
}

body[data-theme="instagram"] .user-name {
    color: #262626;
    font-weight: 600;
    font-size: 16px;
}

body[data-theme="instagram"] .user-status {
    color: #8e8e8e;
    font-size: 12px;
}

body[data-theme="instagram"] .icon-button {
    color: #262626;
}

body[data-theme="instagram"] .chat-container {
    background-color: #ffffff;
    background-image: none;
}

body[data-theme="instagram"] .date-divider span {
    background-color: transparent;
    color: #8e8e8e;
    font-size: 12px;
    padding: 5px 0;
}

body[data-theme="instagram"] .message.sent .message-bubble {
    background-color: #0095f6;
    border-radius: 18px;
    border-top-right-radius: 18px;
    color: #fff;
}

body[data-theme="instagram"] .message.received .message-bubble {
    background-color: #efefef;
    border-radius: 18px;
    border-top-left-radius: 18px;
    color: #262626;
}

body[data-theme="instagram"] .message-bubble {
    padding: 8px 16px;
}

body[data-theme="instagram"] .message-time {
    color: #fff;
    font-size: 11px;
}

body[data-theme="instagram"] .message.received .message-time {
    color: #4e4e4e;
}

body[data-theme="instagram"] .typing-indicator {
    padding: 8px 16px;
}

body[data-theme="instagram"] .typing-dot {
    background-color: #8e8e8e;
    width: 6px;
    height: 6px;
}

body[data-theme="instagram"] .chat-input-container {
    background-color: #ffffff;
    border-top: 1px solid #dbdbdb;
    padding: 8px 16px;
}

body[data-theme="instagram"] .chat-input-wrapper {
    background-color: #ffffff;
    border: 1px solid #dbdbdb;
    border-radius: 22px;
    padding: 8px 16px;
}

body[data-theme="instagram"] .chat-input {
    color: #262626;
    font-size: 14px;
}

body[data-theme="instagram"] .chat-input::placeholder {
    color: #8e8e8e;
}

body[data-theme="instagram"] .send-button {
    background-color: transparent;
    color: #0095f6;
    width: 30px;
    height: 30px;
}

body[data-theme="instagram"] .send-button:hover {
    background-color: transparent;
    opacity: 0.7;
}

body[data-theme="instagram"] .choice-container {
    background-color: #ffffff;
    border-top: 1px solid #dbdbdb;
}

body[data-theme="instagram"] .choice-button,
body[data-theme="instagram"] .chat-choice-button {
    background-color: #0095f6;
    border-radius: 22px;
    font-weight: 600;
}

body[data-theme="instagram"] .choice-button:hover,
body[data-theme="instagram"] .chat-choice-button:hover {
    background-color: #0074cc;
}

body[data-theme="instagram"] .message-choice-button {
    color: #0095f6;
    border-color: #0095f6;
    border-radius: 18px;
    font-weight: 600;
}

body[data-theme="instagram"] .message-choice-button:hover:not(:disabled) {
    background-color: #0095f6;
}

body[data-theme="instagram"] .message.sent .message-choice-button {
    background-color: transparent;
    color: white;
    border-color: white;
}

body[data-theme="instagram"] .message.sent .message-choice-button:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.2);
}

body[data-theme="instagram"] .audio-play-button {
    background-color: #0095f6;
}

body[data-theme="instagram"] .audio-progress {
    background-color: #dbdbdb;
}

body[data-theme="instagram"] .audio-progress-bar {
    background-color: #0095f6;
}

body[data-theme="instagram"] .audio-duration {
    color: #8e8e8e;
}

body[data-theme="instagram"] .file-loader {
    background-color: #ffffff;
    color: #262626;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body[data-theme="instagram"] .file-loader h2 {
    color: #262626;
}

body[data-theme="instagram"] .file-loader input[type="file"] {
    border-color: #0095f6;
    color: #262626;
}

body[data-theme="instagram"] .file-loader p {
    color: #8e8e8e;
}

body[data-theme="instagram"] .theme-selector label {
    color: #262626;
}

/* ===== TEMA INSTAGRAM DARK MODE ===== */
body[data-theme="instagram-dark"] {
    background-color: #000000;
    color: #f5f5f5;
}

body[data-theme="instagram-dark"] .app-container {
    background-color: #000000;
}

body[data-theme="instagram-dark"] .chat-header {
    background-color: #000000;
    border-bottom: 1px solid #262626;
    padding: 8px 16px;
}

body[data-theme="instagram-dark"] .back-button {
    color: #f5f5f5;
}

body[data-theme="instagram-dark"] .user-name {
    color: #f5f5f5;
    font-weight: 600;
    font-size: 16px;
}

body[data-theme="instagram-dark"] .user-status {
    color: #a8a8a8;
    font-size: 12px;
}

body[data-theme="instagram-dark"] .icon-button {
    color: #f5f5f5;
}

body[data-theme="instagram-dark"] .chat-container {
    background-color: #000000;
    background-image: none;
}

body[data-theme="instagram-dark"] .date-divider span {
    background-color: transparent;
    color: #a8a8a8;
    font-size: 12px;
    padding: 5px 0;
}

body[data-theme="instagram-dark"] .message.sent .message-bubble {
    background-color: #0095f6;
    border-radius: 18px;
    border-top-right-radius: 18px;
}

body[data-theme="instagram-dark"] .message.received .message-bubble {
    background-color: #262626;
    border-radius: 18px;
    border-top-left-radius: 18px;
    color: #f5f5f5;
}

body[data-theme="instagram-dark"] .message-bubble {
    padding: 8px 16px;
}

body[data-theme="instagram-dark"] .message-time {
    color: #e6e6e6;
    font-size: 11px;
}

body[data-theme="instagram-dark"] .typing-indicator {
    padding: 8px 16px;
}

body[data-theme="instagram-dark"] .typing-dot {
    background-color: #a8a8a8;
    width: 6px;
    height: 6px;
}

body[data-theme="instagram-dark"] .chat-input-container {
    background-color: #000000;
    border-top: 1px solid #262626;
    padding: 8px 16px;
}

body[data-theme="instagram-dark"] .chat-input-wrapper {
    background-color: #262626;
    border: 1px solid #262626;
    border-radius: 22px;
    padding: 8px 16px;
}

body[data-theme="instagram-dark"] .chat-input {
    color: #f5f5f5;
    font-size: 14px;
}

body[data-theme="instagram-dark"] .chat-input::placeholder {
    color: #a8a8a8;
}

body[data-theme="instagram-dark"] .send-button {
    background-color: transparent;
    color: #0095f6;
    width: 30px;
    height: 30px;
}

body[data-theme="instagram-dark"] .send-button:hover {
    background-color: transparent;
    opacity: 0.7;
}

body[data-theme="instagram-dark"] .choice-container {
    background-color: #000000;
    border-top: 1px solid #262626;
}

body[data-theme="instagram-dark"] .choice-button,
body[data-theme="instagram-dark"] .chat-choice-button {
    background-color: #0095f6;
    border-radius: 22px;
    font-weight: 600;
}

body[data-theme="instagram-dark"] .choice-button:hover,
body[data-theme="instagram-dark"] .chat-choice-button:hover {
    background-color: #0074cc;
}

body[data-theme="instagram-dark"] .message-choice-button {
    color: #0095f6;
    border-color: #0095f6;
    border-radius: 18px;
    font-weight: 600;
}

body[data-theme="instagram-dark"] .message-choice-button:hover:not(:disabled) {
    background-color: #0095f6;
}

body[data-theme="instagram-dark"] .message.sent .message-choice-button {
    background-color: transparent;
    color: white;
    border-color: white;
}

body[data-theme="instagram-dark"] .message.sent .message-choice-button:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.2);
}

body[data-theme="instagram-dark"] .audio-play-button {
    background-color: #0095f6;
}

body[data-theme="instagram-dark"] .audio-progress {
    background-color: #b0aeae;
}

body[data-theme="instagram-dark"] .audio-progress-bar {
    background-color: #0095f6;
}

body[data-theme="instagram-dark"] .audio-duration {
    color: #a8a8a8;
}

body[data-theme="instagram-dark"] .file-loader {
    background-color: #121212;
    color: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

body[data-theme="instagram-dark"] .file-loader h2 {
    color: #f5f5f5;
}

body[data-theme="instagram-dark"] .file-loader input[type="file"] {
    border-color: #0095f6;
    color: #f5f5f5;
}

body[data-theme="instagram-dark"] .file-loader p {
    color: #a8a8a8;
}

body[data-theme="instagram-dark"] .theme-selector label {
    color: #f5f5f5;
}