/* Messages App Styling */

.app-screen#messages-app {
    display: none;
}

.app-screen#messages-app.active {
    display: block;
}

.messages-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #f5f5f5;
    position: relative;
}

.messages-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 15px 10px 15px;
    margin-top: 44px;
    background-color: #f5f5f5;
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 90px;
    border-bottom: none;
}

.messages-header-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    bottom: 10px;
}

.messages-back-button {
    position: absolute;
    left: 15px;
    bottom: 10px;
    color: #007aff;
    font-size: 16px;
    cursor: pointer;
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: url('../images/profile-picture.jpg') no-repeat center center;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.contact-avatar.not-signed-in {
    filter: blur(4px);
}

.contact-avatar i {
    display: none; /* Keep this to hide the default icon */
}

.contact-name {
    font-weight: 600;
    font-size: 14px;
    color: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin-bottom: 0;
    line-height: 1.2;
}

.messages-header-right {
    position: absolute;
    right: 15px;
    bottom: 10px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.messages-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: #f5f5f5;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
    animation: messageAppear 0.3s ease-out;
}

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

.message .message-actions {
    position: absolute;
    left: -35px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.message .message-action-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.message .message-action-btn:hover {
    transform: scale(1.1);
}

.message .edit-message-btn {
    background-color: #007aff;
    color: white;
}

.message .edit-message-btn:hover {
    background-color: #0056b3;
}

.message .download-message-btn {
    background-color: #34c759;
    color: white;
}

.message .download-message-btn:hover {
    background-color: #2a9e48;
}

.message .delete-message-btn {
    background-color: #ff3b30;
    color: white;
}

.message .delete-message-btn:hover {
    background-color: #ff1a1a;
}

.message-sent {
    align-self: flex-end;
    background-color: #007AFF;
    color: white;
    border-bottom-right-radius: 5px;
}

.message-received {
    align-self: flex-start;
    background-color: #E9E9EB;
    color: black;
    border-bottom-left-radius: 5px;
}

.time-stamp {
    text-align: center;
    font-size: 12px;
    color: #8E8E93;
    margin: 10px 0;
    font-weight: 500;
}

.messages-input-area {
    padding: 10px 15px 25px;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    position: sticky;
    bottom: 0;
}

.messages-input-attachments {
    display: flex;
    margin-right: 0px;
    gap: 8px;
}

.attachment-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e8e8e8;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.attachment-btn i {
    font-size: 14px;
    color: #8e8e93;
}

.messages-input-field {
    display: flex;
    align-items: center;
    background-color: #E9E9EB;
    border-radius: 25px;
    padding: 8px 15px;
    gap: 10px;
}

.messages-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 15px;
    color: #000;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.messages-input::placeholder {
    color: #8E8E93;
}

.messages-send-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #007AFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.messages-send-btn:hover {
    transform: scale(1.05);
}

.messages-send-btn i {
    color: white;
    font-size: 14px;
}

.image-preview {
    position: relative;
    margin-right: 8px;
    max-width: 100px;
    max-height: 100px;
}

.image-preview img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #ff3b30;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    padding: 0;
}

/* Admin status indicator */
.admin-status {
    font-size: 12px;
    color: #666;
    line-height: 1.2;
}

/* Export button styling */
#export-chat-btn {
    cursor: pointer;
    transition: transform 0.2s ease;
}

#export-chat-btn:hover {
    transform: scale(1.1);
}

/* Welcome message styling */
.welcome-message {
    text-align: center;
    background-color: rgba(0, 122, 255, 0.1);
    padding: 15px 20px;
    border-radius: 15px;
    margin: 40px auto 10px auto;
    max-width: 80%;
    color: #007AFF;
    font-size: 15px;
    line-height: 1.4;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 18px;
    background-color: #e9e9eb;
    max-width: 60px;
    align-self: flex-start;
    margin-top: 5px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #999;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: typing 1.4s infinite both;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0% { transform: translateY(0); }
    28% { transform: translateY(-5px); }
    44% { transform: translateY(0); }
}

.message.image-message {
    padding: 5px;
    max-width: 200px;
}

.message.image-message img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 12px;
    object-fit: contain;
}

.message.video-message {
    padding: 5px;
    max-width: 280px;
}

.message.video-message video {
    max-width: 100%;
    max-height: 250px;
    border-radius: 12px;
    background-color: #000;
    object-fit: contain;
}

.attachment-preview {
    margin: 8px;
    background-color: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    max-width: 200px;
}

.preview-content {
    position: relative;
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
}

.preview-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.preview-content i.fas.fa-file-pdf {
    font-size: 48px;
    color: #FF3B30;
}

.file-info {
    padding: 8px;
    font-size: 12px;
    color: #666;
    word-break: break-word;
}

.remove-attachment {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.remove-attachment:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.message.message-sent .preview-content {
    background-color: #007AFF;
}

.message.message-sent .preview-content img {
    border-radius: 8px;
}

.message.message-sent .file-info {
    color: white;
    background-color: #007AFF;
}

.message.message-sent i.fas.fa-file-pdf {
    color: white;
}

.message-text {
    margin-top: 8px;
    word-break: break-word;
}

@media (max-width: 480px) {
  .messages-input-field {
    padding: 6px 8px;
    gap: 6px;
  }
  .messages-send-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    font-size: 13px;
    flex-shrink: 0;
    margin-left: 0;
  }
  .messages-input {
    font-size: 14px;
  }
}

/* Always keep status bar transparent when projects folder is open */
#projects-app.active ~ .status-bar,
.app-screen#projects-app ~ .status-bar,
.status-bar {
    background-color: transparent !important;
}

#projects-app.active ~ .status-bar {
    background-color: transparent !important;
} 