/* Modern Social Media Style Chat Composer */

.message-input-area .modern-message-composer,
.modern-message-composer {
    background: #ffffff !important;
    border-top: 1px solid #e5e7eb !important;
    box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.05) !important;
    margin: 0 !important;
    padding: 12px 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    position: relative !important;
}

.modern-message-composer:focus-within {
    box-shadow: 0 4px 30px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

/* Media Preview Area */
.media-preview-area {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.preview-title {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.close-preview {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-preview:hover {
    background: #e5e7eb;
    color: #374151;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

/* Reply Preview */
.reply-preview-area {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 16px;
}

.reply-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #0369a1;
    margin-bottom: 8px;
}

.reply-content-preview {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    padding: 8px;
    font-size: 12px;
    color: #64748b;
    border-left: 3px solid #0ea5e9;
}

/* Main Composer */
.modern-message-composer .composer-main {
    padding: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
}

/* Input Row */
.modern-message-composer .composer-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 0;
    width: 100%;
    box-sizing: border-box;
    order: 2;
}

/* Input Area */
.modern-message-composer .composer-input-area {
    margin-bottom: 16px !important;
    width: 100% !important;
}

.modern-message-composer .input-field-wrapper {
    position: relative;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 12px 16px;
    transition: all 0.2s ease;
    flex: 1;
    box-sizing: border-box;
}

.input-field-wrapper:focus-within {
    background: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.message-textarea {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 16px;
    line-height: 1.5;
    color: #1f2937;
    resize: none;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 40px;
}

.message-textarea::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.input-overlay {
    position: absolute;
    bottom: 8px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.character-count {
    font-size: 11px;
    color: #9ca3af;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 500;
}

.character-count.near-limit {
    color: #ef4444;
    background: #fef2f2;
}

/* Toolbar */
.modern-message-composer .composer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    background: transparent;
    border-bottom: 1px solid #f1f5f9;
    order: 1;
}

.modern-message-composer .toolbar-left {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    flex: 1 !important;
    min-width: 0 !important;
}

.modern-message-composer .toolbar-center {
    display: flex !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    order: 2 !important;
}

.modern-message-composer .toolbar-right {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    order: 3 !important;
    width: auto !important;
    justify-content: flex-end !important;
    margin-top: 0 !important;
}

/* Toolbar Buttons - Icon Only */
.modern-message-composer .toolbar-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 50% !important;
    color: #6b7280 !important;
    font-size: 18px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    flex-shrink: 0 !important;
}

.modern-message-composer .toolbar-btn:hover {
    background: rgba(72, 209, 204, 0.12) !important; /* Mint-blue tint */
    color: #48D1CC !important;
    transform: scale(1.15) !important; /* Slightly larger scaling */
    box-shadow: 0 2px 8px rgba(72, 209, 204, 0.2) !important; /* Soft glow */
}

.modern-message-composer .toolbar-btn:active {
    transform: scale(0.95) !important;
}

.toolbar-btn i {
    font-size: 14px;
}

/* Specific button styles */
.photo-btn:hover { background: #dbeafe; color: #1d4ed8; }
.gif-btn:hover { background: #fef3c7; color: #d97706; }
.emoji-btn:hover { background: #fed7d7; color: #dc2626; }
.file-btn:hover { background: #d1fae5; color: #059669; }
.voice-btn:hover { background: #e0e7ff; color: #5b21b6; }

/* Mood Selector */
.mood-selector-container {
    position: relative;
}

.modern-message-composer .mood-selector-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 50% !important;
    color: #8b5cf6 !important;
    font-size: 18px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    position: relative !important;
    flex-shrink: 0 !important;
}

.modern-message-composer .mood-selector-btn:hover {
    background: rgba(139, 92, 246, 0.1) !important;
    color: #8b5cf6 !important;
    transform: scale(1.1) !important;
}

.modern-message-composer .mood-selector-btn.has-mood {
    background: rgba(139, 92, 246, 0.2) !important;
    color: #8b5cf6 !important;
}

.modern-message-composer .mood-selector-btn.has-mood:hover {
    background: rgba(139, 92, 246, 0.3) !important;
}

.mood-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: none;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

/* Send Button */
.modern-message-composer .send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: #e5e7eb;
    border: none;
    border-radius: 50%;
    color: #9ca3af;
    font-size: 16px;
    cursor: not-allowed;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modern-message-composer .send-btn:not(:disabled) {
    background: #48D1CC; /* Dezipp mint-blue */
    color: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(72, 209, 204, 0.3);
    font-weight: 600; /* More visual weight */
}

.send-btn:hover {
    transform: scale(1.05) !important;
}

.send-btn:disabled:hover {
    color: #6b7280 !important;
}

.send-btn:not(:disabled):hover {
    background: #3AAFA9 !important; /* Darker mint-blue on hover */
    transform: scale(1.08) !important; /* Slightly more scaling */
    box-shadow: 0 4px 16px rgba(72, 209, 204, 0.4) !important; /* Enhanced glow */
}

.send-btn:not(:disabled):active {
    transform: scale(0.95) !important;
}

/* Mood Picker Popover */
.mood-picker-popover {
    position: fixed;
    top: auto;
    bottom: auto;
    left: auto;
    right: auto;
    background: white;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    padding: 12px 14px;
    z-index: 50000 !important;
    width: 420px !important;
    max-width: 90vw !important;
    max-height: 320px !important;
    overflow: auto !important;
    writing-mode: horizontal-tb !important;
    display: none;
    visibility: visible;
}

.mood-picker-popover.visible {
    display: block !important;
    visibility: visible !important;
}

.mood-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.mood-picker-header h4 {
    margin: 0;
    color: #1f2937;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.close-mood-picker {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}

/* Mood chips (pills) */
.mood-chips {
    display: flex;
    flex-wrap: wrap !important;
    gap: 8px;
    row-gap: 10px;
    max-height: none;
    overflow: visible;
}

.mood-chip {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 2px solid var(--mood-color, #e5e7eb);
    border-radius: 9999px;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.mood-chip:hover {
    transform: translateY(-1px);
    background: #f9fafb;
}

.mood-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.mood-name {
    font-size: 13px;
    font-weight: 600;
}

/* Emoji Picker Popover */
.emoji-picker-popover {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 16px;
    z-index: 1000;
    width: 280px;
    margin-bottom: 8px;
}

.emoji-category-title {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.emoji-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
}

.emoji-item:hover {
    background: #f3f4f6;
    transform: scale(1.1);
}

/* GIF Picker Popover */
.gif-picker-popover {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 16px;
    z-index: 1000;
    width: 300px;
    margin-bottom: 8px;
}

.gif-search {
    margin-bottom: 12px;
}

.gif-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

.gif-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #9ca3af;
    text-align: center;
}

.gif-placeholder i {
    font-size: 32px;
    margin-bottom: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modern-message-composer {
        margin: 8px;
        border-radius: 16px;
    }
    
    .composer-main {
        padding: 16px;
    }
    
    .toolbar-btn .btn-label {
        display: none;
    }
    
    .toolbar-btn {
        padding: 12px; /* Larger touch targets */
        min-width: 44px; /* Apple recommended minimum */
        min-height: 44px;
        justify-content: center;
    }
    
    .mood-picker-popover {
        width: 280px;
    }
    
    .mood-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .composer-toolbar {
        flex-direction: column;
        gap: 12px;
    }
    
    .toolbar-left {
        order: 2;
        justify-content: space-around;
        width: 100%;
    }
    
    .toolbar-center {
        order: 1;
        width: 100%;
    }
    
    .toolbar-right {
        order: 3;
        width: 100%;
        justify-content: center;
    }
}

/* Animation for smooth transitions */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mood-picker-popover,
.emoji-picker-popover,
.gif-picker-popover {
    animation: slideUp 0.2s ease-out;
}

/* Defensive reset to avoid vertical text in popover */
.mood-picker-popover, .mood-picker-popover * {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    white-space: normal;
}

/* Override messaging-modern.css styles for better composer display */
.message-input-area .modern-message-composer {
    margin: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1) !important;
}

/* Ensure proper textarea styling */
.modern-message-composer .message-textarea {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    resize: none !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Ensure proper container styling in messaging context */
.dezipp-messaging .message-input-area {
    background: transparent !important;
    border-top: none !important;
    padding: 0 !important;
}

/* Force proper display for all composer elements */
.modern-message-composer * {
    box-sizing: border-box !important;
}

.modern-message-composer .composer-toolbar {
    overflow: visible !important;
    height: auto !important;
}

.modern-message-composer .toolbar-left,
.modern-message-composer .toolbar-center, 
.modern-message-composer .toolbar-right {
    display: flex !important;
    flex-wrap: wrap !important;
}

/* Ensure buttons don't break layout */
.modern-message-composer .toolbar-btn {
    flex-shrink: 0 !important;
    margin: 2px !important;
}

/* Force proper text input styling */
.modern-message-composer .message-textarea {
    display: block !important;
    width: 100% !important;
    min-height: 40px !important;
    max-height: 200px !important;
}

/* Clean modern appearance */