
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f0f2f5;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}


/* General styling for the audio element */
audio {
    width: 268px; /* Make audio player take full width of its container */
    max-width: 268px; /* Prevent overflow */
    display: block; /* Ensure it behaves as a block element */
    margin: 10px 0; /* Add some spacing */
    border-radius: 8px; /* Rounded corners for a modern look */
    background-color: #f1f3f4; /* Light background */
    padding: 5px; /* Optional padding */
    box-sizing: border-box; /* Include padding in width calculations */
}

/* Customize the audio controls for WebKit browsers */
audio::-webkit-media-controls-panel {
    background-color: #f1f3f4; /* Match the background */
    border-radius: 8px; /* Rounded controls */
    padding: 2px;
}
  
/* Customize the play button */
audio::-webkit-media-controls-play-button {
    background-color: #007bff; /* Blue play button */
    border-radius: 50%; /* Circular button */
}
  
/* Customize the timeline */
audio::-webkit-media-controls-timeline {
    background-color: #d3d3d3; /* Light gray timeline */
    border-radius: 4px;
}


#audio-preview-modal button {
    min-width: 90px;
    font-size: 0.95em;
    transition: background 0.2s;
}

#audio-preview-modal button:hover {
    opacity: 0.9;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sandwich-menu {
    cursor: pointer;
    display: none;
}

/* Centralização e tamanho do bloco de "Criado por" e logo */
.logo-text-codedneurons {
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.codedneurons-logo-img {
    width: 64px;
    height: 64px;
    display: block;
    margin: 0 auto;
}

.version {
    font-size: 8px;
    color: #666;
    margin-left: 5px;
}

.logo {
    display: flex;
    align-items: center;
}

.logo-text {
    margin-left: 10px;
    font-size: 18px;
    font-weight: bold;
    color: linear-gradient(to right, #333333, #af4a76);
    transition: color 0.3s;
}

.logo-img {
    width: 40px;
    height: 40px;
}

.icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

.search-bar {
    display: none;
}

.in-room .search-bar {
    display: flex;
    justify-content: center;
    width: 40%;
}

.search-container {
    display: flex;
    align-items: center;
    background-color: #f1f1f1;
    border-radius: 20px;
    padding: 5px 10px;
    width: 100%;
    max-width: 600px;
}

.search-bar input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 20px;
}

#search-input {
    flex-grow: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 8px;
    font-size: 14px;
}

.search-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0 5px;
    cursor: pointer;
}

.search-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.search-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.user-settings {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dark-light, .settings, .profile {
    cursor: pointer;
}

.dark-light svg, .settings svg, .profile svg {
    width: 24px;
    height: 24px;
}

.user-profile {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 1px solid #ccc;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}

/* Mobile Header */
#mobile-header {
    display: none;
    align-items: center;
    gap: 10px;
}

#mobile-room-name {
    font-size: 16px;
    font-weight: bold;
}

#mobile-search-bar {
    position: fixed;
    top: 40px;
    left: 0;
    right: 0;
    background: #fff;
    padding: 10px;
    display: flex;
    align-items: center;
    z-index: 100;
    border-bottom: 1px solid #ddd;
}

#mobile-search-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 20px;
}

#mobile-search-up, #mobile-search-down {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
}

/* Menu Panel */
#menu-panel {
    box-shadow: -2px 0 5px rgba(0,0,0,0.2);
}

#menu-panel h2 {
    margin-top: 0;
}

#menu-panel ul {
    list-style: none;
    padding: 0;
}

#menu-panel li {
    margin: 10px 0;
}

#menu-panel button {
    width: 100%;
    padding: 10px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#menu-panel button:hover {
    background: #0056b3;
}

/* Wrapper */
.wrapper {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* Conversation Area */
.conversation-area {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 300px;
    background: #f5f5f5;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}

#room-setup {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.in-room #room-setup {
    display: none;
}

#create-room, #join-room {
    background: #ffffff;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    transition: background 0.3s, box-shadow 0.3s;
}

#room-info {
    display: none;
    background: #ffffff;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    transition: background 0.3s, box-shadow 0.3s;
}

.in-room #room-info {
    display: flex;
    flex-direction: column;
    
}

