/* Twitter Feed Enhanced Styles - Image Upload & Emoji Picker */
/* Preserving existing twitter feed database styles while adding new features */

/* Post Toolbar */
.post-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 215, 0, 0.1);
    margin-top: 8px;
}

.toolbar-buttons {
    display: flex;
    gap: 8px;
}

.toolbar-btn {
    background: transparent;
    border: 1px solid rgba(255, 215, 0, 0.2);
    color: #FFD700;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

.toolbar-btn:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: #FFD700;
    transform: translateY(-1px);
}

.toolbar-btn:active {
    transform: translateY(0);
}

.toolbar-btn svg {
    width: 20px;
    height: 20px;
}

/* Image Preview Area */
.image-preview-area {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 215, 0, 0.05);
    border: 1px dashed rgba(255, 215, 0, 0.3);
    border-radius: 8px;
}

.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.image-preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255, 215, 0, 0.3);
    transition: all 0.2s ease;
    opacity: 0;
    transform: scale(0.8);
}

.image-preview-item.fade-in {
    opacity: 1;
    transform: scale(1);
}

.image-preview-item.fade-out {
    opacity: 0;
    transform: scale(0.8);
}

.image-preview-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(224, 36, 94, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
}

.remove-image-btn:hover {
    background: #E0245E;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(224, 36, 94, 0.3);
}

/* Image info overlay */
.image-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 8px 4px 4px;
    font-size: 10px;
    color: white;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-preview-item:hover .image-info {
    opacity: 1;
}

.image-name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Enhanced Emoji Picker */
.emoji-picker {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 1000;
    max-width: 360px;
    max-height: 420px;
    overflow-y: auto;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.emoji-picker-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Emoji Search */
.emoji-search-container {
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.9);
    padding: 8px 0;
    margin: -4px 0 8px 0;
    border-radius: 8px;
    z-index: 10;
}

.emoji-search {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.emoji-search:focus {
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.1);
}

.emoji-search::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.emoji-category {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.emoji-category-title {
    color: rgba(255, 215, 0, 0.7);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 4px;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.emoji-btn {
    background: transparent;
    border: 1px solid transparent;
    padding: 4px;
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-btn:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.3);
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.2);
}

.emoji-btn:active {
    transform: scale(1.1);
}

/* Scrollbar styling for emoji picker */
.emoji-picker::-webkit-scrollbar {
    width: 6px;
}

.emoji-picker::-webkit-scrollbar-track {
    background: rgba(255, 215, 0, 0.1);
    border-radius: 3px;
}

.emoji-picker::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 3px;
}

.emoji-picker::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.5);
}

/* Enhanced Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .post-toolbar {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .toolbar-buttons {
        justify-content: center;
        gap: 12px;
    }
    
    .toolbar-btn {
        min-width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .emoji-picker {
        max-width: calc(100vw - 24px);
        max-height: 60vh;
        left: 50%;
        transform: translateX(-50%);
        position: fixed;
        bottom: auto;
        top: 50%;
        transform: translate(-50%, -50%);
    }
    
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }
    
    .emoji-btn {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }
    
    .image-preview-item {
        width: 80px;
        height: 80px;
    }
    
    .image-preview-container {
        gap: 8px;
    }
    
    .emoji-search {
        font-size: 16px;
        padding: 10px 12px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .emoji-picker {
        max-width: calc(100vw - 16px);
        padding: 8px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .image-preview-item {
        width: 60px;
        height: 60px;
    }
}

/* Enhanced dark theme compatibility */
.dark-theme .toolbar-btn {
    background: rgba(30, 30, 30, 0.8);
    border-color: rgba(255, 215, 0, 0.15);
}

.dark-theme .toolbar-btn:hover {
    background: rgba(255, 215, 0, 0.1);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.1);
}

.dark-theme .emoji-picker {
    background: rgba(20, 20, 20, 0.98);
    border-color: rgba(255, 215, 0, 0.2);
    backdrop-filter: blur(15px);
}

.dark-theme .emoji-search {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 215, 0, 0.15);
}

.dark-theme .emoji-search:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 215, 0, 0.4);
}

.dark-theme .image-preview-area {
    background: rgba(30, 30, 30, 0.5);
    border-color: rgba(255, 215, 0, 0.2);
}

.dark-theme .post-input-container.drag-over {
    background: rgba(255, 215, 0, 0.08);
    border-color: rgba(255, 215, 0, 0.4);
}

/* Enhanced animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

.emoji-picker {
    animation: fadeInUp 0.2s ease;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.fade-out {
    animation: fadeOut 0.2s ease;
}

/* Loading state for image upload */
.image-uploading {
    opacity: 0.6;
    pointer-events: none;
}

.image-uploading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 215, 0, 0.2);
    border-top-color: #FFD700;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Performance optimizations */
.emoji-picker {
    will-change: transform, opacity;
}

.image-preview-item {
    will-change: transform, opacity;
}

.emoji-btn {
    will-change: transform;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .emoji-picker {
        background: #000;
        border-color: #fff;
    }
    
    .emoji-search {
        background: #000;
        border-color: #fff;
        color: #fff;
    }
    
    .toolbar-btn {
        border-color: #fff;
        color: #fff;
    }
}

/* Enhanced post input container */
.post-input-container {
    position: relative;
    transition: all 0.2s ease;
}

.post-input-container.drag-over {
    background: rgba(255, 215, 0, 0.05);
    border: 2px dashed rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    transform: scale(1.01);
}

.post-input-container.drag-over::before {
    content: '📁 Drop images here';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 215, 0, 0.9);
    color: #000;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    z-index: 10;
    pointer-events: none;
}

/* Character count positioning */
.post-toolbar .character-count {
    font-size: 12px;
    color: rgba(255, 215, 0, 0.6);
}

.post-toolbar .character-count.warning {
    color: #FFA500;
}

.post-toolbar .character-count.danger {
    color: #E0245E;
    font-weight: 600;
    animation: pulse 1s infinite;
}

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

/* Enhanced button states */
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

/* Loading states */
.image-uploading .preview-image {
    filter: blur(1px) brightness(0.7);
}

/* Accessibility improvements */
.toolbar-btn:focus,
.emoji-btn:focus,
.remove-image-btn:focus {
    outline: 2px solid rgba(255, 215, 0, 0.8);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .emoji-picker,
    .image-preview-item,
    .toolbar-btn,
    .emoji-btn {
        animation: none !important;
        transition: none !important;
    }
    
    .emoji-btn:hover,
    .toolbar-btn:hover {
        transform: none !important;
    }
}
