/* ===== EDIT POST MODAL - Matching Repost Modal Style ===== */
.edit-post-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.edit-post-modal.active {
    display: block;
    opacity: 1;
}

.edit-post-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.edit-post-modal-content {
    position: absolute;
    top: 90px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-radius: 24px 24px 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-height: calc(100vh - 90px);
}

.edit-post-modal.active .edit-post-modal-content {
    transform: translateY(0);
}

/* Drag handle */
.edit-post-drag-handle {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 6px;
    background-color: #c4c4c4;
    border-radius: 3px;
    opacity: 0.8;
    cursor: pointer;
}

/* Edit Post Verification Badge Styling */
.edit-post-user-info .verified-badge {
    display: none;
    width: 16px;
    height: 16px;
}

.edit-post-user-info .verified-badge.blue {
    display: inline-block;
    fill: #1DA1F2;
}

.edit-post-user-info .verified-badge.red {
    display: inline-block;
    fill: #FFD700;
}

/* Header */
.edit-post-modal-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e4e6eb;
    background: #fff;
}

.edit-post-header-left,
.edit-post-header-right {
    flex: 1;
}

.edit-post-header-center {
    flex: 2;
    text-align: center;
}

.edit-post-header-center h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.edit-post-cancel-btn {
    background: transparent;
    border: none;
    color: #000;
    font-size: 16px;
    cursor: pointer;
    padding: 8px 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 400;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.edit-post-cancel-btn:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.edit-post-save-btn {
    background: transparent;
    color: #1877F2;
    border: none;
    padding: 8px 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: opacity 0.2s, background-color 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-post-save-btn:hover:not(:disabled) {
    opacity: 0.8;
    background-color: rgba(24, 119, 242, 0.1);
}

.edit-post-save-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Body */
.edit-post-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #fff;
}

/* User section */
.edit-post-user-section {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.edit-post-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(230, 236, 240, 0.7);
}

.edit-post-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.edit-post-user-info {
    display: flex;
    align-items: center;
    gap: 4px;
}

.edit-post-username {
    font-weight: 600;
    font-size: 15px;
    color: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Textarea */
.edit-post-textarea-container {
    margin-bottom: 24px;
    position: relative;
}

.edit-post-textarea {
    width: 100%;
    min-height: 140px;
    border: none;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    padding: 0;
    outline: none;
    color: #000;
    font-weight: 400;
}

.edit-post-textarea::placeholder {
    color: #737373;
    font-weight: 400;
}

.edit-post-char-count {
    text-align: right;
    font-size: 14px;
    color: #666;
    margin-top: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 400;
}

/* Media preview */
.edit-post-media-preview {
    margin-bottom: 24px;
}

.edit-post-media-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.edit-post-media-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1;
    background-color: #f0f2f5;
    border: 1px solid rgba(230, 236, 240, 0.7);
}

.edit-post-media-preview-item {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.edit-post-remove-media-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    font-size: 14px;
}

.edit-post-remove-media-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Add media button */
.edit-post-media-actions {
    text-align: center;
}

.edit-post-add-media-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f0f2f5;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 15px;
    color: #000;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 400;
}

.edit-post-add-media-btn:hover {
    background: #e4e6eb;
}

/* Spinner for save button */
.edit-post-save-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #1877F2;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success notification */
.edit-post-success {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 10001;
    transition: transform 0.3s ease;
}

.edit-post-success.visible {
    transform: translateX(-50%) translateY(0);
}

.edit-post-success-content {
    background: #1877F2;
    color: white;
    padding: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===== MENTION SUGGESTIONS DROPDOWN ===== */
.mention-suggestions-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #e4e6eb;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 10001;
    width: 300px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 5px;
}

.mention-suggestion-item {
    padding: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f2f5;
}

.mention-suggestion-item:last-child {
    border-bottom: none;
}

.mention-suggestion-item:hover,
.mention-suggestion-item.selected {
    background-color: #f5f5f5;
}

.mention-suggestion-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(230, 236, 240, 0.7);
}

.mention-suggestion-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mention-suggestion-info {
    flex: 1;
    min-width: 0;
}

.mention-suggestion-name {
    font-weight: 600;
    color: #000;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.mention-suggestion-username {
    color: #666;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 400;
}

/* Verification badges in mention suggestions */
.mention-verified-badge {
    display: inline-block;
    width: 16px;
    height: 16px;
    position: relative;
}

.mention-verified-badge.blue::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #1DA1F2;
    mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M22.5 12.5c0-1.58-.875-2.95-2.148-3.6.154-.435.238-.905.238-1.4 0-2.21-1.71-3.998-3.818-3.998-.47 0-.92.084-1.336.25C14.818 2.415 13.51 1.5 12 1.5s-2.816.917-3.437 2.25c-.415-.165-.866-.25-1.336-.25-2.11 0-3.818 1.79-3.818 4 0 .494.083.964.237 1.4-1.272.65-2.147 2.018-2.147 3.6 0 1.495.782 2.798 1.942 3.486-.02.17-.032.34-.032.514 0 2.21 1.708 4 3.818 4 .47 0 .92-.086 1.335-.25.62 1.334 1.926 2.25 3.437 2.25 1.512 0 2.818-.916 3.437-2.25.415.163.865.248 1.336.248 2.11 0 3.818-1.79 3.818-4 0-.174-.012-.344-.033-.513 1.158-.687 1.943-1.99 1.943-3.484zm-6.616-3.334l-4.334 6.5c-.145.217-.382.334-.625.334-.143 0-.288-.04-.416-.126l-.115-.094-2.415-2.415c-.293-.293-.293-.768 0-1.06s.768-.294 1.06 0l1.77 1.767 3.825-5.74c.23-.345.696-.436 1.04-.207.346.23.44.696.21 1.04z'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