#create-room, #room-info {
    border-radius: 0px 0px 8px 8px;
}

#join-room {
    border-radius: 8px 8px 0px 0px;
}

#create-room h2, #join-room h2, #room-info h2 {
    margin-top: 0;
    font-size: 18px;
    color: #333333;
    transition: color 0.3s;
}

#room-info p {
    margin: 10px 0;
    color: #333333;
    transition: color 0.3s;
}

#room-info ul {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

#room-info ul li {
    color: #333333;
    padding: 5px 0;
    transition: color 0.3s;
}

#create-room input, #join-room input, #room-info input {
    width: 100%;
    padding: 8px;
    margin: 10px 0;
    border: 1px solid #dddddd;
    border-radius: 4px;
    background: #ffffff;
    color: #333333;
    box-sizing: border-box;
    transition: background 0.3s, border-color 0.3s, color 0.3s;
}

#create-room button, #join-room button, #room-info button {
    width: 100%;
    padding: 10px;
    background: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

#create-room button:hover, #join-room button:hover, #room-info button:hover {
    background: #0056b3;
}

.username-change {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.username-change input,
.username-change button {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    box-sizing: border-box;
    height: 40px;
}

.input-button-container {
    display: flex;
    align-items: center;
    height: 40px;
    gap: 0px;
}

/* Chat Area */
.chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-area-header {
    display: none;
    height: 0px;
    background: #fff;
    border-bottom: 1px solid #ddd;
}


/* Chat Area Main */
.chat-area-main {
    flex-grow: 1; /* Take all available space */
    padding: 20px;
    padding-top: 50px;
    background: #f0f2f5;
    overflow-y: auto; /* Scroll for overflowing content */
    overflow-x: hidden;
    min-height: 0; /* Allow shrinking if needed */
    max-height: calc(100vh - 32px);
}

/*.chat-area-main {
    padding: 20px;
    background: #f0f2f5;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(89vh - 80px); /* Subtract header and footer heights */
/*}
*/

.chat-msg {
    display: flex;
    margin-bottom: 15px;
}

.chat-msg.system .chat-msg-text {
    background: #f0f0f0;
    color: #666;
    font-style: italic;
}

.chat-msg.owner {
    flex-direction: row-reverse;
}

.chat-msg-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 10px;
    max-width: 30px;
}

.chat-msg-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.chat-msg-media {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: block;
}

.chat-msg-file-name {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    word-break: break-all;
}

.chat-msg-download-btn {
    display: inline-block;
    padding: 6px 12px;
    background: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: background 0.2s;
}

.chat-msg-download-btn:hover {
    background: #0056b3;
}

.chat-msg-date {
    font-size: 12px;
    color: #666;
}

.chat-msg-content {
    max-width: 70%;
    position: relative;
}

.chat-msg-label {
    position: absolute;
    top: 0px;
    left: 0px;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    z-index: 2;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.chat-msg-textarea,
.chat-msg-balloon,
.chat-msg-text {
    padding: 25px 10px 10px 10px;
    border-radius: 10px;
    border-color: #1a1a1a;
    border-width: 1px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    background: linear-gradient(to bottom, #d5b3d3 20px, #ddcbdd 20px);
    word-wrap: break-word;
    z-index: 999;
    min-width: 270px;
    max-width: 270px;
    min-height: 40px;
}



.chat-msg-textarea {
    resize: none;
    border: none;
    outline: none;
    width: 90%;
    min-height: 40px;
    background: transparent;
}

.chat-msg-balloon {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.chat-msg.owner .chat-msg-content {
    align-items: flex-end;
}

.chat-msg.owner .chat-msg-textarea,
.chat-msg.owner .chat-msg-balloon {
    padding: 25px 10px 10px 10px;
    border-radius: 10px;
    border-color: #1a1a1a;
    border-width: 1px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    background: linear-gradient(to bottom, #9cc6f7 20px, #007bff 20px);
    color: #fff;
    word-wrap: break-word;
    z-index: 999;
    min-width: 270px;
    max-width: 270px;
    min-height: 40px;
}

.chat-msg.owner .chat-msg-text {
    background: linear-gradient(to bottom, #9cc6f7 20px, #007bff 20px);
    color: #fff;
    min-width: 215px;
    min-height: 40px;
    max-width: 270px;
}

.chat-msg-system {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 8px;
    background-color: #ddd;
}

.highlight {
    background-color: yellow;
    color: #333;
    font-weight: bold;
    text-decoration: underline;
    transition: background-color 0.3s, color 0.3s, text-decoration 0.3s;
}

/* Chat Area Footer */
.chat-area-footer {
    flex-shrink: 0; /* Prevent shrinking */
    height: auto;
    min-height: 35px;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #ddd;
    display: none;
    flex-direction: row;
    align-items: start;
    gap: 10px;
}

.in-room .chat-area-footer {
    display: flex;
}

.input-wrapper {
    position: relative;
    flex: 1;
}

.chat-area-footer input[type="text"] {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 20px;
    min-width: 0;
}

.chat-area-footer textarea {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 20px;
    min-width: 100%;
    resize: none; /* Prevent manual resizing */
    line-height: 1.5; /* Match typical input height */
    min-height: 32px; /* Single row height */
    max-height: 120px; /* Limit to ~4 rows */
    overflow-y: auto; /* Scroll if content exceeds max-height */
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

.chat-area-footer textarea:focus {
    outline: none;
    border-color: #007bff;
}

.chat-area-footer button {
    padding: 2px;
    border: none;
    background: transparent;
    color: #333;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: top;
    justify-content: center;
    transition: transform 0.2s ease;
}

.chat-area-footer button:hover {
    transform: scale(1.2);
}

.chat-area-footer button .icon {
    width: 32px;
    height: 32px;
    vertical-align: top;
}

/* Detail Area */
.detail-area {
    display: none;
    width: 300px;
    background: #fff;
    border-left: 1px solid #ddd;
    padding: 20px;
    flex-shrink: 0;
}

.in-room .detail-area {
    display: flex;
}

.detail-title {
    font-size: 18px;
    font-weight: bold;
}

.detail-subtitle {
    margin: 10px 0;
}

.detail-area button {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.detail-area button:hover {
    background: #c82333;
}

/* Toast */
#toast {
    display: none;
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px;
    border-radius: 5px;
    z-index: 1000;
}

/* Media controls */
.chat-msg-media-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.chat-msg-toggle-visibility {
    cursor: pointer;
    display: inline-block;
    width: 24px;
    height: 24px;
    color: #333;
    transition: color 0.3s;
}

.chat-msg-toggle-visibility svg {
    width: 100%;
    height: 100%;
}

/* Dark Mode */
body.dark-mode {
    background: #1a1a1a;
}

body.dark-mode .header,
body.dark-mode .conversation-area,
body.dark-mode .chat-area-header,
body.dark-mode .chat-area-footer,
body.dark-mode .detail-area {
    background: #2c2c2c;
    color: #fff;
    border-color: #444;
}

body.dark-mode .chat-area-main {
    background: #1a1a1a;
}

body.dark-mode .chat-msg-text {
    background: #3c3c3c;
    color: #fff;
}

body.dark-mode .chat-msg.system .chat-msg-text {
    background: #666;
    color: #fff;
}

body.dark-mode .chat-msg.owner .chat-msg-text {
    background: #075e54;
}

body.dark-mode input,
body.dark-mode .chat-area-footer input[type="text"] {
    background: #3c3c3c;
    color: #fff;
    border-color: #555;
}

body.dark-mode .username-change input,
body.dark-mode .username-change button {
    background: #3c3c3c;
    color: #fff;
    border-color: #555;
}

body.dark-mode .username-change button {
    background: #007bff;
}

body.dark-mode .chat-area-footer button {
    background: transparent;
    color: #fff;
}

body.dark-mode .search-container {
    background-color: #333;
    color: #fff;
}

body.dark-mode #search-input {
    color: #fff;
}

body.dark-mode .conversation-area {
    background: #1e1e1e;
    border-right: 1px solid #444444;
}

body.dark-mode #create-room, body.dark-mode #join-room, body.dark-mode #room-info {
    background: #2a2a2a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.dark-mode #create-room h2, body.dark-mode #join-room h2, body.dark-mode #room-info h2 {
    color: #e0e0e0;
}

body.dark-mode #room-info p {
    color: #e0e0e0;
}

body.dark-mode #room-info ul li {
    color: #e0e0e0;
}

body.dark-mode #create-room input, body.dark-mode #join-room input, body.dark-mode #room-info input {
    background: #333333;
    border: 1px solid #555555;
    color: #e0e0e0;
}

body.dark-mode #create-room input::placeholder, 
body.dark-mode #join-room input::placeholder, 
body.dark-mode #room-info input::placeholder {
    color: #aaaaaa;
}