.mention-verified-badge.red::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #FFD700;
    mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M22.5 12.5c0-1.58-.875-2.95-2.148-3.6.154-.435.238-.905.238-1.4 0-2.21-1.71-3.998-3.818-3.998-.47 0-.92.084-1.336.25C14.818 2.415 13.51 1.5 12 1.5s-2.816.917-3.437 2.25c-.415-.165-.866-.25-1.336-.25-2.11 0-3.818 1.79-3.818 4 0 .494.083.964.237 1.4-1.272.65-2.147 2.018-2.147 3.6 0 1.495.782 2.798 1.942 3.486-.02.17-.032.34-.032.514 0 2.21 1.708 4 3.818 4 .47 0 .92-.086 1.335-.25.62 1.334 1.926 2.25 3.437 2.25 1.512 0 2.818-.916 3.437-2.25.415.163.865.248 1.336.248 2.11 0 3.818-1.79 3.818-4 0-.174-.012-.344-.033-.513 1.158-.687 1.943-1.99 1.943-3.484zm-6.616-3.334l-4.334 6.5c-.145.217-.382.334-.625.334-.143 0-.288-.04-.416-.126l-.115-.094-2.415-2.415c-.293-.293-.293-.768 0-1.06s.768-.294 1.06 0l1.77 1.767 3.825-5.74c.23-.345.696-.436 1.04-.207.346.23.44.696.21 1.04z'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
    .edit-post-modal-content {
        background: #000;
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
    
    .edit-post-drag-handle {
        background-color: rgba(255, 255, 255, 0.3);
    }
    
    .edit-post-header-center h3 {
        color: #fff;
    }
    
    .edit-post-cancel-btn {
        color: #fff;
    }
    
    .edit-post-cancel-btn:hover {
        background-color: rgba(255, 255, 255, 0.15);
    }
    
    .edit-post-textarea {
        color: #fff;
        background: transparent;
    }
    
    .edit-post-textarea::placeholder {
        color: #a8a8a8;
    }
    
    .edit-post-username {
        color: #fff;
    }
    
    .edit-post-modal-header {
        border-bottom-color: rgba(255, 255, 255, 0.15);
        background: #000;
    }
    
    .edit-post-modal-body {
        background: #000;
    }
    
    .edit-post-add-media-btn {
        background: #2d2d2d;
        color: #fff;
    }
    
    .edit-post-add-media-btn:hover {
        background: #444;
    }
    
    .edit-post-save-btn {
        color: #2D8EFF;
    }
    
    .edit-post-save-btn:hover:not(:disabled) {
        background-color: rgba(45, 142, 255, 0.15);
    }
    
    .edit-post-save-btn:disabled {
        color: #666;
    }
    
    .edit-post-save-spinner {
        border-color: #2D8EFF;
        border-top-color: transparent;
    }
    
    .edit-post-char-count {
        color: #a8a8a8;
    }
    
    .edit-post-user-avatar {
        border-color: rgba(255, 255, 255, 0.15);
    }
    
    .edit-post-media-item {
        background-color: #1a1a1a;
        border-color: rgba(255, 255, 255, 0.15);
    }
    
    .edit-post-user-info .verified-badge.blue {
        fill: #2D8EFF;
    }
    
    .edit-post-user-info .verified-badge.red {
        fill: #FFD700;
    }
    
    /* Dark mode for mention dropdown */
    .mention-suggestions-dropdown {
        background: #1a1a1a;
        border-color: rgba(255, 255, 255, 0.15);
    }
    
    .mention-suggestion-item {
        border-bottom-color: rgba(255, 255, 255, 0.15);
    }
    
    .mention-suggestion-item:hover,
    .mention-suggestion-item.selected {
        background-color: #2a2a2a;
    }
    
    .mention-suggestion-name {
        color: #fff;
    }
    
    .mention-suggestion-username {
        color: #a8a8a8;
    }
    
    .mention-suggestion-avatar {
        border-color: rgba(255, 255, 255, 0.15);
    }
}

/* Responsive */
@media (max-width: 600px) {
    .edit-post-modal-content {
        top: 60px;
        border-radius: 20px 20px 0 0;
        max-height: calc(100vh - 60px);
    }
    
    .edit-post-media-grid {
        grid-template-columns: 1fr;
    }
    
    .mention-suggestions-dropdown {
        width: calc(100% - 32px);
        left: 16px !important;
        right: 16px !important;
    }
}

/* Desktop styles */
@media (min-width: 601px) {
    .edit-post-modal-content {
        max-width: 600px;
        margin: 0 auto;
        left: 50%;
        transform: translateX(-50%) translateY(100%);
        border-radius: 24px 24px 0 0;
        top: 90px;
        bottom: 0;
    }
    
    .edit-post-modal.active .edit-post-modal-content {
        transform: translateX(-50%) translateY(0);
    }
    
    /* Remove drag handle on desktop */
    .edit-post-drag-handle {
        display: none;
    }
}

/* Hide scrollbar */
.edit-post-modal-body::-webkit-scrollbar {
    display: none;
}

.edit-post-modal-body {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.mention-suggestions-dropdown::-webkit-scrollbar {
    display: none;
}

.mention-suggestions-dropdown {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