body.dark-mode #create-room button, body.dark-mode #join-room button, body.dark-mode #room-info button {
    background: #1e90ff;
}

body.dark-mode #create-room button:hover, 
body.dark-mode #join-room button:hover, 
body.dark-mode #room-info button:hover {
    background: #1c86ee;
}

body.dark-mode .chat-msg-file-name {
    color: #ccc;
}

body.dark-mode .chat-msg-download-btn {
    background: #0056b3;
}

body.dark-mode .chat-msg-download-btn:hover {
    background: #003d82;
}

body.dark-mode .chat-msg-toggle-visibility {
    color: #e0e0e0;
}

body.dark-mode #mobile-header, 
body.dark-mode #mobile-search-bar,
body.dark-mode #menu-panel {
    background: #2c2c2c;
    color: #fff;
}







/* Mobile Styles */
@media (max-width: 768px) {
    .wrapper {
        flex-direction: column;
        margin-top: 50px;
    }
    
    .conversation-area {
        width: 100%;
    }

    .detail-area {
        display: none;
    }

    .version {
        font-size: 6px;
        color: #666;
        margin-left: 5px;
    }
    
    .chat-area {
        width: 100%;
        height: 100%; /* Full height on mobile */
        display: none;
        flex-direction: column;
        flex-grow: 1;
        min-height: 0;
    }
    
    .in-room .conversation-area, 
    .in-room .detail-area {
        display: none;
    }
    
    .in-room .chat-area {
        display: flex;
    }
    
    .not-in-room .conversation-area {
        display: flex;
        width: 100%;
        height: 100%;
    }
    
    .not-in-room .chat-area, 
    .not-in-room .detail-area {
        display: none;
    }

    .chat-area-main {
        flex-grow: 1;
        min-height: 0;
    }

    .in-room .chat-area-main {
        display: block;
    }

    .header {
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10;
    }

    .sandwich-menu {
        cursor: pointer;
        display: block;
        width: 28px;
        height: 28px;
        padding-left: 6px;
        padding-right: 6px;
    }
    
    .logo-text {
        font-size: 15px;
    }
    
    .logo-img {
        width: 28px;
        height: 28px;
    }
    
    .in-room .logo, 
    
    .in-room .user-settings {
        display: flex;
    }
    

    .search-bar {
        display: none;
    }
    
    .in-room .search-bar {
        display: none;
    }

    .in-room #mobile-header {
        display: flex;
        width: 100%;
        justify-content: space-between;
    }

    .in-room #mobile-search-bar {
        display: flex;
    }
    
    .in-room .chat-area-header {
        display: flex;
    }

    .not-in-room #mobile-header {
        display: none;
    }
    
    .not-in-room .logo, 
    .not-in-room .user-settings {
        display: flex;
    }
    
    .chat-area-footer {
        display: none;
        padding: 5px;
        gap: 5px;
        min-height: 30px;
        flex-shrink: 0;
    }

    .in-room .chat-area-footer {
        display: flex;
    }
    
    .chat-area-footer textarea {
        padding: 6px;
        min-height: 28px;
    }
    
    .chat-area-footer input[type="text"] {
        padding: 6px;
    }
    
    .chat-area-footer button .icon {
        width: 28px;
        height: 28px;
    }
}



/* Toast Animations and Styles */
#toast {
    display: none;
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 15px;
    border-radius: 5px;
    z-index: 1000;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease; /* For fade out */
}

#toast.show {
    animation: slideUpFadeIn 0.3s forwards;
}

#toast.hide {
    opacity: 0;
    transition: opacity 0.3s ease;
}

@keyframes slideUpFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, 20px); /* Start below */
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0); /* Slide up to position */
    }
}

/* Toast Inner Elements (match your app styles) */
#toast input {
    width: calc(100% - 20px);
    padding: 8px;
    margin: 10px 0;
    border: 1px solid #555;
    border-radius: 4px;
    background: #444;
    color: #fff;
    font-size: 14px;
}

#toast button {
    padding: 8px 12px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

#toast button:hover {
    background: #0056b3;
}

/* Dark Mode for Toast */
body.dark-mode #toast {
    background: #000;
}

body.dark-mode #toast input {
    background: #333;
    border-color: #666;
    color: #e0e0e0;
}

body.dark-mode #toast button {
    background: #1e90ff;
}

body.dark-mode #toast button:hover {
    background: #1c86ee;
}




/* Toast de carregamento centralizado */
#loading-toast {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(48, 48, 48, 0.35); /* cor padrão do projeto */
    z-index: 1;
}

.loading-toast-content {
    position: relative;
    z-index: 2;
    background: #fff;
    color: #333;
    padding: 32px 40px;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    font-size: 18px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 6px solid #f1f3f4;
    border-top: 6px solid #007bff; /* azul padrão */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Dark mode para o toast */
body.dark-mode #loading-toast .loading-toast-content {
    background: #2c2c2c;
    color: #fff;
}
body.dark-mode #loading-toast .loading-overlay {
    background: rgba(20, 20, 20, 0.45);
}



/* ==================== BOTÃO DE COPIAR MENSAGEM ==================== */
.copy-btn {
    background: none;
    border: none;
    padding: 2px 6px;
    margin-left: 6px;
    cursor: pointer;
    color: inherit;
    font-size: 15px;
    opacity: 0.7;
    transition: all 0.2s ease;
    vertical-align: middle;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    opacity: 1;
    color: #007bff;
    transform: scale(1.12);
}

/* Ensure copy button only highlights on direct hover, not when parent label is hovered */
.chat-msg-label:hover .copy-btn:not(:hover) {
    opacity: 0.7 !important;
    color: inherit !important;
    transform: none !important;
}

/* ==================== LABEL DAS MENSAGENS (nome + botão de copiar) ==================== */
/* Aumentado em ~30% o espaço do label + botão empurrado para a extrema direita do balão */
.chat-msg-label {
    display: flex !important;
    align-items: center;
    justify-content: space-between;   /* ← Isso empurra o botão para a direita */
    flex-wrap: nowrap;
    font-size: 13px;
    font-weight: 600;
    color: #000;
    margin-bottom: 4px;
    min-height: 19px;
    width: 100%;                      /* Garante que ocupe toda a largura do balão */
}


/* Aumenta o padding superior dos balões/texto em ~30% para dar mais espaço ao label */
.chat-msg-textarea,
.chat-msg-balloon,
.chat-msg-text {
    padding: 33px 10px 10px 10px; /* 25px → 33px (+32%) */
}

.chat-msg.owner .chat-msg-textarea,
.chat-msg.owner .chat-msg-balloon,
.chat-msg.owner .chat-msg-text {
    padding: 33px 10px 10px 10px;
}

/* Dark mode */
body.dark-mode .chat-msg-label {
    color: #fff;
    background-color: #222;
}




/* ==================== TOAST DE COPIADO (novo) ==================== */
.copy-toast {
    position: absolute;
    background: rgba(0, 123, 255, 0.75); /* ← mais transparente (0.85) */
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    animation: copyToastFade 2s forwards;
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-toast.dark {
    background: rgba(30, 144, 255, 0.75);
}

@keyframes copyToastFade {
    0%   { opacity: 0; transform: translateY(8px); }
    15%  { opacity: 1; transform: translateY(0); }
    85%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-8px); }
}




/* Loading more messages spinner */
#loading-more-messages {
    padding: 20px 10px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #666;
    font-size: 13px;
    background: rgba(255,255,255,0.6);
}

.dark-mode #loading-more-messages {
    color: #aaa;
    background: rgba(30,30,30,0.6);
}

.loading-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid rgba(74,144,226,0.25);
    border-top: 3px solid #4a90e2;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}




/* ==================== BOTTOM SHEET PARA COMPARTILHAMENTO ==================== */

/* Container do bottom sheet (inicialmente oculto fora da tela) */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100vh;
    display: none;
    flex-direction: column;
    z-index: 2000;
}

/* Overlay semi-transparente (clicável para fechar) */
.bottom-sheet-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Painel do bottom sheet (desliza do fundo para cima) */
.bottom-sheet-content {
    position: relative;
    margin-top: auto;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 0;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    max-height: 60vh;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Estado aberto do bottom sheet */
.bottom-sheet.open {
    display: flex;
}

.bottom-sheet.open .bottom-sheet-overlay {
    opacity: 1;
}

.bottom-sheet.open .bottom-sheet-content {
    transform: translateY(0);
}

/* Header do bottom sheet */
.bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.bottom-sheet-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

/* Botão fechar (X) no header */
.bottom-sheet-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #333;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    font-weight: bold;
}

.bottom-sheet-close-btn:hover {
    color: #000;
}

/* Container com os botões de opções */
.bottom-sheet-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 20px;
    flex-shrink: 0;
    justify-items: center;
}

/* Botões dentro do bottom sheet */
.bottom-sheet-options button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 80px;
    height: 90px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    padding: 0;
}

.bottom-sheet-options button:active {
    background: #e8e8e8;
    transform: scale(0.95);
}

.bottom-sheet-options button:hover {
    background: #e8e8e8;
}

.bottom-sheet-options button img {
    width: 32px;
    height: 32px;
}

.camera-capture-panel {
    display: none;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: #fff;
}

.camera-container {
    position: relative;
    width: 100%;
    height: 240px;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.camera-capture-panel video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.camera-overlay-btn {
    position: absolute;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 20px;
}

.camera-overlay-btn:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.camera-overlay-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.camera-capture-btn {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.82);
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-capture-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
}

.camera-capture-btn:active {
    transform: translateX(-50%) scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.camera-switch-btn {
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 20px;
}

.camera-controls {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.camera-controls button {
    flex: 1;
    min-height: 48px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.camera-back-btn {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #e0e0e0;
}

.camera-back-btn:hover {
    background: #e8e8e8;
    border-color: #d0d0d0;
}

/* Photo Review Panel Styling */
.photo-review-panel {
    display: none;
    position: relative;
    width: 100%;
    min-height: 240px;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
}

.photo-review-panel img {
    width: 100%;
    height: 240px;
    border-radius: 0;
    box-shadow: none;
    object-fit: cover;
    display: block;
}

.photo-review-panel .review-controls {
    position: absolute;
    left: 50%;
    right: auto;
    bottom: 12px;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
    padding: 0;
    z-index: 10;
    pointer-events: auto;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.photo-review-panel .review-controls button {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    max-width: 24px;
    max-height: 24px;
    aspect-ratio: 1 / 1;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    font-size: 11px;
    line-height: 1;
    background: rgba(255, 255, 255, 0.45);
    color: #111;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.photo-review-panel .review-controls button:hover {
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.photo-review-panel .review-controls button:active {
    transform: scale(0.95);
}

.photo-review-panel .review-controls button i {
    margin: 0;
}

/* Specific button styles */
.photo-review-panel .review-send-btn {
    background: rgba(76, 175, 80, 0.45);
    border-color: rgba(76, 175, 80, 0.55);
    color: white;
}

.photo-review-panel .review-send-btn:hover {
    background: rgba(76, 175, 80, 0.55);
}

.photo-review-panel .review-retake-btn {
    /* No spinning */
}

.photo-review-panel .review-cancel-btn {
    background: rgba(244, 67, 54, 0.45);
    border-color: rgba(244, 67, 54, 0.55);
    color: white;
}

.photo-review-panel .review-cancel-btn:hover {
    background: rgba(244, 67, 54, 0.55);
}

.photo-review-panel .review-controls button:active {
    transform: scale(0.97);
}

/* Video Record Panel */
.video-record-panel {
    display: none;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: #fff;
}

.video-record-panel video {
    width: 100%;
    border-radius: 16px;
    min-height: 180px;
    background: #000;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.video-record-controls {
    display: flex;
    gap: 12px;
}

.video-record-controls button {
    flex: 1;
    min-height: 48px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.video-record-btn {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: #fff;
    position: relative;
}

.video-record-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e7e34 0%, #155724 100%);
    box-shadow: 0 4px 12px rgba(28, 124, 52, 0.3);
}

.video-record-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.video-record-btn.recording::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ff4444;
    border-radius: 50%;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    animation: pulse 0.8s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.video-record-back-btn {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #e0e0e0;
}

.video-record-back-btn:hover {
    background: #e8e8e8;
    border-color: #d0d0d0;
}

/* Video Review Panel */
.video-review-panel {
    display: none;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    padding: 20px;
    background: #fff;
}

.video-review-panel video {
    width: 100%;
    border-radius: 16px;
    max-height: 400px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.review-controls {
    display: flex;
    gap: 12px;
    width: 100%;
}

.review-controls button {
    flex: 1;
    min-height: 48px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.review-send-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: #fff;
}

.review-send-btn:hover {
    background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.review-retake-btn {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #333;
    font-weight: 700;
}

.review-retake-btn:hover {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.review-cancel-btn {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #e0e0e0;
}

.review-cancel-btn:hover {
    background: #e8e8e8;
    border-color: #d0d0d0;
}

/* Dark mode para bottom sheet */
body.dark-mode .bottom-sheet-content {
    background: #2c2c2c;
}

body.dark-mode .bottom-sheet-header {
    border-bottom-color: #444;
}

body.dark-mode .bottom-sheet-header h2 {
    color: #fff;
}

body.dark-mode .bottom-sheet-close-btn {
    color: #ccc;
}

body.dark-mode .bottom-sheet-close-btn:hover {
    color: #fff;
}

body.dark-mode .bottom-sheet-options button {
    background: #3c3c3c;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-mode .bottom-sheet-options button:active {
    background: #4c4c4c;
}

body.dark-mode .bottom-sheet-options button:hover {
    background: #4c4c4c;
}

/* Dark mode for camera and video panels */
body.dark-mode .camera-capture-panel,
body.dark-mode .video-record-panel,
body.dark-mode .video-review-panel {
    background: #1e1e1e;
}

body.dark-mode .camera-overlay-btn {
    background: rgba(50, 50, 50, 0.95);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

body.dark-mode .camera-overlay-btn:hover {
    background: rgba(70, 70, 70, 1);
}

body.dark-mode .camera-back-btn,
body.dark-mode .video-record-back-btn,
body.dark-mode .review-cancel-btn {
    background: #3c3c3c;
    color: #e0e0e0;
    border-color: #544;
}

body.dark-mode .camera-back-btn:hover,
body.dark-mode .video-record-back-btn:hover,
body.dark-mode .review-cancel-btn:hover {
    background: #4c4c4c;
    border-color: #666;
}

body.dark-mode .camera-capture-btn {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

body.dark-mode .video-record-btn {
    background: linear-gradient(135deg, #198754 0%, #157347 100%);
}

body.dark-mode .video-record-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #157347 0%, #0f5533 100%);
}

body.dark-mode .review-send-btn {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
}

body.dark-mode .review-send-btn:hover {
    background: linear-gradient(135deg, #0b5ed7 0%, #0a58ca 100%);
}

body.dark-mode .review-retake-btn {
    background: linear-gradient(135deg, #fd7e14 0%, #fd6c0e 100%);
    color: #fff;
}

body.dark-mode .review-retake-btn:hover {
    background: linear-gradient(135deg, #fd6c0e 0%, #e86a09 100%);
}

/* Responsividade para celulares pequenos */
@media (max-height: 600px) {
    .bottom-sheet-content {
        max-height: 80vh;
    }
    
    .bottom-sheet-options {
        padding: 16px 12px;
    }
    
    .bottom-sheet-options button {
        width: 70px;
        height: 80px;
        font-size: 11px;
    }
}

/* Desktop behavior for bottom sheet: hidden by default, shown as a centered dialog when open */
@media (min-width: 769px) {
    .bottom-sheet {
        justify-content: center;
        align-items: center;
    }

    .bottom-sheet-content {
        width: 420px;
        max-width: calc(100% - 40px);
        max-height: 80vh;
        margin: 0 auto;
        transform: translateY(20px);
        border-radius: 18px;
    }

    .bottom-sheet.open .bottom-sheet-content {
        transform: translateY(0);
    }
}
